summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/bluetooth
diff options
context:
space:
mode:
authorFabrice Di Meglio <fdimeglio@google.com>2014-06-11 20:14:15 -0700
committerFabrice Di Meglio <fdimeglio@google.com>2014-06-12 11:13:23 -0700
commit138ff8c0457c6e1345015973668d652fa17c7c3b (patch)
tree4a4e80986fc33e2a297a359b07253fde5b27333c /src/com/android/settings/bluetooth
parent601aad2022311f88c290e8fc9d426ce76f1bd1b3 (diff)
downloadpackages_apps_Settings-138ff8c0457c6e1345015973668d652fa17c7c3b.zip
packages_apps_Settings-138ff8c0457c6e1345015973668d652fa17c7c3b.tar.gz
packages_apps_Settings-138ff8c0457c6e1345015973668d652fa17c7c3b.tar.bz2
Make the SwitchBar appear immediately
- change the way the SwitchBar is shown and hidden - save its state - remove the delay transition code Change-Id: I07260430e6709b42517ca011f6d3c3446a626731
Diffstat (limited to 'src/com/android/settings/bluetooth')
-rw-r--r--src/com/android/settings/bluetooth/BluetoothEnabler.java14
-rwxr-xr-xsrc/com/android/settings/bluetooth/BluetoothSettings.java8
2 files changed, 18 insertions, 4 deletions
diff --git a/src/com/android/settings/bluetooth/BluetoothEnabler.java b/src/com/android/settings/bluetooth/BluetoothEnabler.java
index be03b63..45f3d06 100644
--- a/src/com/android/settings/bluetooth/BluetoothEnabler.java
+++ b/src/com/android/settings/bluetooth/BluetoothEnabler.java
@@ -89,6 +89,16 @@ public final class BluetoothEnabler implements SwitchBar.OnSwitchChangeListener
mIntentFilter = new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED);
}
+ public void setupSwitchBar() {
+ mSwitchBar.addOnSwitchChangeListener(this);
+ mSwitchBar.show();
+ }
+
+ public void teardownSwitchBar() {
+ mSwitchBar.removeOnSwitchChangeListener(this);
+ mSwitchBar.hide();
+ }
+
public void resume(Context context) {
if (mLocalAdapter == null) {
mSwitch.setEnabled(false);
@@ -103,8 +113,6 @@ public final class BluetoothEnabler implements SwitchBar.OnSwitchChangeListener
handleStateChanged(mLocalAdapter.getBluetoothState());
mContext.registerReceiver(mReceiver, mIntentFilter);
- mSwitchBar.addOnSwitchChangeListener(this);
- mSwitchBar.show();
mValidListener = true;
}
@@ -114,8 +122,6 @@ public final class BluetoothEnabler implements SwitchBar.OnSwitchChangeListener
}
mContext.unregisterReceiver(mReceiver);
- mSwitchBar.removeOnSwitchChangeListener(this);
- mSwitchBar.hide();
mValidListener = false;
}
diff --git a/src/com/android/settings/bluetooth/BluetoothSettings.java b/src/com/android/settings/bluetooth/BluetoothSettings.java
index dd4edff..eb318cd 100755
--- a/src/com/android/settings/bluetooth/BluetoothSettings.java
+++ b/src/com/android/settings/bluetooth/BluetoothSettings.java
@@ -119,6 +119,14 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem
mSwitchBar = activity.getSwitchBar();
mBluetoothEnabler = new BluetoothEnabler(activity, mSwitchBar);
+ mBluetoothEnabler.setupSwitchBar();
+ }
+
+ @Override
+ public void onDestroyView() {
+ super.onDestroyView();
+
+ mBluetoothEnabler.teardownSwitchBar();
}
@Override