summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanesh Mondegarian <daneshm90@gmail.com>2012-12-16 12:02:16 -0500
committerDanesh Mondegarian <daneshm90@gmail.com>2012-12-16 18:55:53 -0500
commit8cb740563263546a109a0f5b918d1487b3a20d42 (patch)
treea6a86b9c9415b7382b2ff906d1f40d513e974691
parent28d7594b866e3cd13aea9b570b0a4f9976c9cf8c (diff)
downloadpackages_apps_settings-8cb740563263546a109a0f5b918d1487b3a20d42.zip
packages_apps_settings-8cb740563263546a109a0f5b918d1487b3a20d42.tar.gz
packages_apps_settings-8cb740563263546a109a0f5b918d1487b3a20d42.tar.bz2
QuickSettings : Option to dismiss on toggle
This option dismisses the notification pane when a toggle is selected Patchset 2,3 : Shorten preference title Rework logic for removing preferences on tablets Change-Id: Ia2392b2336f018bcc52e9ddbaf2dfa4433dd62c2
-rw-r--r--res/values/strings.xml2
-rw-r--r--res/xml/quick_settings_panel_settings.xml5
-rw-r--r--src/com/android/settings/cyanogenmod/QuickSettings.java21
3 files changed, 19 insertions, 9 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 4848268..8448b1b 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -5040,6 +5040,8 @@
<string name="title_general">General</string>
<string name="title_quick_pulldown">Quick pulldown</string>
<string name="summary_quick_pulldown">Show Quick Settings when pulling down notification bar near the right side of the screen</string>
+ <string name="title_collapse_panel">Auto close panel</string>
+ <string name="summary_collapse_panel">Close the notification panel upon toggle</string>
<!-- Reset tiles -->
<string name="tiles_reset_title">Reset</string>
diff --git a/res/xml/quick_settings_panel_settings.xml b/res/xml/quick_settings_panel_settings.xml
index 08afabc..edc5d61 100644
--- a/res/xml/quick_settings_panel_settings.xml
+++ b/res/xml/quick_settings_panel_settings.xml
@@ -27,6 +27,11 @@
android:title="@string/title_quick_pulldown"
android:summary="@string/summary_quick_pulldown" />
+ <CheckBoxPreference
+ android:key="collapse_panel"
+ android:title="@string/title_collapse_panel"
+ android:summary="@string/summary_collapse_panel" />
+
</PreferenceCategory>
<PreferenceCategory
diff --git a/src/com/android/settings/cyanogenmod/QuickSettings.java b/src/com/android/settings/cyanogenmod/QuickSettings.java
index 9cd6d4d..8bd4a03 100644
--- a/src/com/android/settings/cyanogenmod/QuickSettings.java
+++ b/src/com/android/settings/cyanogenmod/QuickSettings.java
@@ -50,7 +50,7 @@ public class QuickSettings extends SettingsPreferenceFragment implements OnPrefe
private static final String DYNAMIC_IME = "dynamic_ime";
private static final String DYNAMIC_WIFI = "dynamic_wifi";
private static final String QUICK_PULLDOWN = "quick_pulldown";
- private static final String GENERAL_SETTINGS = "pref_general_settings";
+ private static final String COLLAPSE_PANEL = "collapse_panel";
MultiSelectListPreference mRingMode;
CheckBoxPreference mDynamicAlarm;
@@ -58,7 +58,7 @@ public class QuickSettings extends SettingsPreferenceFragment implements OnPrefe
CheckBoxPreference mDynamicWifi;
CheckBoxPreference mDynamicIme;
CheckBoxPreference mQuickPulldown;
- PreferenceCategory mGeneralSettings;
+ CheckBoxPreference mCollapsePanel;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -74,17 +74,16 @@ public class QuickSettings extends SettingsPreferenceFragment implements OnPrefe
PackageManager pm = getPackageManager();
ContentResolver resolver = getActivity().getApplicationContext().getContentResolver();
- // Get the General settings category
- mGeneralSettings = (PreferenceCategory) prefSet.findPreference(GENERAL_SETTINGS);
- if (Utils.isTablet(getActivity())) {
- // Nothing for tablets in the general settings section, remove it
- prefSet.removePreference(mGeneralSettings);
+ mQuickPulldown = (CheckBoxPreference) prefSet.findPreference(QUICK_PULLDOWN);
+ if (!Utils.isPhone(getActivity())) {
+ prefSet.removePreference(mQuickPulldown);
} else {
- // Add the Quick Pulldown preference
- mQuickPulldown = (CheckBoxPreference) prefSet.findPreference(QUICK_PULLDOWN);
mQuickPulldown.setChecked(Settings.System.getInt(resolver, Settings.System.QS_QUICK_PULLDOWN, 0) == 1);
}
+ mCollapsePanel = (CheckBoxPreference) prefSet.findPreference(COLLAPSE_PANEL);
+ mCollapsePanel.setChecked(Settings.System.getInt(resolver, Settings.System.QS_COLLAPSE_PANEL, 0) == 1);
+
// Add the sound mode
mRingMode = (MultiSelectListPreference) prefSet.findPreference(EXP_RING_MODE);
String storedRingMode = Settings.System.getString(getActivity()
@@ -142,6 +141,10 @@ public class QuickSettings extends SettingsPreferenceFragment implements OnPrefe
Settings.System.putInt(resolver, Settings.System.QS_QUICK_PULLDOWN,
mQuickPulldown.isChecked() ? 1 : 0);
return true;
+ } else if (preference == mCollapsePanel) {
+ Settings.System.putInt(resolver, Settings.System.QS_COLLAPSE_PANEL,
+ mCollapsePanel.isChecked() ? 1 : 0);
+ return true;
}
return super.onPreferenceTreeClick(preferenceScreen, preference);
}