Progress
This commit is contained in:
parent
877daf15eb
commit
bf94132c1c
@ -19,7 +19,12 @@ class WordInputMode: InputMode {
|
||||
override fun onKeyDown(key: Key): KeyEventResult {
|
||||
keyStats(key)
|
||||
|
||||
val command = keyCommandResolver.getCommand(key)
|
||||
|
||||
Log.d(tag, "Command: $command")
|
||||
|
||||
return when(keyCommandResolver.getCommand(key)) {
|
||||
Command.BACK -> KeyEventResult(false)
|
||||
Command.CHARACTER -> buildCodeWord(key)
|
||||
// Command.SELECT -> true
|
||||
Command.DELETE -> deleteCharacter()
|
||||
@ -34,6 +39,12 @@ class WordInputMode: InputMode {
|
||||
override fun onKeyLongDown(key: Key): KeyEventResult {
|
||||
// Log.d(tag, "onKeyLongDown")
|
||||
|
||||
val command = keyCommandResolver.getCommand(key = key, longPress = true)
|
||||
|
||||
|
||||
|
||||
Log.d(tag, "Command: $command")
|
||||
|
||||
return KeyEventResult()
|
||||
}
|
||||
|
||||
@ -47,7 +58,18 @@ class WordInputMode: InputMode {
|
||||
override fun afterKeyDown(key: Key): KeyEventResult {
|
||||
// Log.d(tag, "afterKeyDown")
|
||||
|
||||
return KeyEventResult()
|
||||
// return when(keyCommandResolver.getCommand(key, after = true)) {
|
||||
// Command.DELETE -> deleteCharacter(repeat)
|
||||
// else -> KeyEventResult()
|
||||
// }
|
||||
|
||||
val command = keyCommandResolver.getCommand(key, after = true)
|
||||
|
||||
|
||||
|
||||
Log.d(tag, "Command: $command")
|
||||
|
||||
return KeyEventResult(false)
|
||||
}
|
||||
|
||||
override fun afterKeyLongDown(key: Key, keyDownMS: Long): KeyEventResult {
|
||||
|
@ -14,5 +14,7 @@ enum class Command {
|
||||
RIGHT,
|
||||
LEFT,
|
||||
RECORD,
|
||||
TRANSCRIBE
|
||||
TRANSCRIBE,
|
||||
BACK,
|
||||
HOME
|
||||
}
|
@ -18,5 +18,6 @@ enum class Key(val code: Char) {
|
||||
LEFT('c'),
|
||||
RIGHT('d'),
|
||||
SELECT('e'),
|
||||
DELETE('f')
|
||||
DELETE('f'),
|
||||
BACK('g'),
|
||||
}
|
@ -12,6 +12,7 @@ class KeyCodeMapping(
|
||||
|
||||
companion object {
|
||||
val basic = mapOf(
|
||||
4 to Key.BACK,
|
||||
7 to Key.N0,
|
||||
8 to Key.N1,
|
||||
9 to Key.N2,
|
||||
|
@ -27,6 +27,7 @@ class KeyCommandResolver (
|
||||
fun getBasic(): KeyCommandResolver {
|
||||
return KeyCommandResolver(
|
||||
onShort = HashMap(mapOf(
|
||||
Key.BACK to Command.BACK,
|
||||
Key.N0 to Command.SPACE,
|
||||
|
||||
Key.N1 to Command.CHARACTER,
|
||||
@ -50,6 +51,8 @@ class KeyCommandResolver (
|
||||
)),
|
||||
|
||||
onLong = HashMap(mapOf(
|
||||
Key.BACK to Command.HOME,
|
||||
|
||||
Key.N0 to Command.NUMBER,
|
||||
Key.N1 to Command.NUMBER,
|
||||
Key.N2 to Command.NUMBER,
|
||||
@ -66,6 +69,7 @@ class KeyCommandResolver (
|
||||
)),
|
||||
|
||||
afterShort = HashMap(mapOf(
|
||||
Key.BACK to Command.BACK,
|
||||
Key.POUND to Command.SHIFT_MODE,
|
||||
)),
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user