summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/cyanogenmod
diff options
context:
space:
mode:
authorJorge Ruesga <jorge@ruesga.com>2013-03-18 00:44:32 +0100
committerGerrit Code Review <gerrit@cyanogenmod.org>2013-04-03 16:11:59 -0700
commit2981c936f9c254e837250e19da92e6a44cb32f90 (patch)
tree327520865ea9f5873ef3d946e77ba2c4368efd22 /src/com/android/settings/cyanogenmod
parent48a296b4d309112ec422f1a0ef4a472873e6cbdc (diff)
downloadpackages_apps_settings-2981c936f9c254e837250e19da92e6a44cb32f90.zip
packages_apps_settings-2981c936f9c254e837250e19da92e6a44cb32f90.tar.gz
packages_apps_settings-2981c936f9c254e837250e19da92e6a44cb32f90.tar.bz2
QS: Add dock battery tile (2/2)
Add a dinamic tile for devices with dock battery Requires http://review.cyanogenmod.org/#/c/33999 Patchset 2: Rebased Change-Id: If6c49a5277899997717f5a3af8ed3ad5bbb30b67 Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
Diffstat (limited to 'src/com/android/settings/cyanogenmod')
-rw-r--r--src/com/android/settings/cyanogenmod/QuickSettings.java16
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);