summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/inputmethod
diff options
context:
space:
mode:
authorXiao-Long Chen <chenxiaolong@cxl.epac.to>2014-06-25 08:39:08 -0400
committerAdnan Begovic <adnan@cyngn.com>2015-10-29 17:36:30 -0700
commit3d41100aac8bc0b6776e8a17c52811e23db129e4 (patch)
treed2ff7486ee3c0b5650e023ca8c7ace2b47ba2dea /src/com/android/settings/inputmethod
parentcf472a9b4491c95a03bbac2613c3bdacf8e5a033 (diff)
downloadpackages_apps_Settings-3d41100aac8bc0b6776e8a17c52811e23db129e4.zip
packages_apps_Settings-3d41100aac8bc0b6776e8a17c52811e23db129e4.tar.gz
packages_apps_Settings-3d41100aac8bc0b6776e8a17c52811e23db129e4.tar.bz2
Settings: Add HighTouchSensitivity support
refactored for CM12 Change-Id: I4e55ec992ed7b0241211e0fb36ebc877879b8e89
Diffstat (limited to 'src/com/android/settings/inputmethod')
-rw-r--r--src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java28
1 files changed, 27 insertions, 1 deletions
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++) {