long-press symbols key for numpad

issue: immediately switches to symbols layout, after delay switches to numpad
This commit is contained in:
Helium314 2024-02-01 09:25:37 +01:00
parent 21254d895c
commit eb7333b1da
5 changed files with 18 additions and 9 deletions

View file

@ -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. * 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).
* 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) * 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: * 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. * This only works with _content-uris_ and not with _file-uris_, meaning that it may not work with some file explorers.

View file

@ -1159,7 +1159,10 @@ public class Key implements Comparable<Key> {
} }
// action flags don't need to be specified, they can be deduced from the key // 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; actionFlags |= ACTION_FLAGS_ENABLE_LONG_PRESS;
if (mCode <= Constants.CODE_SPACE && mCode != CODE_OUTPUT_TEXT) if (mCode <= Constants.CODE_SPACE && mCode != CODE_OUTPUT_TEXT)
actionFlags |= ACTION_FLAGS_NO_KEY_PREVIEW; actionFlags |= ACTION_FLAGS_NO_KEY_PREVIEW;

View file

@ -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 // Note that we need primaryCode argument because the keyboard may be in shifted state and the
// primaryCode is different from {@link Key#mKeyCode}. // primaryCode is different from {@link Key#mKeyCode}.
private void callListenerOnRelease(final Key key, final int primaryCode, private void callListenerOnRelease(final Key key, final int primaryCode, final boolean withSliding) {
final boolean withSliding) {
// See the comment at {@link #callListenerOnPressAndCheckKeyboardLayoutChange(Key}}. // See the comment at {@link #callListenerOnPressAndCheckKeyboardLayoutChange(Key}}.
if (sInGesture || mIsDetectingGesture || mIsTrackingForActionDisabled) { if (sInGesture || mIsDetectingGesture || mIsTrackingForActionDisabled) {
return; return;
@ -1104,7 +1103,9 @@ public final class PointerTracker implements PointerTrackerQueue.Element,
return; return;
} }
final int code = key.getCode(); 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. // Long pressing the space key invokes IME switcher dialog.
if (sListener.onCustomRequest(Constants.CUSTOM_CODE_SHOW_INPUT_METHOD_PICKER)) { if (sListener.onCustomRequest(Constants.CUSTOM_CODE_SHOW_INPUT_METHOD_PICKER)) {
cancelKeyTracking(); cancelKeyTracking();
@ -1112,8 +1113,12 @@ public final class PointerTracker implements PointerTrackerQueue.Element,
return; 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); final MoreKeysPanel moreKeysPanel = sDrawingProxy.showMoreKeysKeyboard(key, this);
if (moreKeysPanel == null) { if (moreKeysPanel == null) {
return; return;
@ -1159,8 +1164,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element,
return true; return true;
} }
// Here curKey points to the different key from newKey. // Here curKey points to the different key from newKey.
final int keyHysteresisDistanceSquared = mKeyDetector.getKeyHysteresisDistanceSquared( final int keyHysteresisDistanceSquared = mKeyDetector.getKeyHysteresisDistanceSquared(mIsInSlidingKeyInput);
mIsInSlidingKeyInput);
final int distanceFromKeyEdgeSquared = curKey.squaredDistanceToEdge(x, y); final int distanceFromKeyEdgeSquared = curKey.squaredDistanceToEdge(x, y);
if (distanceFromKeyEdgeSquared >= keyHysteresisDistanceSquared) { if (distanceFromKeyEdgeSquared >= keyHysteresisDistanceSquared) {
if (DEBUG_MODE) { if (DEBUG_MODE) {

View file

@ -18,7 +18,7 @@
<string name="enable_split_keyboard" msgid="4177264923999493614">"Enable split keyboard"</string> <string name="enable_split_keyboard" msgid="4177264923999493614">"Enable split keyboard"</string>
<string name="language_switch_key_switch_input_method" msgid="4533689960308565519">"Switch to other input methods"</string> <string name="language_switch_key_switch_input_method" msgid="4533689960308565519">"Switch to other input methods"</string>
<string name="show_language_switch_key" msgid="5915478828318774384">"Language switch key"</string> <string name="show_language_switch_key" msgid="5915478828318774384">"Language switch key"</string>
<string name="abbreviation_unit_milliseconds" msgid="8700286094028323363">"<xliff:g id="MILLISECONDS">%s</xliff:g>ms"</string> <string name="abbreviation_unit_milliseconds" msgid="8700286094028323363">"<xliff:g id="MILLISECONDS">%s</xliff:g> ms"</string>
<string name="settings_system_default" msgid="6268225104743331821">"System default"</string> <string name="settings_system_default" msgid="6268225104743331821">"System default"</string>
<string name="use_contacts_dict" msgid="4435317977804180815">"Suggest Contact names"</string> <string name="use_contacts_dict" msgid="4435317977804180815">"Suggest Contact names"</string>
<string name="use_contacts_dict_summary">"Use names from Contacts for suggestions and corrections"</string> <string name="use_contacts_dict_summary">"Use names from Contacts for suggestions and corrections"</string>
@ -150,7 +150,7 @@
<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>
<string name="settings_no_limit">No limit</string> <string name="settings_no_limit">No limit</string>
<string name="settings_category_clipboard_history">Clipboard history</string> <string name="settings_category_clipboard_history">Clipboard history</string>
<string name="abbreviation_unit_minutes"><xliff:g id="MINUTES">%s</xliff:g>min.</string> <string name="abbreviation_unit_minutes"><xliff:g id="MINUTES">%s</xliff:g> min</string>
<string name="enable_clipboard_history">Enable clipboard history</string> <string name="enable_clipboard_history">Enable clipboard history</string>
<string name="enable_clipboard_history_summary">If disabled, clipboard key will paste clipboard content if any</string> <string name="enable_clipboard_history_summary">If disabled, clipboard key will paste clipboard content if any</string>
<string name="clipboard_history_retention_time">History retention time</string> <string name="clipboard_history_retention_time">History retention time</string>

View file

@ -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. 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. 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 ## Simple format
* One key per line * One key per line