diff options
Diffstat (limited to 'src/com/android/settings/cyanogenmod')
-rw-r--r-- | src/com/android/settings/cyanogenmod/QuickSettings.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/com/android/settings/cyanogenmod/QuickSettings.java b/src/com/android/settings/cyanogenmod/QuickSettings.java index a7dd00c..053c65c 100644 --- a/src/com/android/settings/cyanogenmod/QuickSettings.java +++ b/src/com/android/settings/cyanogenmod/QuickSettings.java @@ -25,6 +25,7 @@ import static com.android.internal.util.cm.QSConstants.TILE_WIFIAP; import static com.android.internal.util.cm.QSConstants.TILE_LTE; import static com.android.internal.util.cm.QSConstants.TILE_TORCH; import static com.android.internal.util.cm.QSUtils.deviceSupportsBluetooth; +import static com.android.internal.util.cm.QSUtils.deviceSupportsDockBattery; import static com.android.internal.util.cm.QSUtils.deviceSupportsImeSwitcher; import static com.android.internal.util.cm.QSUtils.deviceSupportsLte; import static com.android.internal.util.cm.QSUtils.deviceSupportsNfc; @@ -68,6 +69,7 @@ public class QuickSettings extends SettingsPreferenceFragment implements OnPrefe private static final String EXP_SCREENTIMEOUT_MODE = "pref_screentimeout_mode"; private static final String DYNAMIC_ALARM = "dynamic_alarm"; private static final String DYNAMIC_BUGREPORT = "dynamic_bugreport"; + private static final String DYNAMIC_DOCK_BATTERY = "dynamic_dock_battery"; private static final String DYNAMIC_IME = "dynamic_ime"; private static final String DYNAMIC_USBTETHER = "dynamic_usbtether"; private static final String DYNAMIC_WIFI = "dynamic_wifi"; @@ -82,6 +84,7 @@ public class QuickSettings extends SettingsPreferenceFragment implements OnPrefe ListPreference mScreenTimeoutMode; CheckBoxPreference mDynamicAlarm; CheckBoxPreference mDynamicBugReport; + CheckBoxPreference mDynamicDockBattery; CheckBoxPreference mDynamicWifi; CheckBoxPreference mDynamicIme; CheckBoxPreference mDynamicUsbTether; @@ -149,6 +152,15 @@ public class QuickSettings extends SettingsPreferenceFragment implements OnPrefe mDynamicAlarm.setChecked(Settings.System.getInt(resolver, Settings.System.QS_DYNAMIC_ALARM, 1) == 1); mDynamicBugReport = (CheckBoxPreference) prefSet.findPreference(DYNAMIC_BUGREPORT); mDynamicBugReport.setChecked(Settings.System.getInt(resolver, Settings.System.QS_DYNAMIC_BUGREPORT, 1) == 1); + mDynamicDockBattery = (CheckBoxPreference) prefSet.findPreference(DYNAMIC_DOCK_BATTERY); + if (mDynamicDockBattery != null) { + if (deviceSupportsDockBattery(getActivity())) { + mDynamicDockBattery.setChecked(Settings.System.getInt(resolver, Settings.System.QS_DYNAMIC_DOCK_BATTERY, 1) == 1); + } else { + mDynamicTiles.removePreference(mDynamicDockBattery); + mDynamicDockBattery = null; + } + } mDynamicIme = (CheckBoxPreference) prefSet.findPreference(DYNAMIC_IME); if (mDynamicIme != null) { if (deviceSupportsImeSwitcher(getActivity())) { @@ -248,6 +260,10 @@ public class QuickSettings extends SettingsPreferenceFragment implements OnPrefe Settings.System.putInt(resolver, Settings.System.QS_DYNAMIC_BUGREPORT, mDynamicBugReport.isChecked() ? 1 : 0); return true; + } else if (mDynamicDockBattery != null && preference == mDynamicDockBattery) { + Settings.System.putInt(resolver, Settings.System.QS_DYNAMIC_DOCK_BATTERY, + mDynamicDockBattery.isChecked() ? 1 : 0); + return true; } else if (mDynamicIme != null && preference == mDynamicIme) { Settings.System.putInt(resolver, Settings.System.QS_DYNAMIC_IME, mDynamicIme.isChecked() ? 1 : 0); |