From 1c075de0c859098aea669808ebba72e9c21f0764 Mon Sep 17 00:00:00 2001 From: Helium314 Date: Sun, 7 Apr 2024 10:03:08 +0200 Subject: [PATCH] make long press symbols key -> numpad optional, fixes #588 --- README.md | 5 ++--- .../java/helium314/keyboard/keyboard/PointerTracker.java | 2 +- .../java/helium314/keyboard/latin/settings/Settings.java | 1 + .../keyboard/latin/settings/SettingsValues.java | 9 +++++---- app/src/main/res/values/strings.xml | 5 ++++- app/src/main/res/xml/prefs_screen_advanced.xml | 6 ++++++ 6 files changed, 19 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index ae1da0fe..e6b77906 100644 --- a/README.md +++ b/README.md @@ -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; * 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. -* Sliding key input: Swipe from shift to another key to type a single uppercase key - * This also works for the `?123` key to type a single symbol from the symbols keyboard, and for related keys. -* Long-press the `?123` from main view to directly open numpad. +* 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. +* 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 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. * Long-press an entry in the clipboard history to pin it (keep it in clipboard until you unpin). diff --git a/app/src/main/java/helium314/keyboard/keyboard/PointerTracker.java b/app/src/main/java/helium314/keyboard/keyboard/PointerTracker.java index dfa19f48..dbde2efb 100644 --- a/app/src/main/java/helium314/keyboard/keyboard/PointerTracker.java +++ b/app/src/main/java/helium314/keyboard/keyboard/PointerTracker.java @@ -1107,7 +1107,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element, 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); return; } diff --git a/app/src/main/java/helium314/keyboard/latin/settings/Settings.java b/app/src/main/java/helium314/keyboard/latin/settings/Settings.java index 98f67ceb..4565001f 100644 --- a/app/src/main/java/helium314/keyboard/latin/settings/Settings.java +++ b/app/src/main/java/helium314/keyboard/latin/settings/Settings.java @@ -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_SHOW_SETUP_WIZARD_ICON = "show_setup_wizard_icon"; 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 public static final String PREF_ONE_HANDED_MODE_PREFIX = "one_handed_mode_enabled_p_"; diff --git a/app/src/main/java/helium314/keyboard/latin/settings/SettingsValues.java b/app/src/main/java/helium314/keyboard/latin/settings/SettingsValues.java index 2549748f..111a67c6 100644 --- a/app/src/main/java/helium314/keyboard/latin/settings/SettingsValues.java +++ b/app/src/main/java/helium314/keyboard/latin/settings/SettingsValues.java @@ -54,7 +54,7 @@ public class SettingsValues { public final Locale mLocale; public final boolean mHasHardwareKeyboard; public final int mDisplayOrientation; - // From preferences, in the same order as xml/prefs.xml: + // From preferences public final boolean mAutoCap; public final boolean mVibrateOn; public final boolean mSoundOn; @@ -86,8 +86,7 @@ public class SettingsValues { public final List mPopupKeyTypes; public final List mPopupKeyLabelSources; public final List mSecondaryLocales; - // Use bigrams to predict the next word when there is no input for it yet - public final boolean mBigramPredictionEnabled; + public final boolean mBigramPredictionEnabled;// Use bigrams to predict the next word when there is no input for it yet public final boolean mGestureInputEnabled; public final boolean mGestureTrailEnabled; public final boolean mGestureFloatingPreviewTextEnabled; @@ -119,12 +118,13 @@ public class SettingsValues { private final boolean mOverrideShowingSuggestions; public final SettingsValuesForSuggestion mSettingsValuesForSuggestion; public final boolean mIncognitoModeEnabled; + public final boolean mLongPressSymbolsForNumpad; // User-defined colors public final Colors mColors; @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 public SettingsValues(final Context context, final SharedPreferences prefs, final Resources res, @@ -232,6 +232,7 @@ public class SettingsValues { ); mSpacingAndPunctuations = new SpacingAndPunctuations(res, mUrlDetectionEnabled); 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() { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3d510df6..6103af71 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -248,10 +248,12 @@ Show functional hints Show hints if long-pressing a key triggers additional functionality - + Change input method with space key Long pressing space key will prompt input method selection menu + + Long press symbols key for numpad Narrow key gaps @@ -269,6 +271,7 @@ Spanish (US) Hinglish + Kaitag diff --git a/app/src/main/res/xml/prefs_screen_advanced.xml b/app/src/main/res/xml/prefs_screen_advanced.xml index 7c12641b..2f34d7fc 100644 --- a/app/src/main/res/xml/prefs_screen_advanced.xml +++ b/app/src/main/res/xml/prefs_screen_advanced.xml @@ -54,6 +54,12 @@ android:persistent="true" android:defaultValue="true" /> + +