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

Commit 7beab9d5 authored by Steve Kondik's avatar Steve Kondik
Browse files

settings: Add option to toggle the pointer icon when using stylus

Forward-port to CM-11.0

Change-Id: Ib9c22ecb05cc698ead5bfffa34d2a2ffa9c21e13
parent 9320f28f
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -891,4 +891,8 @@ two in order to insert additional control points. \'Remove\' deletes the selecte
    <string name="cmlicense_title">CyanogenMod Legal</string>
    <string name="settings_cmlicense_activity_title">CyanogenMod Legal</string>
    <string name="settings_cmlicense_activity_unreachable">You don\'t have a data connection. To view this information now, go to %s from any computer connected to the Internet.</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>
</resources>
+7 −1
Original line number Diff line number Diff line
@@ -93,6 +93,12 @@
                android:title="@string/pointer_speed"
                android:dialogTitle="@string/pointer_speed" />

        <CheckBoxPreference 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" />

        <!-- Gesture pad settings -->
        <Preference
            android:key="gesture_pad_settings">
+12 −1
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ 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_TRACKPAD_SETTINGS = "gesture_pad_settings";
    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;
@@ -79,6 +80,7 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
        "auto_replace", "auto_caps", "auto_punctuate",
    };

    private CheckBoxPreference mStylusIconEnabled;
    private int mDefaultInputMethodSelectorVisibility = 0;
    private ListPreference mShowInputMethodSelectorPref;
    private PreferenceCategory mKeyboardSettingsCategory;
@@ -173,6 +175,7 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
        mIm = (InputManager)getActivity().getSystemService(Context.INPUT_SERVICE);
        updateInputDevices();

        mStylusIconEnabled = (CheckBoxPreference) findPreference(KEY_STYLUS_ICON_ENABLED);
        if (!getResources().getBoolean(com.android.internal.R.bool.config_stylusGestures)) {
            PreferenceCategory pointerSettingsCategory = (PreferenceCategory)
                findPreference(KEY_POINTER_SETTINGS_CATEGORY);
@@ -289,6 +292,11 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
            }
        }

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

        // Hard keyboard
        if (!mHardKeyboardPreferenceList.isEmpty()) {
            for (int i = 0; i < sHardKeyboardKeys.length; ++i) {
@@ -344,7 +352,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())) {