mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-20 06:09:09 +00:00
add setting to remove redundant popup keys
This commit is contained in:
parent
544132974c
commit
c0c11d75b2
8 changed files with 19 additions and 7 deletions
|
@ -1,6 +1,5 @@
|
|||
[popup_keys]
|
||||
a ä
|
||||
e
|
||||
o ö
|
||||
u ü
|
||||
s ß
|
||||
|
|
|
@ -355,6 +355,8 @@ public class Key implements Comparable<Key> {
|
|||
@NonNull
|
||||
public static Key removeRedundantPopupKeys(@NonNull final Key key,
|
||||
@NonNull final PopupKeySpec.LettersOnBaseLayout lettersOnBaseLayout) {
|
||||
if ((key.mPopupKeysColumnAndFlags & POPUP_KEYS_FLAGS_FIXED_COLUMN) != 0)
|
||||
return key; // don't remove anything for fixed column popup keys
|
||||
final PopupKeySpec[] popupKeys = key.getPopupKeys();
|
||||
final PopupKeySpec[] filteredPopupKeys = PopupKeySpec.removeRedundantPopupKeys(
|
||||
popupKeys, lettersOnBaseLayout);
|
||||
|
|
|
@ -65,14 +65,11 @@ open class KeyboardBuilder<KP : KeyboardParams>(protected val mContext: Context,
|
|||
}
|
||||
|
||||
private fun setupParams() {
|
||||
// previously was false for nordic and serbian_qwertz, true for all others
|
||||
// todo: add setting? maybe users want it in a custom layout
|
||||
mParams.mAllowRedundantPopupKeys = mParams.mId.mElementId != KeyboardId.ELEMENT_SYMBOLS
|
||||
|
||||
val sv = Settings.getInstance().current
|
||||
mParams.mAllowRedundantPopupKeys = !sv.mRemoveRedundantPopups
|
||||
mParams.mProximityCharsCorrectionEnabled = mParams.mId.mElementId == KeyboardId.ELEMENT_ALPHABET
|
||||
|| (mParams.mId.isAlphabetKeyboard && !mParams.mId.mSubtype.hasExtraValue(Constants.Subtype.ExtraValue.NO_SHIFT_PROXIMITY_CORRECTION))
|
||||
|
||||
val sv = Settings.getInstance().current
|
||||
addLocaleKeyTextsToParams(mContext, mParams, sv.mShowMorePopupKeys)
|
||||
mParams.mPopupKeyTypes.addAll(sv.mPopupKeyTypes)
|
||||
// add label source only if popup key type enabled
|
||||
|
|
|
@ -78,7 +78,7 @@ public final class PreferencesSettingsFragment extends SubScreenFragment {
|
|||
switch (key) {
|
||||
case Settings.PREF_POPUP_KEYS_ORDER, Settings.PREF_SHOW_POPUP_HINTS, Settings.PREF_SHOW_NUMBER_ROW,
|
||||
Settings.PREF_POPUP_KEYS_LABELS_ORDER, Settings.PREF_LANGUAGE_SWITCH_KEY,
|
||||
Settings.PREF_SHOW_LANGUAGE_SWITCH_KEY -> mReloadKeyboard = true;
|
||||
Settings.PREF_SHOW_LANGUAGE_SWITCH_KEY , Settings.PREF_REMOVE_REDUNDANT_POPUPS-> mReloadKeyboard = true;
|
||||
case Settings.PREF_LOCALIZED_NUMBER_ROW -> KeyboardLayoutSet.onSystemLocaleChanged();
|
||||
case Settings.PREF_SHOW_HINTS
|
||||
-> findPreference(Settings.PREF_POPUP_KEYS_LABELS_ORDER).setVisible(prefs.getBoolean(Settings.PREF_SHOW_HINTS, false));
|
||||
|
|
|
@ -159,6 +159,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
|||
public static final String PREF_ABC_AFTER_EMOJI = "abc_after_emoji";
|
||||
public static final String PREF_ABC_AFTER_CLIP = "abc_after_clip";
|
||||
public static final String PREF_ABC_AFTER_SYMBOL_SPACE = "abc_after_symbol_space";
|
||||
public static final String PREF_REMOVE_REDUNDANT_POPUPS = "remove_redundant_popups";
|
||||
|
||||
// Emoji
|
||||
public static final String PREF_EMOJI_RECENT_KEYS = "emoji_recent_keys";
|
||||
|
|
|
@ -114,6 +114,7 @@ public class SettingsValues {
|
|||
public final boolean mAlphaAfterEmojiInEmojiView;
|
||||
public final boolean mAlphaAfterClipHistoryEntry;
|
||||
public final boolean mAlphaAfterSymbolAndSpace;
|
||||
public final boolean mRemoveRedundantPopups;
|
||||
|
||||
// From the input box
|
||||
@NonNull
|
||||
|
@ -258,6 +259,7 @@ public class SettingsValues {
|
|||
mAlphaAfterEmojiInEmojiView = prefs.getBoolean(Settings.PREF_ABC_AFTER_EMOJI, false);
|
||||
mAlphaAfterClipHistoryEntry = prefs.getBoolean(Settings.PREF_ABC_AFTER_CLIP, false);
|
||||
mAlphaAfterSymbolAndSpace = prefs.getBoolean(Settings.PREF_ABC_AFTER_SYMBOL_SPACE, true);
|
||||
mRemoveRedundantPopups = prefs.getBoolean(Settings.PREF_REMOVE_REDUNDANT_POPUPS, true);
|
||||
}
|
||||
|
||||
public boolean isApplicationSpecifiedCompletionsOn() {
|
||||
|
|
|
@ -283,6 +283,10 @@
|
|||
<string name="show_popup_hints">Show functional hints</string>
|
||||
<!-- Description of the show_popup_hints setting -->
|
||||
<string name="show_popup_hints_summary">Show hints if long-pressing a key triggers additional functionality</string>
|
||||
<!-- Option to remove popup keys that already exist on the base keyboard -->
|
||||
<string name="remove_redundant_popups">Remove redundant popups</string>
|
||||
<!-- Description of the remove_redundant_popups setting -->
|
||||
<string name="remove_redundant_popups_summary">Suppress popup keys that are present on the base layout</string>
|
||||
<!-- Title of the setting enabling long press on space key to change IME -->
|
||||
<string name="prefs_long_press_keyboard_to_change_lang">Change input method with space key</string>
|
||||
<!-- Description of the settings to change IME indicating long press triggers change. -->
|
||||
|
|
|
@ -101,6 +101,13 @@
|
|||
android:defaultValue="false"
|
||||
android:persistent="true" />
|
||||
|
||||
<SwitchPreference
|
||||
android:key="remove_redundant_popups"
|
||||
android:title="@string/remove_redundant_popups"
|
||||
android:summary="@string/remove_redundant_popups_summary"
|
||||
android:defaultValue="true"
|
||||
android:persistent="true" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory android:title="@string/settings_category_clipboard_history">
|
||||
|
|
Loading…
Add table
Reference in a new issue