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

Commit de0b076e authored by fuzz's avatar fuzz Committed by Gerrit Code Review
Browse files

inputmethod: Fixup remove stylus preference for non stylus devices

This commit included following changes

 * Move show stylus icon checkbox to Pointer Settings Category
 * Fixup issues stylus preference doesn't remove if not supported
 * Improve the code remove stylus preference if not supported
 * Remove an unnecessary variable introduced on http://review.cyanogenmod.org/#/c/33774/

Change-Id: I0f2e1b5cda00033915bb25902ce970f9eda52048
parent 4c51b453
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -110,13 +110,13 @@
                android:key="pointer_speed"
                android:title="@string/pointer_speed"
                android:dialogTitle="@string/pointer_speed" />
    </PreferenceCategory>

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

    <PreferenceCategory android:key="game_controller_settings_category"
            android:title="@string/game_controller_settings_category">
+8 −3
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceCategory;
import android.preference.PreferenceGroup;
import android.preference.PreferenceScreen;
import android.provider.Settings;
import android.provider.Settings.System;
@@ -62,8 +63,8 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
    private static final String KEY_USER_DICTIONARY_SETTINGS = "key_user_dictionary_settings";
    private static final String KEY_IME_SWITCHER = "status_bar_ime_switcher";
    private static final String KEY_VOLUME_KEY_CURSOR_CONTROL = "volume_key_cursor_control";
    private static final String KEY_POINTER_SETTINGS_CATEGORY = "pointer_settings_category";
    private static final String KEY_STYLUS_ICON_ENABLED = "stylus_icon_enabled";
    private static final String VOLUME_KEY_CURSOR_CONTROL = "volume_key_cursor_control";
    private static final String KEY_STYLUS_GESTURES = "stylus_gestures";

    // false: on ICS or later
@@ -85,6 +86,7 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
    private PreferenceCategory mHardKeyboardCategory;
    private PreferenceCategory mGameControllerCategory;
    private Preference mLanguagePref;
    private PreferenceScreen mStylusGestures;
    private final ArrayList<InputMethodPreference> mInputMethodPreferenceList =
            new ArrayList<InputMethodPreference>();
    private final ArrayList<PreferenceScreen> mHardKeyboardPreferenceList =
@@ -188,11 +190,14 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
            }
        }

        mStylusGestures = (PreferenceScreen) findPreference(KEY_STYLUS_GESTURES);
        mStylusIconEnabled = (CheckBoxPreference) findPreference(KEY_STYLUS_ICON_ENABLED);
        // remove stylus preference for non stylus devices
        if (!getResources().getBoolean(com.android.internal.R.bool.config_stylusGestures)) {
            getPreferenceScreen().removePreference(findPreference(KEY_STYLUS_GESTURES));
            mStylusIconEnabled = null;
            PreferenceGroup pointerSettingsCategory = (PreferenceGroup)
                    findPreference(KEY_POINTER_SETTINGS_CATEGORY);
            pointerSettingsCategory.removePreference(mStylusGestures);
            pointerSettingsCategory.removePreference(mStylusIconEnabled);
        }

        // Spell Checker