diff options
author | Adnan Begovic <adnan@cyngn.com> | 2015-10-29 17:03:51 -0700 |
---|---|---|
committer | Adnan Begovic <adnan@cyngn.com> | 2015-10-29 17:36:32 -0700 |
commit | dc69b7f50d8e5bb374838bcb6919ac6bb263fbee (patch) | |
tree | 5848453c818c7c0fbafcfeb2407ea5ed8261efeb | |
parent | c6b4c7e67b2270882a80d541d3173a75a921548c (diff) | |
download | packages_apps_Settings-dc69b7f50d8e5bb374838bcb6919ac6bb263fbee.zip packages_apps_Settings-dc69b7f50d8e5bb374838bcb6919ac6bb263fbee.tar.gz packages_apps_Settings-dc69b7f50d8e5bb374838bcb6919ac6bb263fbee.tar.bz2 |
Settings: Clean up power menu options.
Change-Id: I4a8a0edf776415d123ae26e8c3c6aabec0221e28
-rw-r--r-- | res/xml/power_menu_settings.xml | 15 | ||||
-rw-r--r-- | src/com/android/settings/cyanogenmod/PowerMenuActions.java | 41 |
2 files changed, 37 insertions, 19 deletions
diff --git a/res/xml/power_menu_settings.xml b/res/xml/power_menu_settings.xml index cffee1f..e29d9e1 100644 --- a/res/xml/power_menu_settings.xml +++ b/res/xml/power_menu_settings.xml @@ -35,11 +35,6 @@ android:defaultValue="false" /> <CheckBoxPreference - android:key="profile" - android:title="@string/power_menu_profiles_title" - android:defaultValue="false" /> - - <CheckBoxPreference android:key="airplane" android:title="@string/power_menu_airplane_title" android:defaultValue="true" /> @@ -69,4 +64,14 @@ android:title="@string/power_menu_sound_title" android:defaultValue="true" /> + <CheckBoxPreference + android:key="voiceassist" + android:title="@string/power_menu_sound_title" + android:defaultValue="true" /> + + <CheckBoxPreference + android:key="assist" + android:title="@string/power_menu_sound_title" + android:defaultValue="true" /> + </PreferenceScreen> diff --git a/src/com/android/settings/cyanogenmod/PowerMenuActions.java b/src/com/android/settings/cyanogenmod/PowerMenuActions.java index 7728728..844d1e8 100644 --- a/src/com/android/settings/cyanogenmod/PowerMenuActions.java +++ b/src/com/android/settings/cyanogenmod/PowerMenuActions.java @@ -35,6 +35,7 @@ import com.android.internal.logging.MetricsLogger; import com.android.settings.R; import com.android.settings.SettingsPreferenceFragment; import com.android.internal.util.cm.PowerMenuConstants; +import cyanogenmod.providers.CMSettings; import static com.android.internal.util.cm.PowerMenuConstants.*; @@ -55,6 +56,8 @@ public class PowerMenuActions extends SettingsPreferenceFragment { private CheckBoxPreference mLockdownPref; private CheckBoxPreference mBugReportPref; private CheckBoxPreference mSilentPref; + private CheckBoxPreference mVoiceAssistPref; + private CheckBoxPreference mAssistPref; Context mContext; private ArrayList<String> mLocalUserConfig = new ArrayList<String>(); @@ -85,8 +88,6 @@ public class PowerMenuActions extends SettingsPreferenceFragment { mRebootPref = (CheckBoxPreference) findPreference(GLOBAL_ACTION_KEY_REBOOT); } else if (action.equals(GLOBAL_ACTION_KEY_SCREENSHOT)) { mScreenshotPref = (CheckBoxPreference) findPreference(GLOBAL_ACTION_KEY_SCREENSHOT); - } else if (action.equals(GLOBAL_ACTION_KEY_PROFILE)) { - mProfilePref = (CheckBoxPreference) findPreference(GLOBAL_ACTION_KEY_PROFILE); } else if (action.equals(GLOBAL_ACTION_KEY_AIRPLANE)) { mAirplanePref = (CheckBoxPreference) findPreference(GLOBAL_ACTION_KEY_AIRPLANE); } else if (action.equals(GLOBAL_ACTION_KEY_USERS)) { @@ -99,6 +100,10 @@ public class PowerMenuActions extends SettingsPreferenceFragment { mBugReportPref = (CheckBoxPreference) findPreference(GLOBAL_ACTION_KEY_BUGREPORT); } else if (action.equals(GLOBAL_ACTION_KEY_SILENT)) { mSilentPref = (CheckBoxPreference) findPreference(GLOBAL_ACTION_KEY_SILENT); + } else if (action.equals(GLOBAL_ACTION_KEY_VOICEASSIST)) { + mSilentPref = (CheckBoxPreference) findPreference(GLOBAL_ACTION_KEY_VOICEASSIST); + } else if (action.equals(GLOBAL_ACTION_KEY_ASSIST)) { + mSilentPref = (CheckBoxPreference) findPreference(GLOBAL_ACTION_KEY_ASSIST); } } @@ -126,10 +131,6 @@ public class PowerMenuActions extends SettingsPreferenceFragment { mScreenshotPref.setChecked(settingsArrayContains(GLOBAL_ACTION_KEY_SCREENSHOT)); } - if (mProfilePref != null) { - mProfilePref.setChecked(settingsArrayContains(GLOBAL_ACTION_KEY_PROFILE)); - } - if (mAirplanePref != null) { mAirplanePref.setChecked(settingsArrayContains(GLOBAL_ACTION_KEY_AIRPLANE)); } @@ -162,6 +163,14 @@ public class PowerMenuActions extends SettingsPreferenceFragment { mSilentPref.setChecked(settingsArrayContains(GLOBAL_ACTION_KEY_SILENT)); } + if (mVoiceAssistPref != null) { + mVoiceAssistPref.setChecked(settingsArrayContains(GLOBAL_ACTION_KEY_VOICEASSIST)); + } + + if (mAssistPref != null) { + mAssistPref.setChecked(settingsArrayContains(GLOBAL_ACTION_KEY_ASSIST)); + } + updatePreferences(); } @@ -187,10 +196,6 @@ public class PowerMenuActions extends SettingsPreferenceFragment { value = mScreenshotPref.isChecked(); updateUserConfig(value, GLOBAL_ACTION_KEY_SCREENSHOT); - } else if (preference == mProfilePref) { - value = mProfilePref.isChecked(); - updateUserConfig(value, GLOBAL_ACTION_KEY_PROFILE); - } else if (preference == mAirplanePref) { value = mAirplanePref.isChecked(); updateUserConfig(value, GLOBAL_ACTION_KEY_AIRPLANE); @@ -215,6 +220,14 @@ public class PowerMenuActions extends SettingsPreferenceFragment { value = mSilentPref.isChecked(); updateUserConfig(value, GLOBAL_ACTION_KEY_SILENT); + } else if (preference == mVoiceAssistPref) { + value = mVoiceAssistPref.isChecked(); + updateUserConfig(value, GLOBAL_ACTION_KEY_VOICEASSIST); + + } else if (preference == mAssistPref) { + value = mAssistPref.isChecked(); + updateUserConfig(value, GLOBAL_ACTION_KEY_ASSIST); + } else { return super.onPreferenceTreeClick(preferenceScreen, preference); } @@ -246,10 +259,10 @@ public class PowerMenuActions extends SettingsPreferenceFragment { } private void updatePreferences() { - boolean bugreport = Settings.Secure.getInt(getContentResolver(), - Settings.Secure.BUGREPORT_IN_POWER_MENU, 0) != 0; - boolean profiles = Settings.System.getInt(getContentResolver(), - Settings.System.SYSTEM_PROFILES_ENABLED, 1) != 0; + boolean bugreport = CMSettings.Secure.getInt(getContentResolver(), + CMSettings.Secure.BUGREPORT_IN_POWER_MENU, 0) != 0; + boolean profiles = CMSettings.System.getInt(getContentResolver(), + CMSettings.System.SYSTEM_PROFILES_ENABLED, 1) != 0; if (mProfilePref != null) { mProfilePref.setEnabled(profiles); |