Add preference settings for paste button

This commit is contained in:
Trevor Terris 2021-11-21 15:41:44 -05:00
parent 69ef3c9991
commit 972a77ef3a
5 changed files with 14 additions and 3 deletions

View file

@ -56,6 +56,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
// PREF_VOICE_MODE_OBSOLETE is obsolete. Use PREF_VOICE_INPUT_KEY instead.
public static final String PREF_VOICE_MODE_OBSOLETE = "voice_mode";
public static final String PREF_VOICE_INPUT_KEY = "pref_voice_input_key";
public static final String PREF_CLIPBOARD_PASTE_KEY = "pref_clipboard_paste_key";
public static final String PREF_EDIT_PERSONAL_DICTIONARY = "edit_personal_dictionary";
// PREF_AUTO_CORRECTION_THRESHOLD_OBSOLETE is obsolete. Use PREF_AUTO_CORRECTION instead.
public static final String PREF_AUTO_CORRECTION_THRESHOLD_OBSOLETE =
@ -77,6 +78,8 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
"pref_show_language_switch_key";
public static final String PREF_SHOW_EMOJI_KEY =
"pref_show_emoji_key";
public static final String PREF_SHOW_PASTE_KEY =
"pref_show_paste_key";
public static final String PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST =
"pref_include_other_imes_in_language_switch_list";
public static final String PREF_CUSTOM_INPUT_STYLES = "custom_input_styles";

View file

@ -73,6 +73,7 @@ public class SettingsValues {
public final boolean mShowsHints;
public final boolean mShowsLanguageSwitchKey;
public final boolean mShowsEmojiKey;
public final boolean mShowsPasteKey;
public final boolean mUsePersonalizedDicts;
public final boolean mUseDoubleSpacePeriod;
public final boolean mBlockPotentiallyOffensive;
@ -149,6 +150,7 @@ public class SettingsValues {
mShowsHints = prefs.getBoolean(Settings.PREF_SHOW_HINTS, true);
mShowsLanguageSwitchKey = prefs.getBoolean(Settings.PREF_SHOW_LANGUAGE_SWITCH_KEY, false);
mShowsEmojiKey = prefs.getBoolean(Settings.PREF_SHOW_EMOJI_KEY, false);
mShowsPasteKey = prefs.getBoolean(Settings.PREF_SHOW_PASTE_KEY, false);
mUsePersonalizedDicts = prefs.getBoolean(Settings.PREF_KEY_USE_PERSONALIZED_DICTS, true);
mUseDoubleSpacePeriod = prefs.getBoolean(Settings.PREF_KEY_USE_DOUBLE_SPACE_PERIOD, true)
&& inputAttributes.mIsGeneralTextInput;

View file

@ -190,10 +190,8 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
final int visibility = shouldBeVisible ? VISIBLE : (isFullscreenMode ? GONE : INVISIBLE);
setVisibility(visibility);
final SettingsValues currentSettingsValues = Settings.getInstance().getCurrent();
//TODO: set either mVoiceKey or mPasteKey to INVISIBLE if the other is GONE
mVoiceKey.setVisibility(currentSettingsValues.mShowsVoiceInputKey ? VISIBLE : GONE);
//TODO: read visibility from settings
mPasteKey.setVisibility(VISIBLE);
mPasteKey.setVisibility(currentSettingsValues.mShowsPasteKey ? VISIBLE : (mVoiceKey.getVisibility() == GONE ? INVISIBLE : GONE));
mOtherKey.setVisibility(currentSettingsValues.mIncognitoModeEnabled ? VISIBLE : INVISIBLE);
}

View file

@ -179,6 +179,9 @@
<!-- The summary text to describe the reason why the "Voice input key" option is disabled. [CHAR LIMIT=100] -->
<string name="voice_input_disabled_summary">No voice input methods enabled. Check Languages&#160;&amp; input settings.</string>
<!-- Preferences item for enabling pasting from keyboard -->
<string name="show_paste_key">Clipboard paste key</string>
<!-- Title for configuring input method settings [CHAR LIMIT=35] -->
<string name="configure_input_method">Configure input methods</string>

View file

@ -71,4 +71,9 @@
android:title="@string/voice_input"
android:defaultValue="true"
android:persistent="true" />
<CheckBoxPreference
android:key="pref_show_paste_key"
android:title="@string/show_paste_key"
android:defaultValue="false"
android:persistent="true" />
</PreferenceScreen>