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

Commit 7b221605 authored by Edward Wang's avatar Edward Wang Committed by Michael Bestas
Browse files

make default overlay for "show correction suggestion"

Change-Id: I0d403021e2315ab0178b9aa7a8f5e4fa7f3f24b7
parent 423bea86
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -109,4 +109,7 @@
    <string-array name="keyboard_switcher_symbols_shifted" translatable="false">
        <item>58,32</item> <!-- KeyEvent.KEYCODE_ALT_RIGHT , KeyEvent.META_ALT_RIGHT_ON -->
    </string-array>

    <!-- Display suggested words while typing  -->
    <bool name="config_show_suggestions_default">true</bool>
</resources>
+0 −1
Original line number Diff line number Diff line
@@ -51,7 +51,6 @@
        android:key="show_suggestions"
        android:summary="@string/prefs_show_suggestions_summary"
        android:title="@string/prefs_show_suggestions"
        android:defaultValue="true"
        android:persistent="true" />
    <CheckBoxPreference
        android:key="pref_key_use_personalized_dicts"
+7 −0
Original line number Diff line number Diff line
@@ -90,6 +90,13 @@ public final class CorrectionSettingsFragment extends SubScreenFragment

        mUseContactsPreference = (SwitchPreference) findPreference(Settings.PREF_KEY_USE_CONTACTS_DICT);
        turnOffUseContactsIfNoPermission();

        final SwitchPreference suggestionsEnabledPreference = (SwitchPreference) findPreference(
                Settings.PREF_SHOW_SUGGESTIONS);
        if (suggestionsEnabledPreference != null) {
            suggestionsEnabledPreference.setChecked(
                    Settings.getInstance().getCurrent().isSuggestionsEnabledPerUserSettings());
        }
    }

    private void overwriteUserDictionaryPreference(final Preference userDictionaryPreference) {
+4 −3
Original line number Diff line number Diff line
@@ -184,7 +184,7 @@ public class SettingsValues {
                && prefs.getBoolean(Settings.PREF_GESTURE_FLOATING_PREVIEW_TEXT, true);
        mAutoCorrectionEnabledPerUserSettings = mAutoCorrectEnabled
                && !mInputAttributes.mInputTypeNoAutoCorrect;
        mSuggestionsEnabledPerUserSettings = readSuggestionsEnabled(prefs);
        mSuggestionsEnabledPerUserSettings = readSuggestionsEnabled(prefs, res);
        mIsInternal = Settings.isInternal(prefs);
        mHasCustomKeyPreviewAnimationParams = prefs.getBoolean(
                DebugSettings.PREF_HAS_CUSTOM_KEY_PREVIEW_ANIMATION_PARAMS, false);
@@ -303,7 +303,7 @@ public class SettingsValues {

    private static final String SUGGESTIONS_VISIBILITY_HIDE_VALUE_OBSOLETE = "2";

    private static boolean readSuggestionsEnabled(final SharedPreferences prefs) {
    private static boolean readSuggestionsEnabled(final SharedPreferences prefs, Resources res) {
        if (prefs.contains(Settings.PREF_SHOW_SUGGESTIONS_SETTING_OBSOLETE)) {
            final boolean alwaysHide = SUGGESTIONS_VISIBILITY_HIDE_VALUE_OBSOLETE.equals(
                    prefs.getString(Settings.PREF_SHOW_SUGGESTIONS_SETTING_OBSOLETE, null));
@@ -312,7 +312,8 @@ public class SettingsValues {
                    .putBoolean(Settings.PREF_SHOW_SUGGESTIONS, !alwaysHide)
                    .apply();
        }
        return prefs.getBoolean(Settings.PREF_SHOW_SUGGESTIONS, true);
        return prefs.getBoolean(Settings.PREF_SHOW_SUGGESTIONS, res.getBoolean(
                                R.bool.config_show_suggestions_default));
    }

    private static boolean readBigramPredictionEnabled(final SharedPreferences prefs,