diff options
| author | Konsta <konsta09@gmail.com> | 2014-11-25 17:05:59 +0200 |
|---|---|---|
| committer | Adnan Begovic <adnan@cyngn.com> | 2015-10-29 17:36:25 -0700 |
| commit | 00e20b4cbb9fb49321578517d1a7bda2d5bc3750 (patch) | |
| tree | 8c9d868b1d07bae1ee3a38b1090c32b54f77ca21 /src/com/android/settings/ButtonSettings.java | |
| parent | 6d0718eca72c43087f23cbbe219ca7aafcbab457 (diff) | |
| download | packages_apps_Settings-00e20b4cbb9fb49321578517d1a7bda2d5bc3750.tar.gz packages_apps_Settings-00e20b4cbb9fb49321578517d1a7bda2d5bc3750.tar.bz2 packages_apps_Settings-00e20b4cbb9fb49321578517d1a7bda2d5bc3750.zip | |
Settings: Volume key cursor control (2/2)
Change-Id: Ibc52b5d0c59558be9a24286ef6f1c6f049e117a3
Diffstat (limited to 'src/com/android/settings/ButtonSettings.java')
| -rw-r--r-- | src/com/android/settings/ButtonSettings.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/com/android/settings/ButtonSettings.java b/src/com/android/settings/ButtonSettings.java index 8234d2127..6e43cfd04 100644 --- a/src/com/android/settings/ButtonSettings.java +++ b/src/com/android/settings/ButtonSettings.java @@ -54,6 +54,7 @@ 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_VOLUME_KEY_CURSOR_CONTROL = "volume_key_cursor_control"; private static final String DISABLE_NAV_KEYS = "disable_nav_keys"; private static final String CATEGORY_POWER = "power_key"; @@ -92,6 +93,7 @@ public class ButtonSettings extends SettingsPreferenceFragment implements private ListPreference mHomeDoubleTapAction; private ListPreference mMenuPressAction; private ListPreference mMenuLongPressAction; + private ListPreference mVolumeKeyCursorControl; private PreferenceCategory mNavigationPreferencesCat; @@ -121,6 +123,8 @@ public class ButtonSettings extends SettingsPreferenceFragment implements (PreferenceCategory) prefScreen.findPreference(CATEGORY_HOME); final PreferenceCategory menuCategory = (PreferenceCategory) prefScreen.findPreference(CATEGORY_MENU); + final PreferenceCategory volumeCategory = + (PreferenceCategory) prefScreen.findPreference(CATEGORY_VOLUME); mHandler = new Handler(); @@ -191,6 +195,15 @@ public class ButtonSettings extends SettingsPreferenceFragment implements } else { prefScreen.removePreference(menuCategory); } + + if (Utils.hasVolumeRocker(getActivity())) { + int cursorControlAction = Settings.System.getInt(resolver, + Settings.System.VOLUME_KEY_CURSOR_CONTROL, 0); + mVolumeKeyCursorControl = initActionList(KEY_VOLUME_KEY_CURSOR_CONTROL, + cursorControlAction); + } else { + prefScreen.removePreference(volumeCategory); + } } private ListPreference initActionList(String key, int value) { @@ -232,6 +245,10 @@ public class ButtonSettings extends SettingsPreferenceFragment implements handleActionListChange(mMenuLongPressAction, newValue, Settings.System.KEY_MENU_LONG_PRESS_ACTION); return true; + } else if (preference == mVolumeKeyCursorControl) { + handleActionListChange(mVolumeKeyCursorControl, newValue, + Settings.System.VOLUME_KEY_CURSOR_CONTROL); + return true; } return false; } |
