diff options
-rw-r--r-- | res/values/cm_strings.xml | 4 | ||||
-rw-r--r-- | res/xml/language_settings.xml | 6 | ||||
-rw-r--r-- | src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java | 28 |
3 files changed, 37 insertions, 1 deletions
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml index f5b1e84..b982fd1 100644 --- a/res/values/cm_strings.xml +++ b/res/values/cm_strings.xml @@ -506,4 +506,8 @@ <!-- Whether to display IME switcher notifcation --> <string name="ime_switcher_notify">Selector notification</string> <string name="ime_switcher_notify_summary">Display input method selector notification</string> + + <!-- High touch sensitivity --> + <string name="high_touch_sensitivity_title">High touch sensitivity</string> + <string name="high_touch_sensitivity_summary">Increase touchscreen sensitivity so it can be used while wearing gloves</string> </resources> diff --git a/res/xml/language_settings.xml b/res/xml/language_settings.xml index f328255..0e299b7 100644 --- a/res/xml/language_settings.xml +++ b/res/xml/language_settings.xml @@ -95,6 +95,12 @@ android:targetPackage="com.cyanogenmod.settings.device" android:targetClass="com.cyanogenmod.settings.device.GesturePadSettings" /> </Preference> + + <SwitchPreference + android:key="high_touch_sensitivity" + android:title="@string/high_touch_sensitivity_title" + android:summary="@string/high_touch_sensitivity_summary" + android:defaultValue="false" /> </PreferenceCategory> <PreferenceCategory diff --git a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java index 6badffc..439efbc 100644 --- a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java +++ b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java @@ -74,6 +74,8 @@ import java.util.List; import java.util.Locale; import java.util.TreeSet; +import org.cyanogenmod.hardware.HighTouchSensitivity; + public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment implements Preference.OnPreferenceChangeListener, InputManager.InputDeviceListener, KeyboardLayoutDialogFragment.OnSetupKeyboardLayoutsListener, Indexable, @@ -83,14 +85,16 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment private static final String KEY_CURRENT_INPUT_METHOD = "current_input_method"; private static final String KEY_INPUT_METHOD_SELECTOR = "input_method_selector"; private static final String KEY_USER_DICTIONARY_SETTINGS = "key_user_dictionary_settings"; + private static final String KEY_POINTER_SETTINGS_CATEGORY = "pointer_settings_category"; private static final String KEY_PREVIOUSLY_ENABLED_SUBTYPES = "previously_enabled_subtypes"; private static final String KEY_TRACKPAD_SETTINGS = "gesture_pad_settings"; - + private static final String KEY_HIGH_TOUCH_SENSITIVITY = "high_touch_sensitivity"; // false: on ICS or later private static final boolean SHOW_INPUT_METHOD_SWITCHER_SETTINGS = false; private int mDefaultInputMethodSelectorVisibility = 0; private ListPreference mShowInputMethodSelectorPref; + private SwitchPreference mHighTouchSensitivity; private PreferenceCategory mKeyboardSettingsCategory; private PreferenceCategory mHardKeyboardCategory; private PreferenceCategory mGameControllerCategory; @@ -168,6 +172,17 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment mIm = (InputManager)activity.getSystemService(Context.INPUT_SERVICE); updateInputDevices(); + PreferenceCategory pointerSettingsCategory = (PreferenceCategory) + findPreference(KEY_POINTER_SETTINGS_CATEGORY); + + mHighTouchSensitivity = (SwitchPreference) findPreference(KEY_HIGH_TOUCH_SENSITIVITY); + if (!isHighTouchSensitivitySupported()) { + pointerSettingsCategory.removePreference(mHighTouchSensitivity); + mHighTouchSensitivity = null; + } else { + mHighTouchSensitivity.setChecked(HighTouchSensitivity.isEnabled()); + } + // Enable or disable mStatusBarImeSwitcher based on boolean: config_show_cmIMESwitcher boolean showCmImeSwitcher = getResources().getBoolean( com.android.internal.R.bool.config_show_cmIMESwitcher); @@ -345,6 +360,8 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment pref.isChecked() ? 1 : 0); return true; } + } else if (preference == mHighTouchSensitivity) { + return HighTouchSensitivity.setEnabled(mHighTouchSensitivity.isChecked()); } return super.onPreferenceTreeClick(preferenceScreen, preference); } @@ -622,6 +639,15 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment } } + private static boolean isHighTouchSensitivitySupported() { + try { + return HighTouchSensitivity.isSupported(); + } catch (NoClassDefFoundError e) { + // Hardware abstraction framework not installed + return false; + } + } + private static boolean haveInputDeviceWithVibrator() { final int[] devices = InputDevice.getDeviceIds(); for (int i = 0; i < devices.length; i++) { |