diff options
| author | Michael Bestas <mikeioannina@gmail.com> | 2014-12-20 21:35:34 +0200 |
|---|---|---|
| committer | Adnan Begovic <adnan@cyngn.com> | 2015-10-29 17:36:27 -0700 |
| commit | 213bd3fdf7d07fb441aad453f905634f62243193 (patch) | |
| tree | a44ce07431f1eb6eec60cec52b1d80a46c1b0300 /src/com/android/settings/ButtonSettings.java | |
| parent | d6c1ebc2485927b1711ac9c0bd93b798090066a0 (diff) | |
| download | packages_apps_Settings-213bd3fdf7d07fb441aad453f905634f62243193.tar.gz packages_apps_Settings-213bd3fdf7d07fb441aad453f905634f62243193.tar.bz2 packages_apps_Settings-213bd3fdf7d07fb441aad453f905634f62243193.zip | |
Forward port Search button configuration
Enables the ability to assign different actions to short and long
presses on the Search button.
Change-Id: I0f7ca9145155debe4af6d96681724fc9911845a0
Diffstat (limited to 'src/com/android/settings/ButtonSettings.java')
| -rw-r--r-- | src/com/android/settings/ButtonSettings.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/com/android/settings/ButtonSettings.java b/src/com/android/settings/ButtonSettings.java index f9ff3300d..e3fe8397c 100644 --- a/src/com/android/settings/ButtonSettings.java +++ b/src/com/android/settings/ButtonSettings.java @@ -55,6 +55,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_ASSIST_PRESS = "hardware_keys_assist_press"; + private static final String KEY_ASSIST_LONG_PRESS = "hardware_keys_assist_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"; @@ -102,6 +104,8 @@ public class ButtonSettings extends SettingsPreferenceFragment implements private ListPreference mHomeDoubleTapAction; private ListPreference mMenuPressAction; private ListPreference mMenuLongPressAction; + private ListPreference mAssistPressAction; + private ListPreference mAssistLongPressAction; private ListPreference mAppSwitchPressAction; private ListPreference mAppSwitchLongPressAction; private ListPreference mVolumeKeyCursorControl; @@ -152,6 +156,8 @@ public class ButtonSettings extends SettingsPreferenceFragment implements (PreferenceCategory) prefScreen.findPreference(CATEGORY_BACK); final PreferenceCategory menuCategory = (PreferenceCategory) prefScreen.findPreference(CATEGORY_MENU); + final PreferenceCategory assistCategory = + (PreferenceCategory) prefScreen.findPreference(CATEGORY_ASSIST); final PreferenceCategory appSwitchCategory = (PreferenceCategory) prefScreen.findPreference(CATEGORY_APPSWITCH); final PreferenceCategory volumeCategory = @@ -272,6 +278,20 @@ public class ButtonSettings extends SettingsPreferenceFragment implements prefScreen.removePreference(menuCategory); } + if (hasAssistKey) { + int pressAction = Settings.System.getInt(resolver, + Settings.System.KEY_ASSIST_ACTION, ACTION_SEARCH); + mAssistPressAction = initActionList(KEY_ASSIST_PRESS, pressAction); + + int longPressAction = Settings.System.getInt(resolver, + Settings.System.KEY_ASSIST_LONG_PRESS_ACTION, ACTION_VOICE_SEARCH); + mAssistLongPressAction = initActionList(KEY_ASSIST_LONG_PRESS, longPressAction); + + hasAnyBindableKey = true; + } else { + prefScreen.removePreference(assistCategory); + } + if (hasAppSwitchKey) { int pressAction = Settings.System.getInt(resolver, Settings.System.KEY_APP_SWITCH_ACTION, ACTION_APP_SWITCH); @@ -396,6 +416,14 @@ public class ButtonSettings extends SettingsPreferenceFragment implements handleActionListChange(mMenuLongPressAction, newValue, Settings.System.KEY_MENU_LONG_PRESS_ACTION); return true; + } else if (preference == mAssistPressAction) { + handleActionListChange(mAssistPressAction, newValue, + Settings.System.KEY_ASSIST_ACTION); + return true; + } else if (preference == mAssistLongPressAction) { + handleActionListChange(mAssistLongPressAction, newValue, + Settings.System.KEY_ASSIST_LONG_PRESS_ACTION); + return true; } else if (preference == mAppSwitchPressAction) { handleActionListChange(mAppSwitchPressAction, newValue, Settings.System.KEY_APP_SWITCH_ACTION); |
