diff options
author | Fabrice Di Meglio <fdimeglio@google.com> | 2014-06-11 20:14:15 -0700 |
---|---|---|
committer | Fabrice Di Meglio <fdimeglio@google.com> | 2014-06-12 11:13:23 -0700 |
commit | 138ff8c0457c6e1345015973668d652fa17c7c3b (patch) | |
tree | 4a4e80986fc33e2a297a359b07253fde5b27333c /src/com/android/settings/notification/ZenModeSettings.java | |
parent | 601aad2022311f88c290e8fc9d426ce76f1bd1b3 (diff) | |
download | packages_apps_Settings-138ff8c0457c6e1345015973668d652fa17c7c3b.tar.gz packages_apps_Settings-138ff8c0457c6e1345015973668d652fa17c7c3b.tar.bz2 packages_apps_Settings-138ff8c0457c6e1345015973668d652fa17c7c3b.zip |
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/notification/ZenModeSettings.java')
-rw-r--r-- | src/com/android/settings/notification/ZenModeSettings.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/com/android/settings/notification/ZenModeSettings.java b/src/com/android/settings/notification/ZenModeSettings.java index e9323d87d..40e2c55bf 100644 --- a/src/com/android/settings/notification/ZenModeSettings.java +++ b/src/com/android/settings/notification/ZenModeSettings.java @@ -107,7 +107,6 @@ public class ZenModeSettings extends SettingsPreferenceFragment implements Index private final SettingsObserver mSettingsObserver = new SettingsObserver(); private SwitchBar mSwitchBar; - private Switch mSwitch; private Context mContext; private PackageManager mPM; private ZenModeConfig mConfig; @@ -159,7 +158,8 @@ public class ZenModeSettings extends SettingsPreferenceFragment implements Index if (DEBUG) Log.d(TAG, "Loaded mConfig=" + mConfig); mSwitchBar = ((SettingsActivity) mContext).getSwitchBar(); - mSwitch = mSwitchBar.getSwitch(); + mSwitchBar.addOnSwitchChangeListener(this); + mSwitchBar.show(); final PreferenceCategory general = (PreferenceCategory) root.findPreference(KEY_GENERAL); @@ -400,14 +400,17 @@ public class ZenModeSettings extends SettingsPreferenceFragment implements Index updateControls(); updateZenMode(); mSettingsObserver.register(); - mSwitchBar.addOnSwitchChangeListener(this); - mSwitchBar.show(); } @Override public void onPause() { super.onPause(); mSettingsObserver.unregister(); + } + + @Override + public void onDestroyView() { + super.onDestroyView(); mSwitchBar.removeOnSwitchChangeListener(this); mSwitchBar.hide(); } @@ -415,8 +418,8 @@ public class ZenModeSettings extends SettingsPreferenceFragment implements Index private void updateZenMode() { final boolean zenMode = Global.getInt(getContentResolver(), Global.ZEN_MODE, Global.ZEN_MODE_OFF) != Global.ZEN_MODE_OFF; - if (mSwitch.isChecked() != zenMode) { - mSwitch.setChecked(zenMode); + if (mSwitchBar.isChecked() != zenMode) { + mSwitchBar.setChecked(zenMode); mIgnoreNext = true; } } |