Small fixes to power save UI.

Use the correct default setting, and don't crash.

Change-Id: I33fd612aba404e13c8bbe9110535dff1cfba12a4
This commit is contained in:
Dianne Hackborn
2014-06-10 23:17:01 -07:00
parent e9ee5e2ced
commit de159c8d16

View File

@@ -59,7 +59,9 @@ public class BatterySaverSettings extends SettingsPreferenceFragment
mSwitchBar = ((SettingsActivity) mContext).getSwitchBar();
updateSwitchBar();
mTriggerPref = new SettingPref(SettingPref.TYPE_GLOBAL, KEY_TURN_ON_AUTOMATICALLY,
Global.LOW_POWER_MODE_TRIGGER_LEVEL, 0,
Global.LOW_POWER_MODE_TRIGGER_LEVEL,
mContext.getResources().getInteger(
com.android.internal.R.integer.config_lowBatteryWarningLevel),
getResources().getIntArray(R.array.battery_saver_trigger_values)) {
@Override
protected String getCaption(Resources res, int value) {
@@ -103,6 +105,7 @@ public class BatterySaverSettings extends SettingsPreferenceFragment
mSettingsObserver.setListening(false);
if (mSwitchBarListenerAdded) {
mSwitchBar.removeOnSwitchChangeListener(this);
mSwitchBarListenerAdded = false;
}
mSwitchBar.hide();
}