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

Commit 29041d7f authored by Michael Gernoth's avatar Michael Gernoth Committed by Gerrit Code Review
Browse files

Revert "Remove non-functional hardware keyboard options."

The removed options are actually functional on QWERTY-phones and allow
users to disable auto-correction, auto-capitalization and auto-
punctuation when the hw-keyboard is used. So get these settings back
and change the CheckBox to a Switch while doing that. Also add
back the search-indexes for the options.

This reverts commits 572f90bd and
bf55863b.

Change-Id: I4cc37d1c0cde638b50a2ed532c37d031b5ed73d2
parent 0e370037
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
@@ -57,6 +57,34 @@
            android:persistent="false">
        <!-- Additional preference screens are inserted here programmatically
             with low order values to set the key map of each attached keyboard. -->

        <SwitchPreference
                android:key="auto_replace"
                android:title="@string/auto_replace"
                android:summaryOn="@string/auto_replace_summary"
                android:summaryOff="@string/auto_replace_summary"
                android:order="1000"
                android:persistent="false"
                />

        <SwitchPreference
                android:key="auto_caps"
                android:title="@string/auto_caps"
                android:summaryOn="@string/auto_caps_summary"
                android:summaryOff="@string/auto_caps_summary"
                android:order="1001"
                android:persistent="false"
                />

        <SwitchPreference
                android:key="auto_punctuate"
                android:title="@string/auto_punctuate"
                android:summaryOn="@string/auto_punctuate_summary"
                android:summaryOff="@string/auto_punctuate_summary"
                android:order="1002"
                android:persistent="false"
                />

    </PreferenceCategory>

    <com.android.settings.cyanogenmod.SystemSettingSwitchPreference
+54 −0
Original line number Diff line number Diff line
@@ -102,6 +102,14 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
    // false: on ICS or later
    private static final boolean SHOW_INPUT_METHOD_SWITCHER_SETTINGS = false;

    private static final String[] sSystemSettingNames = {
        System.TEXT_AUTO_REPLACE, System.TEXT_AUTO_CAPS, System.TEXT_AUTO_PUNCTUATE,
    };

    private static final String[] sHardKeyboardKeys = {
        "auto_replace", "auto_caps", "auto_punctuate",
    };

    private int mDefaultInputMethodSelectorVisibility = 0;
    private ListPreference mShowInputMethodSelectorPref;
    private SwitchPreference mStylusIconEnabled;
@@ -359,6 +367,16 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
            }
        }

        // Hard keyboard
        if (!mHardKeyboardPreferenceList.isEmpty()) {
            for (int i = 0; i < sHardKeyboardKeys.length; ++i) {
                SwitchPreference swPref = (SwitchPreference)
                        mHardKeyboardCategory.findPreference(sHardKeyboardKeys[i]);
                swPref.setChecked(
                        System.getInt(getContentResolver(), sSystemSettingNames[i], 1) > 0);
            }
        }

        updateInputDevices();

        // Refresh internal states in mInputMethodSettingValues to keep the latest
@@ -422,6 +440,15 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
                        pref.isChecked() ? 1 : 0);
                return true;
            }
            if (!mHardKeyboardPreferenceList.isEmpty()) {
                for (int i = 0; i < sHardKeyboardKeys.length; ++i) {
                    if (pref == mHardKeyboardCategory.findPreference(sHardKeyboardKeys[i])) {
                        System.putInt(getContentResolver(), sSystemSettingNames[i],
                                pref.isChecked() ? 1 : 0);
                        return true;
                    }
                }
            }
        } else if (preference == mHighTouchSensitivity) {
            return mCmHardwareManager.set(CmHardwareManager.FEATURE_HIGH_TOUCH_SENSITIVITY,
                    mHighTouchSensitivity.isChecked());
@@ -907,6 +934,33 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
                        R.string.builtin_keyboard_settings_title);
                indexable.screenTitle = screenTitle;
                indexables.add(indexable);

                // Auto replace.
                indexable = new SearchIndexableRaw(context);
                indexable.key = "auto_replace";
                indexable.title = context.getString(R.string.auto_replace);
                indexable.summaryOn = context.getString(R.string.auto_replace_summary);
                indexable.summaryOff = context.getString(R.string.auto_replace_summary);
                indexable.screenTitle = screenTitle;
                indexables.add(indexable);

                // Auto caps.
                indexable = new SearchIndexableRaw(context);
                indexable.key = "auto_caps";
                indexable.title = context.getString(R.string.auto_caps);
                indexable.summaryOn = context.getString(R.string.auto_caps_summary);
                indexable.summaryOff = context.getString(R.string.auto_caps_summary);
                indexable.screenTitle = screenTitle;
                indexables.add(indexable);

                // Auto punctuate.
                indexable = new SearchIndexableRaw(context);
                indexable.key = "auto_punctuate";
                indexable.title = context.getString(R.string.auto_punctuate);
                indexable.summaryOn = context.getString(R.string.auto_punctuate_summary);
                indexable.summaryOff = context.getString(R.string.auto_punctuate_summary);
                indexable.screenTitle = screenTitle;
                indexables.add(indexable);
            }

            // Voice input