mirror of
https://github.com/badaix/snapcast.git
synced 2025-08-03 08:39:49 +02:00
moved scan button into menu
This commit is contained in:
parent
2fead18951
commit
ec71c73e11
2 changed files with 33 additions and 16 deletions
|
@ -11,6 +11,8 @@ import android.os.Build;
|
|||
import android.os.Bundle;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
|
@ -42,7 +44,6 @@ public class MainActivity extends ActionBarActivity implements View.OnClickListe
|
|||
|
||||
private static final String TAG = "Main";
|
||||
|
||||
private Button buttonScan;
|
||||
private Button buttonStart;
|
||||
private Button buttonStop;
|
||||
private Button button;
|
||||
|
@ -67,7 +68,6 @@ public class MainActivity extends ActionBarActivity implements View.OnClickListe
|
|||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
buttonScan = (Button) findViewById(R.id.buttonScan);
|
||||
buttonStart = (Button) findViewById(R.id.buttonStart);
|
||||
buttonStop = (Button) findViewById(R.id.buttonStop);
|
||||
button = (Button) findViewById(R.id.button);
|
||||
|
@ -86,7 +86,6 @@ public class MainActivity extends ActionBarActivity implements View.OnClickListe
|
|||
|
||||
lvClient = (ListView) findViewById(R.id.lvClient);
|
||||
|
||||
buttonScan.setOnClickListener(this);
|
||||
buttonStart.setOnClickListener(this);
|
||||
buttonStop.setOnClickListener(this);
|
||||
button.setOnClickListener(this);
|
||||
|
@ -95,7 +94,7 @@ public class MainActivity extends ActionBarActivity implements View.OnClickListe
|
|||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||
String rate = audioManager.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE);
|
||||
String size = audioManager.getProperty(AudioManager.PROPERTY_OUTPUT_FRAMES_PER_BUFFER);
|
||||
tvInfo.setText("Preferred buffer size: " + size + "\nPreferred sample rate: " + rate);
|
||||
tvInfo.setText("Sample rate: " + rate + ", buffer size: " + size);
|
||||
}
|
||||
|
||||
clientInfoAdapter = new ClientInfoAdapter(this, this);
|
||||
|
@ -151,6 +150,33 @@ public class MainActivity extends ActionBarActivity implements View.OnClickListe
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.menu_snapcast, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle action bar item clicks here. The action bar will
|
||||
// automatically handle clicks on the Home/Up button, so long
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
int id = item.getItemId();
|
||||
|
||||
//noinspection SimplifiableIfStatement
|
||||
if (id == R.id.action_settings) {
|
||||
Toast.makeText(this, "Not implemented", Toast.LENGTH_SHORT).show();
|
||||
return true;
|
||||
} else if (id == R.id.action_scan) {
|
||||
initializeDiscoveryListener();
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
|
||||
private void copyAssets() {
|
||||
AssetManager assetManager = getAssets();
|
||||
String[] files = null;
|
||||
|
@ -222,9 +248,6 @@ public class MainActivity extends ActionBarActivity implements View.OnClickListe
|
|||
start();
|
||||
} else if (view == buttonStop) {
|
||||
stop();
|
||||
} else if (view == buttonScan) {
|
||||
Toast.makeText(this, "Scan", Toast.LENGTH_SHORT).show();
|
||||
initializeDiscoveryListener();
|
||||
} else if (view == button) {
|
||||
startTcpClient();
|
||||
}
|
||||
|
|
|
@ -25,13 +25,6 @@
|
|||
android:layout_marginRight="20dp"
|
||||
android:id="@+id/linearLayout">
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Scan"
|
||||
android:id="@+id/buttonScan"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -54,7 +47,8 @@
|
|||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:text="Host: no Snapserver found"
|
||||
android:id="@+id/tvHost"
|
||||
android:layout_margin="3dp" />
|
||||
android:layout_marginLeft="3dp"
|
||||
android:layout_marginTop="2dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -62,7 +56,7 @@
|
|||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:text="Info: this is a prototype"
|
||||
android:id="@+id/tvInfo"
|
||||
android:layout_margin="3dp" />
|
||||
android:layout_marginLeft="3dp" />
|
||||
|
||||
<CheckBox
|
||||
android:layout_width="wrap_content"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue