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