diff options
author | Matt Mower <mowerm@gmail.com> | 2014-12-18 03:41:46 -0600 |
---|---|---|
committer | Adnan Begovic <adnan@cyngn.com> | 2015-10-29 17:36:26 -0700 |
commit | a851c539694d50f0189d63cfd56587198f00512f (patch) | |
tree | cc9bb68d46815d2f4546fb82f228a277d640465c /src/com/android/settings/ButtonSettings.java | |
parent | 8365213eb9c835391d355bf68261ad50d1e64f8c (diff) | |
download | packages_apps_Settings-a851c539694d50f0189d63cfd56587198f00512f.zip packages_apps_Settings-a851c539694d50f0189d63cfd56587198f00512f.tar.gz packages_apps_Settings-a851c539694d50f0189d63cfd56587198f00512f.tar.bz2 |
Buttons: Forward port Recents button configuration
Enables the ability to assign different actions to short and long
presses on the Recents (App Switch) button.
Change-Id: I5f8835841218932789431057e0531914a29980b9
Diffstat (limited to 'src/com/android/settings/ButtonSettings.java')
-rw-r--r-- | src/com/android/settings/ButtonSettings.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/com/android/settings/ButtonSettings.java b/src/com/android/settings/ButtonSettings.java index 056b30f..326391a 100644 --- a/src/com/android/settings/ButtonSettings.java +++ b/src/com/android/settings/ButtonSettings.java @@ -53,6 +53,8 @@ public class ButtonSettings extends SettingsPreferenceFragment implements private static final String KEY_HOME_DOUBLE_TAP = "hardware_keys_home_double_tap"; private static final String KEY_MENU_PRESS = "hardware_keys_menu_press"; private static final String KEY_MENU_LONG_PRESS = "hardware_keys_menu_long_press"; + private static final String KEY_APP_SWITCH_PRESS = "hardware_keys_app_switch_press"; + private static final String KEY_APP_SWITCH_LONG_PRESS = "hardware_keys_app_switch_long_press"; private static final String KEY_VOLUME_KEY_CURSOR_CONTROL = "volume_key_cursor_control"; private static final String KEY_VOLUME_WAKE_DEVICE = "volume_key_wake_device"; private static final String DISABLE_NAV_KEYS = "disable_nav_keys"; @@ -95,6 +97,8 @@ public class ButtonSettings extends SettingsPreferenceFragment implements private ListPreference mHomeDoubleTapAction; private ListPreference mMenuPressAction; private ListPreference mMenuLongPressAction; + private ListPreference mAppSwitchPressAction; + private ListPreference mAppSwitchLongPressAction; private ListPreference mVolumeKeyCursorControl; private SwitchPreference mDisableNavigationKeys; private SwitchPreference mPowerEndCall; @@ -122,6 +126,7 @@ public class ButtonSettings extends SettingsPreferenceFragment implements final boolean hasHomeKey = (deviceKeys & KEY_MASK_HOME) != 0; final boolean hasMenuKey = (deviceKeys & KEY_MASK_MENU) != 0; final boolean hasAssistKey = (deviceKeys & KEY_MASK_ASSIST) != 0; + final boolean hasAppSwitchKey = (deviceKeys & KEY_MASK_APP_SWITCH) != 0; boolean hasAnyBindableKey = false; final PreferenceCategory powerCategory = @@ -130,6 +135,8 @@ public class ButtonSettings extends SettingsPreferenceFragment implements (PreferenceCategory) prefScreen.findPreference(CATEGORY_HOME); final PreferenceCategory menuCategory = (PreferenceCategory) prefScreen.findPreference(CATEGORY_MENU); + final PreferenceCategory appSwitchCategory = + (PreferenceCategory) prefScreen.findPreference(CATEGORY_APPSWITCH); final PreferenceCategory volumeCategory = (PreferenceCategory) prefScreen.findPreference(CATEGORY_VOLUME); @@ -227,6 +234,20 @@ public class ButtonSettings extends SettingsPreferenceFragment implements prefScreen.removePreference(menuCategory); } + if (hasAppSwitchKey) { + int pressAction = Settings.System.getInt(resolver, + Settings.System.KEY_APP_SWITCH_ACTION, ACTION_APP_SWITCH); + mAppSwitchPressAction = initActionList(KEY_APP_SWITCH_PRESS, pressAction); + + int longPressAction = Settings.System.getInt(resolver, + Settings.System.KEY_APP_SWITCH_LONG_PRESS_ACTION, ACTION_NOTHING); + mAppSwitchLongPressAction = initActionList(KEY_APP_SWITCH_LONG_PRESS, longPressAction); + + hasAnyBindableKey = true; + } else { + prefScreen.removePreference(appSwitchCategory); + } + if (Utils.hasVolumeRocker(getActivity())) { int cursorControlAction = Settings.System.getInt(resolver, Settings.System.VOLUME_KEY_CURSOR_CONTROL, 0); @@ -320,6 +341,14 @@ public class ButtonSettings extends SettingsPreferenceFragment implements handleActionListChange(mMenuLongPressAction, newValue, Settings.System.KEY_MENU_LONG_PRESS_ACTION); return true; + } else if (preference == mAppSwitchPressAction) { + handleActionListChange(mAppSwitchPressAction, newValue, + Settings.System.KEY_APP_SWITCH_ACTION); + return true; + } else if (preference == mAppSwitchLongPressAction) { + handleActionListChange(mAppSwitchLongPressAction, newValue, + Settings.System.KEY_APP_SWITCH_LONG_PRESS_ACTION); + return true; } else if (preference == mVolumeKeyCursorControl) { handleActionListChange(mVolumeKeyCursorControl, newValue, Settings.System.VOLUME_KEY_CURSOR_CONTROL); |