diff options
author | Arun Raghavan <arun.raghavan@collabora.co.uk> | 2012-04-22 15:25:09 +0530 |
---|---|---|
committer | Arun Raghavan <arun.raghavan@collabora.co.uk> | 2012-04-22 15:25:09 +0530 |
commit | 4e41df4b3b5886899b871670430aca055ecda06e (patch) | |
tree | 322ef881fa6265cf5efff72f23228f9427b2984f | |
parent | c2b7425612748e957ed3a595552d41770c60315f (diff) |
Redo layout to use a switch instead of a radio group
-rw-r--r-- | res/layout/main.xml | 22 | ||||
-rw-r--r-- | src/org/pulseaudio/outputswitcher/OutputSwitcher.java | 10 |
2 files changed, 11 insertions, 21 deletions
diff --git a/res/layout/main.xml b/res/layout/main.xml index 119fcc4..bfe47ab 100644 --- a/res/layout/main.xml +++ b/res/layout/main.xml @@ -4,27 +4,17 @@ android:layout_width="fill_parent" android:layout_height="fill_parent" > -<EditText android:id="@+id/text_server" +<Switch android:id="@+id/switch_remote" android:layout_width="fill_parent" android:layout_height="wrap_content" + android:text="Remote playback" /> -<RadioGroup android:id="@+id/rgroup_output" +<TextView android:id="@+id/text_status" android:layout_width="fill_parent" android:layout_height="wrap_content" - android:orientation="vertical" - > - <RadioButton android:id="@+id/radio_local" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="Local" - /> - <RadioButton android:id="@+id/radio_remote" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="Remote" - /> -</RadioGroup> -<TextView android:id="@+id/text_status" + android:text="Enter a hostname or IP address for remote playback" + /> +<EditText android:id="@+id/text_server" android:layout_width="fill_parent" android:layout_height="wrap_content" /> diff --git a/src/org/pulseaudio/outputswitcher/OutputSwitcher.java b/src/org/pulseaudio/outputswitcher/OutputSwitcher.java index 472a7d3..dd530e1 100644 --- a/src/org/pulseaudio/outputswitcher/OutputSwitcher.java +++ b/src/org/pulseaudio/outputswitcher/OutputSwitcher.java @@ -21,14 +21,14 @@ import android.widget.*; import android.net.wifi.WifiManager; import android.net.wifi.WifiManager.WifiLock; -public class OutputSwitcher extends Activity implements RadioGroup.OnCheckedChangeListener +public class OutputSwitcher extends Activity implements CompoundButton.OnCheckedChangeListener { private WifiLock wifiLock; @Override - public void onCheckedChanged(RadioGroup group, int checkedId) + public void onCheckedChanged(CompoundButton sw, boolean isChecked) { - if (checkedId == R.id.radio_local) { + if (!isChecked) { if (switchToLocal()) updateStatus("Switched to local playback"); else @@ -53,8 +53,8 @@ public class OutputSwitcher extends Activity implements RadioGroup.OnCheckedChan super.onCreate(savedInstanceState); setContentView(R.layout.main); - RadioGroup group = (RadioGroup) findViewById(R.id.rgroup_output); - group.setOnCheckedChangeListener(this); + Switch sw = (Switch) findViewById(R.id.switch_remote); + sw.setOnCheckedChangeListener(this); WifiManager wm = (WifiManager) getSystemService(WIFI_SERVICE); wifiLock = wm.createWifiLock(WifiManager.WIFI_MODE_FULL_HIGH_PERF, "PA_WifiLock"); |