mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-16 04:12:02 +00:00
add tab key
This commit is contained in:
parent
7d1627ffc6
commit
6c2a3e8b5f
5 changed files with 9 additions and 2 deletions
|
@ -138,6 +138,7 @@ object KeyCode {
|
|||
const val PAGE_DOWN = -10011
|
||||
const val META = -10012
|
||||
const val META_LOCK = -10013 // to be consistent with the CTRL/ALT(/FN LOCK codes, not sure whether this will be used
|
||||
const val TAB = -10014
|
||||
|
||||
/** to make sure a FlorisBoard code works when reading a JSON layout */
|
||||
fun Int.checkAndConvertCode(): Int = if (this > 0) this else when (this) {
|
||||
|
@ -150,7 +151,7 @@ object KeyCode {
|
|||
|
||||
// heliboard only
|
||||
SYMBOL_ALPHA, START_ONE_HANDED_MODE, STOP_ONE_HANDED_MODE, SWITCH_ONE_HANDED_MODE, SHIFT_ENTER,
|
||||
ACTION_NEXT, ACTION_PREVIOUS, NOT_SPECIFIED, CLIPBOARD_COPY_ALL, PAGE_UP, PAGE_DOWN, META
|
||||
ACTION_NEXT, ACTION_PREVIOUS, NOT_SPECIFIED, CLIPBOARD_COPY_ALL, PAGE_UP, PAGE_DOWN, META, TAB
|
||||
-> this
|
||||
|
||||
// conversion
|
||||
|
|
|
@ -28,6 +28,7 @@ object KeyLabel {
|
|||
const val ALT = "alt"
|
||||
const val FN = "fn"
|
||||
const val META = "meta"
|
||||
const val TAB = "tab"
|
||||
|
||||
/** to make sure a FlorisBoard label works when reading a JSON layout */
|
||||
// resulting special labels should be names of FunctionalKey enum, case insensitive
|
||||
|
|
|
@ -451,6 +451,7 @@ sealed interface KeyData : AbstractKeyData {
|
|||
KeyLabel.CURRENCY4 -> params.mLocaleKeyboardInfos.currencyKey.second[3]
|
||||
KeyLabel.CURRENCY5 -> params.mLocaleKeyboardInfos.currencyKey.second[4]
|
||||
KeyLabel.CTRL, KeyLabel.ALT, KeyLabel.FN, KeyLabel.META -> label.uppercase(Locale.US)
|
||||
KeyLabel.TAB -> "!icon/tab_key|"
|
||||
else -> {
|
||||
if (label in toolbarKeyStrings) {
|
||||
"!icon/$label|"
|
||||
|
@ -468,6 +469,7 @@ sealed interface KeyData : AbstractKeyData {
|
|||
KeyLabel.ALT -> KeyCode.ALT
|
||||
KeyLabel.FN -> KeyCode.FN
|
||||
KeyLabel.META -> KeyCode.META
|
||||
KeyLabel.TAB -> KeyCode.TAB
|
||||
else -> {
|
||||
if (label in toolbarKeyStrings) {
|
||||
getCodeForToolbarKey(ToolbarKey.valueOf(label.uppercase(Locale.US)))
|
||||
|
|
|
@ -773,6 +773,9 @@ public final class InputLogic {
|
|||
case KeyCode.PAGE_DOWN:
|
||||
sendDownUpKeyEvent(KeyEvent.KEYCODE_PAGE_DOWN);
|
||||
break;
|
||||
case KeyCode.TAB:
|
||||
sendDownUpKeyEvent(KeyEvent.KEYCODE_TAB);
|
||||
break;
|
||||
case KeyCode.VOICE_INPUT:
|
||||
// switching to shortcut IME, shift state, keyboard,... is handled by LatinIME,
|
||||
// {@link KeyboardSwitcher#onEvent(Event)}, or {@link #onPressKey(int,int,boolean)} and {@link #onReleaseKey(int,boolean)}.
|
||||
|
|
|
@ -90,7 +90,7 @@ Usually the label is what is displayed on the key. However, there are some speci
|
|||
* _space_: space key, with icon when using a number layout
|
||||
* _zwnj_: Zero-width non-joiner (automatically added next to space in alphabet layout for some languages)
|
||||
* You can also use [toolbar keys](/app/src/main/java/helium314/keyboard/latin/utils/ToolbarUtils.kt#L109), e.g. _undo_.
|
||||
* See [KeyLabel.kt](app/src/main/java/helium314/keyboard/keyboard/internal/keyboard_parser/floris/KeyLabel.kt) for more available labels
|
||||
* See [KeyLabel.kt](app/src/main/java/helium314/keyboard/keyboard/internal/keyboard_parser/floris/KeyLabel.kt) for more available labels that are parsed to the corresponding key.
|
||||
* In case a label clashes with text you want to add, put a `\` in front of the text you want, e.g. `\space` will write the label `space` instead of adding a space bar.
|
||||
* Note that you need to escape the `\` in json files by adding a second `\`.
|
||||
* If you want different key label and input text, set the label to [label]|[text], e.g. `aa|bb` will show `aa`, but pressing the key will input `bb`.
|
||||
|
|
Loading…
Add table
Reference in a new issue