OG: [2/2] Long press back to kill app
Change-Id: I349aebff131e90edd1923762f38a20dd10b8fcb9
(cherry picked from commit 9dc47fdb1d1e2bb3d9626e28528604ef3048904c)
diff --git a/res/xml/button_settings.xml b/res/xml/button_settings.xml
index 8585946..ae76ffb 100644
--- a/res/xml/button_settings.xml
+++ b/res/xml/button_settings.xml
@@ -259,12 +259,12 @@
android:entries="@array/navbar_recents_style_entries"
android:entryValues="@array/navbar_recents_style_values"
android:persistent="false"/>
-
+-->
<org.omnirom.omnigears.preference.SystemCheckBoxPreference
android:key="button_back_kill_enable"
android:title="@string/button_back_kill_enable_title"
android:summary="@string/button_back_kill_enable_summary"
- android:defaultValue="true"/>
+ android:defaultValue="false"/>
<ListPreference
android:key="button_back_kill_timeout"
@@ -273,7 +273,7 @@
android:entryValues="@array/button_back_kill_timeout_values"
android:persistent="false"
android:dependency="button_back_kill_enable"/>
--->
+
<PreferenceScreen
android:key="global_actions"
android:title="@string/global_actions_title"
diff --git a/src/org/omnirom/omnigears/ButtonSettings.java b/src/org/omnirom/omnigears/ButtonSettings.java
index 4880502..9fc474f 100644
--- a/src/org/omnirom/omnigears/ButtonSettings.java
+++ b/src/org/omnirom/omnigears/ButtonSettings.java
@@ -92,7 +92,7 @@
private static final String KEYS_SHOW_NAVBAR_KEY = "navigation_bar_show";
private static final String KEYS_DISABLE_HW_KEY = "hardware_keys_disable";
// private static final String NAVIGATION_BAR_RECENTS_STYLE = "navbar_recents_style";
-// private static final String BUTTON_BACK_KILL_TIMEOUT = "button_back_kill_timeout";
+ private static final String BUTTON_BACK_KILL_TIMEOUT = "button_back_kill_timeout";
// Available custom actions to perform on a key press.
// private static final int ACTION_NOTHING = 0;
@@ -121,7 +121,7 @@
// private CheckBoxPreference mHomeAnswerCall;
private CheckBoxPreference mSwapVolumeButtons;
// private ListPreference mVolumeKeyCursorControl;
-// private SwitchPreference mEnableCustomBindings;
+ private SwitchPreference mEnableCustomBindings;
// private ListPreference mBackPressAction;
// private ListPreference mBackLongPressAction;
// private ListPreference mHomePressAction;
@@ -148,7 +148,7 @@
// private PreferenceCategory mKeysAppSwitchCategory;
// private PreferenceCategory mKeysAssistCategory;
// private ListPreference mNavbarRecentsStyle;
-// private ListPreference mBackKillTimeout;
+ private ListPreference mBackKillTimeout;
@Override
protected int getMetricsCategory() {
@@ -471,7 +471,7 @@
mNavbarRecentsStyle.setValue(Integer.toString(recentsStyle));
mNavbarRecentsStyle.setSummary(mNavbarRecentsStyle.getEntry());
mNavbarRecentsStyle.setOnPreferenceChangeListener(this);
-
+*/
mBackKillTimeout = (ListPreference) findPreference(BUTTON_BACK_KILL_TIMEOUT);
final int backKillTimeoutDefault = res.getInteger(com.android.internal.R.integer.config_backKillTimeout);
final int backKillTimeout = Settings.System.getInt(resolver,
@@ -479,7 +479,7 @@
mBackKillTimeout.setValue(Integer.toString(backKillTimeout));
mBackKillTimeout.setSummary(mBackKillTimeout.getEntry());
- mBackKillTimeout.setOnPreferenceChangeListener(this);*/
+ mBackKillTimeout.setOnPreferenceChangeListener(this);
// final PreferenceCategory headsethookCategory =
// (PreferenceCategory) prefScreen.findPreference(CATEGORY_HEADSETHOOK);
@@ -546,13 +546,13 @@
}
public boolean onPreferenceChange(Preference preference, Object newValue) {
-/* if (preference == mEnableCustomBindings) {
- boolean value = (Boolean) newValue;
- Settings.System.putInt(getContentResolver(), Settings.System.HARDWARE_KEY_REBINDING,
- value ? 1 : 0);
- boolean harwareKeysDisable = Settings.System.getInt(getContentResolver(),
- Settings.System.HARDWARE_KEYS_DISABLE, 0) == 1;
- updateDisableHWKeyEnablement(harwareKeysDisable);
+ if (preference == mEnableCustomBindings) {
+// boolean value = (Boolean) newValue;
+// Settings.System.putInt(getContentResolver(), Settings.System.HARDWARE_KEY_REBINDING,
+// value ? 1 : 0);
+// boolean harwareKeysDisable = Settings.System.getInt(getContentResolver(),
+// Settings.System.HARDWARE_KEYS_DISABLE, 0) == 1;
+// updateDisableHWKeyEnablement(harwareKeysDisable);
return true;
// } else if (preference == mVolumeKeyCursorControl) {
// String volumeKeyCursorControl = (String) newValue;
@@ -562,7 +562,7 @@
// int index = mVolumeKeyCursorControl.findIndexOfValue(volumeKeyCursorControl);
// mVolumeKeyCursorControl.setSummary(mVolumeKeyCursorControl.getEntries()[index]);
// return true;
- } else if (preference == mBackPressAction) {
+/* } else if (preference == mBackPressAction) {
int value = Integer.valueOf((String) newValue);
int index = mBackPressAction.findIndexOfValue((String) newValue);
mBackPressAction.setSummary(
@@ -699,14 +699,14 @@
int index = mNavbarRecentsStyle.findIndexOfValue((String) newValue);
mNavbarRecentsStyle.setSummary(mNavbarRecentsStyle.getEntries()[index]);
Settings.System.putInt(getContentResolver(), Settings.System.NAVIGATION_BAR_RECENTS, value);
- return true;
+ return true;*/
} else if (preference == mBackKillTimeout) {
int value = Integer.valueOf((String) newValue);
int index = mBackKillTimeout.findIndexOfValue((String) newValue);
mBackKillTimeout.setSummary(mBackKillTimeout.getEntries()[index]);
Settings.System.putInt(getContentResolver(), Settings.System.BUTTON_BACK_KILL_TIMEOUT, value);
return true;
- } */
+ }
return false;
}
@@ -786,8 +786,9 @@
// mVirtualKeyHapticFeedback.setEnabled(!harwareKeysDisable);
// mForceShowOverflowMenu.setEnabled(!harwareKeysDisable);
-// mEnableCustomBindings.setEnabled(!harwareKeysDisable);
- mButtonBrightness.setEnabled(!harwareKeysDisable);
+
+ mEnableCustomBindings.setEnabled(!harwareKeysDisable);
+ mButtonBrightness.setEnabled(!harwareKeysDisable);
// mKeysHomeCategory.setEnabled(!harwareKeysDisable && enableHWKeyRebinding);
// mKeysBackCategory.setEnabled(!harwareKeysDisable && enableHWKeyRebinding);
// mKeysMenuCategory.setEnabled(!harwareKeysDisable && enableHWKeyRebinding);