make long press symbols key -> numpad optional, fixes #588

This commit is contained in:
Helium314 2024-04-07 10:03:08 +02:00
parent 58e56e5528
commit 1c075de0c8
6 changed files with 19 additions and 9 deletions

View file

@ -72,9 +72,8 @@ Features that may go unnoticed, and further potentially useful information
* Emoji View and Language Switch will disappear if you have the corresponding key enabled; * Emoji View and Language Switch will disappear if you have the corresponding key enabled;
* For some layouts it\'s not the Comma-key, but the key at the same position (e.g. it\'s `q` for Dvorak layout). * For some layouts it\'s not the Comma-key, but the key at the same position (e.g. it\'s `q` for Dvorak layout).
* When incognito mode is enabled, no words will be learned, and no emojis will be added to recents. * When incognito mode is enabled, no words will be learned, and no emojis will be added to recents.
* Sliding key input: Swipe from shift to another key to type a single uppercase key * Sliding key input: Swipe from shift or symbol key to another key. This will enter a single uppercase key or symbol and return to the previous keyboard.
* This also works for the `?123` key to type a single symbol from the symbols keyboard, and for related keys. * Hold shift or symbol key, press one or more keys, and then release shift or symbol key to return to the previous keyboard.
* Long-press the `?123` from main view to directly open numpad.
* Long-press a suggestion in the suggestion strip to show more suggestions, and a delete button to remove this suggestion. * Long-press a suggestion in the suggestion strip to show more suggestions, and a delete button to remove this suggestion.
* Swipe up from a suggestion to open more suggestions, and release on the suggestion to select it. * Swipe up from a suggestion to open more suggestions, and release on the suggestion to select it.
* Long-press an entry in the clipboard history to pin it (keep it in clipboard until you unpin). * Long-press an entry in the clipboard history to pin it (keep it in clipboard until you unpin).

View file

@ -1107,7 +1107,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element,
return; return;
} }
} }
if (code == KeyCode.ALPHA_SYMBOL) { if (code == KeyCode.ALPHA_SYMBOL && Settings.getInstance().getCurrent().mLongPressSymbolsForNumpad) {
sListener.onCodeInput(KeyCode.NUMPAD, Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE, false); sListener.onCodeInput(KeyCode.NUMPAD, Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE, false);
return; return;
} }

View file

@ -116,6 +116,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
public static final String PREF_GESTURE_SPACE_AWARE = "gesture_space_aware"; public static final String PREF_GESTURE_SPACE_AWARE = "gesture_space_aware";
public static final String PREF_SHOW_SETUP_WIZARD_ICON = "show_setup_wizard_icon"; public static final String PREF_SHOW_SETUP_WIZARD_ICON = "show_setup_wizard_icon";
public static final String PREF_USE_CONTACTS = "use_contacts"; public static final String PREF_USE_CONTACTS = "use_contacts";
public static final String PREFS_LONG_PRESS_SYMBOLS_FOR_NUMPAD = "long_press_symbols_for_numpad";
// one-handed mode gravity, enablement and scale, stored separately per orientation // one-handed mode gravity, enablement and scale, stored separately per orientation
public static final String PREF_ONE_HANDED_MODE_PREFIX = "one_handed_mode_enabled_p_"; public static final String PREF_ONE_HANDED_MODE_PREFIX = "one_handed_mode_enabled_p_";

View file

@ -54,7 +54,7 @@ public class SettingsValues {
public final Locale mLocale; public final Locale mLocale;
public final boolean mHasHardwareKeyboard; public final boolean mHasHardwareKeyboard;
public final int mDisplayOrientation; public final int mDisplayOrientation;
// From preferences, in the same order as xml/prefs.xml: // From preferences
public final boolean mAutoCap; public final boolean mAutoCap;
public final boolean mVibrateOn; public final boolean mVibrateOn;
public final boolean mSoundOn; public final boolean mSoundOn;
@ -86,8 +86,7 @@ public class SettingsValues {
public final List<String> mPopupKeyTypes; public final List<String> mPopupKeyTypes;
public final List<String> mPopupKeyLabelSources; public final List<String> mPopupKeyLabelSources;
public final List<Locale> mSecondaryLocales; public final List<Locale> mSecondaryLocales;
// Use bigrams to predict the next word when there is no input for it yet public final boolean mBigramPredictionEnabled;// Use bigrams to predict the next word when there is no input for it yet
public final boolean mBigramPredictionEnabled;
public final boolean mGestureInputEnabled; public final boolean mGestureInputEnabled;
public final boolean mGestureTrailEnabled; public final boolean mGestureTrailEnabled;
public final boolean mGestureFloatingPreviewTextEnabled; public final boolean mGestureFloatingPreviewTextEnabled;
@ -119,12 +118,13 @@ public class SettingsValues {
private final boolean mOverrideShowingSuggestions; private final boolean mOverrideShowingSuggestions;
public final SettingsValuesForSuggestion mSettingsValuesForSuggestion; public final SettingsValuesForSuggestion mSettingsValuesForSuggestion;
public final boolean mIncognitoModeEnabled; public final boolean mIncognitoModeEnabled;
public final boolean mLongPressSymbolsForNumpad;
// User-defined colors // User-defined colors
public final Colors mColors; public final Colors mColors;
@Nullable @Nullable
public final String mAccount; public final String mAccount; // todo: always null, remove?
// creation of Colors and SpacingAndPunctuations are the slowest parts in here, but still ok // creation of Colors and SpacingAndPunctuations are the slowest parts in here, but still ok
public SettingsValues(final Context context, final SharedPreferences prefs, final Resources res, public SettingsValues(final Context context, final SharedPreferences prefs, final Resources res,
@ -232,6 +232,7 @@ public class SettingsValues {
); );
mSpacingAndPunctuations = new SpacingAndPunctuations(res, mUrlDetectionEnabled); mSpacingAndPunctuations = new SpacingAndPunctuations(res, mUrlDetectionEnabled);
mBottomPaddingScale = prefs.getFloat(Settings.PREF_BOTTOM_PADDING_SCALE, DEFAULT_SIZE_SCALE); mBottomPaddingScale = prefs.getFloat(Settings.PREF_BOTTOM_PADDING_SCALE, DEFAULT_SIZE_SCALE);
mLongPressSymbolsForNumpad = prefs.getBoolean(Settings.PREFS_LONG_PRESS_SYMBOLS_FOR_NUMPAD, false);
} }
public boolean isApplicationSpecifiedCompletionsOn() { public boolean isApplicationSpecifiedCompletionsOn() {

View file

@ -248,10 +248,12 @@
<string name="show_popup_hints">Show functional hints</string> <string name="show_popup_hints">Show functional hints</string>
<!-- Description of the show_popup_hints setting --> <!-- Description of the show_popup_hints setting -->
<string name="show_popup_hints_summary">Show hints if long-pressing a key triggers additional functionality</string> <string name="show_popup_hints_summary">Show hints if long-pressing a key triggers additional functionality</string>
<!-- Title of the settings enabling long press on space key to change IME --> <!-- 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> <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. --> <!-- Description of the settings to change IME indicating long press triggers change. -->
<string name="prefs_long_press_keyboard_to_change_lang_summary">Long pressing space key will prompt input method selection menu</string> <string name="prefs_long_press_keyboard_to_change_lang_summary">Long pressing space key will prompt input method selection menu</string>
<!-- Title of the setting enabling long press on symbols key to switch to numpad -->
<string name="prefs_long_press_symbol_for_numpad">Long press symbols key for numpad</string>
<!-- Title of the setting for reduced distance between keys --> <!-- Title of the setting for reduced distance between keys -->
<string name="prefs_narrow_key_gaps">Narrow key gaps</string> <string name="prefs_narrow_key_gaps">Narrow key gaps</string>
<!-- Title of the settings for setting keyboard height --> <!-- Title of the settings for setting keyboard height -->
@ -269,6 +271,7 @@
<string name="subtype_es_US">Spanish (US)</string> <string name="subtype_es_US">Spanish (US)</string>
<!-- Description for Hinglish (https://en.wikipedia.org/wiki/Hinglish) keyboard subtype [CHAR LIMIT=25] --> <!-- Description for Hinglish (https://en.wikipedia.org/wiki/Hinglish) keyboard subtype [CHAR LIMIT=25] -->
<string name="subtype_hi_Latn">Hinglish</string> <string name="subtype_hi_Latn">Hinglish</string>
<!-- Description for Kaitag (https://en.wikipedia.org/wiki/Kaitag_language) keyboard subtype [CHAR LIMIT=25] -->
<string name="subtype_xdq">Kaitag</string> <string name="subtype_xdq">Kaitag</string>
<!-- Description for Serbian (Latin) keyboard subtype [CHAR LIMIT=25] <!-- Description for Serbian (Latin) keyboard subtype [CHAR LIMIT=25]
(Latin) can be an abbreviation to fit in the CHAR LIMIT. --> (Latin) can be an abbreviation to fit in the CHAR LIMIT. -->

View file

@ -54,6 +54,12 @@
android:persistent="true" android:persistent="true"
android:defaultValue="true" /> android:defaultValue="true" />
<SwitchPreference
android:key="long_press_symbols_for_numpad"
android:title="@string/prefs_long_press_symbol_for_numpad"
android:persistent="true"
android:defaultValue="false" />
<SwitchPreference <SwitchPreference
android:key="enable_emoji_alt_physical_key" android:key="enable_emoji_alt_physical_key"
android:title="@string/prefs_enable_emoji_alt_physical_key" android:title="@string/prefs_enable_emoji_alt_physical_key"