diff options
-rw-r--r-- | res/values/cm_strings.xml | 1 | ||||
-rw-r--r-- | res/xml/button_settings.xml | 22 | ||||
-rw-r--r-- | src/com/android/settings/ButtonSettings.java | 29 |
3 files changed, 52 insertions, 0 deletions
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml index d780bce..0a11c3d 100644 --- a/res/values/cm_strings.xml +++ b/res/values/cm_strings.xml @@ -315,6 +315,7 @@ <string name="hardware_keys_power_key_title">Power button</string> <string name="hardware_keys_home_key_title">Home button</string> <string name="hardware_keys_menu_key_title">Menu button</string> + <string name="hardware_keys_appswitch_key_title">Recents button</string> <string name="hardware_keys_volume_keys_title">Volume buttons</string> <string name="hardware_keys_short_press_title">Short press action</string> <string name="hardware_keys_long_press_title">Long press action</string> diff --git a/res/xml/button_settings.xml b/res/xml/button_settings.xml index 35ce751..716710c 100644 --- a/res/xml/button_settings.xml +++ b/res/xml/button_settings.xml @@ -92,6 +92,28 @@ </PreferenceCategory> <PreferenceCategory + android:key="app_switch_key" + android:title="@string/hardware_keys_appswitch_key_title" > + + <ListPreference + android:key="hardware_keys_app_switch_press" + android:dialogTitle="@string/hardware_keys_short_press_title" + android:title="@string/hardware_keys_short_press_title" + android:entries="@array/hardware_keys_action_entries" + android:entryValues="@array/hardware_keys_action_values" + android:persistent="false" /> + + <ListPreference + android:key="hardware_keys_app_switch_long_press" + android:dialogTitle="@string/hardware_keys_long_press_title" + android:title="@string/hardware_keys_long_press_title" + android:entries="@array/hardware_keys_action_entries" + android:entryValues="@array/hardware_keys_action_values" + android:persistent="false" /> + + </PreferenceCategory> + + <PreferenceCategory android:key="volume_keys" android:title="@string/hardware_keys_volume_keys_title" > 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); |