summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/DevelopmentSettings.java
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/DevelopmentSettings.java
parent601aad2022311f88c290e8fc9d426ce76f1bd1b3 (diff)
downloadpackages_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/DevelopmentSettings.java')
-rw-r--r--src/com/android/settings/DevelopmentSettings.java24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index ce44907e5..5e5113bec 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -167,7 +167,6 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
private WifiManager mWifiManager;
private SwitchBar mSwitchBar;
- private Switch mEnabledSwitch;
private boolean mLastEnabledState;
private boolean mHaveDebugSettings;
private boolean mDontPokeProperties;
@@ -386,11 +385,12 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
final SettingsActivity activity = (SettingsActivity) getActivity();
mSwitchBar = activity.getSwitchBar();
- mEnabledSwitch = mSwitchBar.getSwitch();
- if (mUnavailable) {
- mEnabledSwitch.setEnabled(false);
+ if (mUnavailable) {
+ mSwitchBar.setEnabled(false);
return;
}
+
+ mSwitchBar.addOnSwitchChangeListener(this);
}
private boolean removePreferenceForProduction(Preference preference) {
@@ -441,7 +441,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
final ContentResolver cr = getActivity().getContentResolver();
mLastEnabledState = Settings.Global.getInt(cr,
Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0;
- mEnabledSwitch.setChecked(mLastEnabledState);
+ mSwitchBar.setChecked(mLastEnabledState);
setPrefsEnabledState(mLastEnabledState);
if (mHaveDebugSettings && !mLastEnabledState) {
@@ -452,17 +452,15 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
Settings.Global.putInt(getActivity().getContentResolver(),
Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1);
mLastEnabledState = true;
- mEnabledSwitch.setChecked(mLastEnabledState);
+ mSwitchBar.setChecked(mLastEnabledState);
setPrefsEnabledState(mLastEnabledState);
}
-
- mSwitchBar.addOnSwitchChangeListener(this);
mSwitchBar.show();
}
@Override
- public void onPause() {
- super.onPause();
+ public void onDestroyView() {
+ super.onDestroyView();
mSwitchBar.removeOnSwitchChangeListener(this);
mSwitchBar.hide();
@@ -1210,7 +1208,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
@Override
public void onSwitchChanged(Switch switchView, boolean isChecked) {
- if (switchView != mEnabledSwitch) {
+ if (switchView != mSwitchBar.getSwitch()) {
return;
}
if (isChecked != mLastEnabledState) {
@@ -1463,7 +1461,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
setPrefsEnabledState(mLastEnabledState);
} else {
// Reset the toggle
- mEnabledSwitch.setChecked(false);
+ mSwitchBar.setChecked(false);
}
}
}
@@ -1477,7 +1475,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
mAdbDialog = null;
} else if (dialog == mEnableDialog) {
if (!mDialogClicked) {
- mEnabledSwitch.setChecked(false);
+ mSwitchBar.setChecked(false);
}
mEnableDialog = null;
}