Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 88c837b1 authored by Steve Kondik's avatar Steve Kondik Committed by Steve Kondik
Browse files

settings: Add option to toggle the pointer icon when using stylus(1/3)

Forward port from CM-11.0

Change-Id: I43ce881b91f2a7d58acaa3225818997c4e4e364f
parent bd58149b
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1023,6 +1023,10 @@
    <string name="navigation_ring_title">Navigation ring targets</string>
    <string name="navigation_ring_message">Tap the edit icon to open the navigation ring for editing.\n\nSelect a target to configure its behavior.\n\nTap the check mark icon to save your changes, or restore to reset the settings to defaults.</string>

    <!-- Stylus Icon -->
    <string name="stylus_icon_enabled_title">Show icon when using stylus</string>
    <string name="stylus_icon_enabled_summary">Show the pointer icon when hovering or drawing with the stylus</string>

    <!-- Stylus Gestures -->
    <string name="gestures_settings_title">Stylus gestures</string>
    <string name="category_spen_title">Stylus gestures</string>
+6 −0
Original line number Diff line number Diff line
@@ -98,6 +98,12 @@
                android:key="stylus_gestures"
                android:title="@string/gestures_settings_title" />

        <SwitchPreference android:key="stylus_icon_enabled"
                android:title="@string/stylus_icon_enabled_title"
                android:summary="@string/stylus_icon_enabled_summary"
                android:defaultValue="false"
                android:persistent="false" />

        <SwitchPreference
                android:key="high_touch_sensitivity"
                android:title="@string/high_touch_sensitivity_title"
+13 −1
Original line number Diff line number Diff line
@@ -89,12 +89,14 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
    private static final String KEY_HIGH_TOUCH_SENSITIVITY = "high_touch_sensitivity";
    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";

    // false: on ICS or later
    private static final boolean SHOW_INPUT_METHOD_SWITCHER_SETTINGS = false;

    private int mDefaultInputMethodSelectorVisibility = 0;
    private ListPreference mShowInputMethodSelectorPref;
    private SwitchPreference mStylusIconEnabled;
    private SwitchPreference mHighTouchSensitivity;
    private PreferenceCategory mKeyboardSettingsCategory;
    private PreferenceCategory mHardKeyboardCategory;
@@ -173,11 +175,13 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
                        findPreference(KEY_POINTER_SETTINGS_CATEGORY);

        mStylusGestures = (PreferenceScreen) findPreference(KEY_STYLUS_GESTURES);
        mStylusIconEnabled = (SwitchPreference) findPreference(KEY_STYLUS_ICON_ENABLED);
        mHighTouchSensitivity = (SwitchPreference) findPreference(KEY_HIGH_TOUCH_SENSITIVITY);

        if (pointerSettingsCategory != null) {
            if (!getResources().getBoolean(com.android.internal.R.bool.config_stylusGestures)) {
                pointerSettingsCategory.removePreference(mStylusGestures);
                pointerSettingsCategory.removePreference(mStylusIconEnabled);
            }

            if (!isHighTouchSensitivitySupported()) {
@@ -300,6 +304,11 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
            }
        }

        if (mStylusIconEnabled != null) {
            mStylusIconEnabled.setChecked(Settings.System.getInt(getActivity().getContentResolver(),
                    Settings.System.STYLUS_ICON_ENABLED, 0) == 1);
        }

        if (!mShowsOnlyFullImeAndKeyboardList) {
            if (mLanguagePref != null) {
                String localeName = getLocaleName(getActivity());
@@ -357,7 +366,10 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
        if (Utils.isMonkeyRunning()) {
            return false;
        }
        if (preference instanceof PreferenceScreen) {
        if (preference == mStylusIconEnabled) {
            Settings.System.putInt(getActivity().getContentResolver(),
                Settings.System.STYLUS_ICON_ENABLED, mStylusIconEnabled.isChecked() ? 1 : 0);
        } else if (preference instanceof PreferenceScreen) {
            if (preference.getFragment() != null) {
                // Fragment will be handled correctly by the super class.
            } else if (KEY_CURRENT_INPUT_METHOD.equals(preference.getKey())) {