summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFranco <frapeti@gmail.com>2015-01-27 20:26:18 -0300
committerAdnan Begovic <adnan@cyngn.com>2015-10-29 17:36:30 -0700
commit80a7e5a3deb409a47e47f60e9e2b391508410e0e (patch)
tree6f9decb37e985d4e43988e8c14b2b2685a3fab79
parent925ea3a6a395e5c3e69be053c8a47c3f546c2889 (diff)
downloadpackages_apps_Settings-80a7e5a3deb409a47e47f60e9e2b391508410e0e.zip
packages_apps_Settings-80a7e5a3deb409a47e47f60e9e2b391508410e0e.tar.gz
packages_apps_Settings-80a7e5a3deb409a47e47f60e9e2b391508410e0e.tar.bz2
Settings: Add touchscreen hovering support
Change-Id: I5e8d607cb7530e4e1addaf545f520f672cdc5c10
-rw-r--r--res/values/cm_strings.xml4
-rw-r--r--res/xml/language_settings.xml6
-rw-r--r--src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java27
3 files changed, 36 insertions, 1 deletions
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
index ab05bab..1708090 100644
--- a/res/values/cm_strings.xml
+++ b/res/values/cm_strings.xml
@@ -539,4 +539,8 @@
<!-- Stylus gestures -->
<string name="stylus_app_not_installed">%s is not installed</string>
+
+ <!-- Touchscreen hovering -->
+ <string name="touchscreen_hovering_title">Touchscreen hovering</string>
+ <string name="touchscreen_hovering_summary">Allows you to hover the screen like a mouse in web browsers, remote desktops, etc</string>
</resources>
diff --git a/res/xml/language_settings.xml b/res/xml/language_settings.xml
index 94aa73b..5cd619d 100644
--- a/res/xml/language_settings.xml
+++ b/res/xml/language_settings.xml
@@ -104,6 +104,12 @@
android:summary="@string/high_touch_sensitivity_summary"
android:defaultValue="false" />
+ <SwitchPreference
+ android:key="touchscreen_hovering"
+ android:title="@string/touchscreen_hovering_title"
+ android:summary="@string/touchscreen_hovering_summary"
+ android:defaultValue="false" />
+
<!-- Gesture pad settings -->
<Preference
android:key="gesture_pad_settings">
diff --git a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
index bc50d4f..f796ed8 100644
--- a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
+++ b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
@@ -75,6 +75,7 @@ import java.util.Locale;
import java.util.TreeSet;
import org.cyanogenmod.hardware.HighTouchSensitivity;
+import org.cyanogenmod.hardware.TouchscreenHovering;
public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
implements Preference.OnPreferenceChangeListener, InputManager.InputDeviceListener,
@@ -87,8 +88,9 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
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";
+ private static final String KEY_TOUCHSCREEN_HOVERING = "touchscreen_hovering";
+ private static final String KEY_TRACKPAD_SETTINGS = "gesture_pad_settings";
private static final String KEY_STYLUS_GESTURES = "stylus_gestures";
private static final String KEY_STYLUS_ICON_ENABLED = "stylus_icon_enabled";
@@ -99,6 +101,7 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
private ListPreference mShowInputMethodSelectorPref;
private SwitchPreference mStylusIconEnabled;
private SwitchPreference mHighTouchSensitivity;
+ private SwitchPreference mTouchscreenHovering;
private PreferenceCategory mKeyboardSettingsCategory;
private PreferenceCategory mHardKeyboardCategory;
private PreferenceCategory mGameControllerCategory;
@@ -184,6 +187,8 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
mStylusIconEnabled = (SwitchPreference) findPreference(KEY_STYLUS_ICON_ENABLED);
mHighTouchSensitivity = (SwitchPreference) findPreference(KEY_HIGH_TOUCH_SENSITIVITY);
+ mTouchscreenHovering = (SwitchPreference) findPreference(KEY_TOUCHSCREEN_HOVERING);
+
if (pointerSettingsCategory != null) {
if (!getResources().getBoolean(com.android.internal.R.bool.config_stylusGestures)) {
pointerSettingsCategory.removePreference(mStylusGestures);
@@ -197,6 +202,15 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
mHighTouchSensitivity.setChecked(HighTouchSensitivity.isEnabled());
}
+ if (!isTouchscreenHoveringSupported()) {
+ pointerSettingsCategory.removePreference(mTouchscreenHovering);
+ mTouchscreenHovering = null;
+ } else {
+ mTouchscreenHovering.setChecked(TouchscreenHovering.isEnabled());
+ }
+
+ Utils.updatePreferenceToSpecificActivityFromMetaDataOrRemove(getActivity(),
+ pointerSettingsCategory, KEY_TRACKPAD_SETTINGS);
if (pointerSettingsCategory.getPreferenceCount() == 0) {
getPreferenceScreen().removePreference(pointerSettingsCategory);
}
@@ -391,6 +405,8 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
}
} else if (preference == mHighTouchSensitivity) {
return HighTouchSensitivity.setEnabled(mHighTouchSensitivity.isChecked());
+ } else if (preference == mTouchscreenHovering) {
+ return TouchscreenHovering.setEnabled(mTouchscreenHovering.isChecked());
}
return super.onPreferenceTreeClick(preferenceScreen, preference);
}
@@ -677,6 +693,15 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
}
}
+ private static boolean isTouchscreenHoveringSupported() {
+ try {
+ return TouchscreenHovering.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++) {