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

Commit 681184d1 authored by Ken Wakasa's avatar Ken Wakasa Committed by Android (Google) Code Review
Browse files

Merge "Remove "Key popup dismiss delay" when "Popup on keypress" is suppressed"

parents 30dd5588 9f78eed4
Loading
Loading
Loading
Loading
+28 −23
Original line number Diff line number Diff line
@@ -143,28 +143,25 @@ public class Settings extends InputMethodSettingsFragment
            generalSettings.removePreference(mVoicePreference);
        }

        if (!VibratorUtils.getInstance(context).hasVibrator()) {
        final PreferenceGroup advancedSettings =
                (PreferenceGroup) findPreference(PREF_ADVANCED_SETTINGS);
        if (!VibratorUtils.getInstance(context).hasVibrator()) {
            generalSettings.removePreference(findPreference(PREF_VIBRATE_ON));
            if (null != advancedSettings) { // Theoretically advancedSettings cannot be null
                advancedSettings.removePreference(findPreference(PREF_VIBRATION_DURATION_SETTINGS));
            }
        }

        final boolean showPopupOption = res.getBoolean(
        final boolean showKeyPreviewPopupOption = res.getBoolean(
                R.bool.config_enable_show_popup_on_keypress_option);
        if (!showPopupOption) {
            generalSettings.removePreference(findPreference(PREF_POPUP_ON));
        }

        final CheckBoxPreference includeOtherImesInLanguageSwitchList =
                (CheckBoxPreference)findPreference(PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST);
        includeOtherImesInLanguageSwitchList.setEnabled(
                !SettingsValues.isLanguageSwitchKeySupressed(prefs));

        mKeyPreviewPopupDismissDelay =
                (ListPreference) findPreference(PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY);
        if (!showKeyPreviewPopupOption) {
            generalSettings.removePreference(findPreference(PREF_POPUP_ON));
            if (null != advancedSettings) { // Theoretically advancedSettings cannot be null
                advancedSettings.removePreference(mKeyPreviewPopupDismissDelay);
            }
        } else {
            final String[] entries = new String[] {
                    res.getString(R.string.key_preview_popup_dismiss_no_delay),
                    res.getString(R.string.key_preview_popup_dismiss_default_delay),
@@ -179,6 +176,12 @@ public class Settings extends InputMethodSettingsFragment
            }
            mKeyPreviewPopupDismissDelay.setEnabled(
                    SettingsValues.isKeyPreviewPopupEnabled(prefs, res));
        }

        final CheckBoxPreference includeOtherImesInLanguageSwitchList =
                (CheckBoxPreference)findPreference(PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST);
        includeOtherImesInLanguageSwitchList.setEnabled(
                !SettingsValues.isLanguageSwitchKeySupressed(prefs));

        final PreferenceScreen dictionaryLink =
                (PreferenceScreen) findPreference(PREF_CONFIGURE_DICTIONARIES_KEY);
@@ -305,7 +308,9 @@ public class Settings extends InputMethodSettingsFragment

    private void updateKeyPreviewPopupDelaySummary() {
        final ListPreference lp = mKeyPreviewPopupDismissDelay;
        lp.setSummary(lp.getEntries()[lp.findIndexOfValue(lp.getValue())]);
        final CharSequence[] entries = lp.getEntries();
        if (entries == null || entries.length <= 0) return;
        lp.setSummary(entries[lp.findIndexOfValue(lp.getValue())]);
    }

    private void updateVoiceModeSummary() {