From 4e41df4b3b5886899b871670430aca055ecda06e Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Sun, 22 Apr 2012 15:25:09 +0530 Subject: Redo layout to use a switch instead of a radio group --- res/layout/main.xml | 22 ++++++---------------- .../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" > - - - - - - + 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"); -- cgit v1.2.3