diff --git a/README.md b/README.md index 18fe255d..143fc899 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,7 @@ Features that may go unnoticed, and further potentially useful information * 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). +* Long-press the `?123` from main view to directly open numpad. * Swipe left in clipboard view to remove an entry (except when it's pinned) * You can add dictionaries by opening them in a file explorer: * This only works with _content-uris_ and not with _file-uris_, meaning that it may not work with some file explorers. diff --git a/app/src/main/java/helium314/keyboard/keyboard/Key.java b/app/src/main/java/helium314/keyboard/keyboard/Key.java index 38d13bd9..bfced402 100644 --- a/app/src/main/java/helium314/keyboard/keyboard/Key.java +++ b/app/src/main/java/helium314/keyboard/keyboard/Key.java @@ -1159,7 +1159,10 @@ public class Key implements Comparable { } // action flags don't need to be specified, they can be deduced from the key - if (backgroundType == BACKGROUND_TYPE_SPACEBAR || mCode == Constants.CODE_LANGUAGE_SWITCH) + if (backgroundType == BACKGROUND_TYPE_SPACEBAR + || mCode == Constants.CODE_LANGUAGE_SWITCH + || (mCode == CODE_SWITCH_ALPHA_SYMBOL && !params.mId.isAlphabetKeyboard()) + ) actionFlags |= ACTION_FLAGS_ENABLE_LONG_PRESS; if (mCode <= Constants.CODE_SPACE && mCode != CODE_OUTPUT_TEXT) actionFlags |= ACTION_FLAGS_NO_KEY_PREVIEW; diff --git a/app/src/main/java/helium314/keyboard/keyboard/PointerTracker.java b/app/src/main/java/helium314/keyboard/keyboard/PointerTracker.java index 07f57ee2..b9028cdf 100644 --- a/app/src/main/java/helium314/keyboard/keyboard/PointerTracker.java +++ b/app/src/main/java/helium314/keyboard/keyboard/PointerTracker.java @@ -310,8 +310,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element, // Note that we need primaryCode argument because the keyboard may be in shifted state and the // primaryCode is different from {@link Key#mKeyCode}. - private void callListenerOnRelease(final Key key, final int primaryCode, - final boolean withSliding) { + private void callListenerOnRelease(final Key key, final int primaryCode, final boolean withSliding) { // See the comment at {@link #callListenerOnPressAndCheckKeyboardLayoutChange(Key}}. if (sInGesture || mIsDetectingGesture || mIsTrackingForActionDisabled) { return; @@ -1104,7 +1103,9 @@ public final class PointerTracker implements PointerTrackerQueue.Element, return; } final int code = key.getCode(); - if (code == Constants.CODE_SPACE&&Settings.getInstance().getCurrent().mSpaceForLangChange || code == Constants.CODE_LANGUAGE_SWITCH) { + if (code == Constants.CODE_LANGUAGE_SWITCH + || (code == Constants.CODE_SPACE && Settings.getInstance().getCurrent().mSpaceForLangChange) + ) { // Long pressing the space key invokes IME switcher dialog. if (sListener.onCustomRequest(Constants.CUSTOM_CODE_SHOW_INPUT_METHOD_PICKER)) { cancelKeyTracking(); @@ -1112,8 +1113,12 @@ public final class PointerTracker implements PointerTrackerQueue.Element, return; } } + if (code == Constants.CODE_SWITCH_ALPHA_SYMBOL) { + sListener.onCodeInput(Constants.CODE_NUMPAD, Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE, false); + return; + } - setReleasedKeyGraphics(key, false /* withAnimation */); + setReleasedKeyGraphics(key, false); final MoreKeysPanel moreKeysPanel = sDrawingProxy.showMoreKeysKeyboard(key, this); if (moreKeysPanel == null) { return; @@ -1159,8 +1164,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element, return true; } // Here curKey points to the different key from newKey. - final int keyHysteresisDistanceSquared = mKeyDetector.getKeyHysteresisDistanceSquared( - mIsInSlidingKeyInput); + final int keyHysteresisDistanceSquared = mKeyDetector.getKeyHysteresisDistanceSquared(mIsInSlidingKeyInput); final int distanceFromKeyEdgeSquared = curKey.squaredDistanceToEdge(x, y); if (distanceFromKeyEdgeSquared >= keyHysteresisDistanceSquared) { if (DEBUG_MODE) { diff --git a/app/src/main/res/values-en-rGB/strings.xml b/app/src/main/res/values-en-rGB/strings.xml index 10447a09..398145b7 100644 --- a/app/src/main/res/values-en-rGB/strings.xml +++ b/app/src/main/res/values-en-rGB/strings.xml @@ -18,7 +18,7 @@ "Enable split keyboard" "Switch to other input methods" "Language switch key" - "%sms" + "%s ms" "System default" "Suggest Contact names" "Use names from Contacts for suggestions and corrections" @@ -150,7 +150,7 @@ Long pressing space key will prompt input method selection menu No limit Clipboard history - %smin. + %s min Enable clipboard history If disabled, clipboard key will paste clipboard content if any History retention time diff --git a/layouts.md b/layouts.md index a894c6be..cc9e4c36 100644 --- a/layouts.md +++ b/layouts.md @@ -13,6 +13,7 @@ If you use an external glide typing library, you likely will have issues if your There are special key labels that are intended for internal use only, but can (currently) be set on custom layouts too. An example is `!icon/previous_key|!code/key_action_previous`, so it's unlikely you will stumble upon issues here when not intentionally provoking it. One special label that might be wanted though is `$$$`, which will be replaced by the local currency. `$$$1` - `$$$4` will be replaced by currencies available on long-pressing the currency key. +If you want different key label and use text, set the label to [label]|[text], e.g. `aa|bb` will show `aa`, but pressing the key will input `bb`. ## Simple format * One key per line