Safe progress
This commit is contained in:
@@ -6,7 +6,6 @@ enum class Command {
|
||||
SPACE,
|
||||
NEWLINE,
|
||||
DELETE,
|
||||
CYCLE_CANDIDATES,
|
||||
SELECT,
|
||||
SHIFT_MODE,
|
||||
SWITCH_MODE,
|
||||
@@ -16,5 +15,6 @@ enum class Command {
|
||||
RECORD,
|
||||
TRANSCRIBE,
|
||||
BACK,
|
||||
HOME
|
||||
HOME,
|
||||
FN
|
||||
}
|
||||
@@ -1,23 +1,24 @@
|
||||
package net.mezimmah.wkt9.keypad
|
||||
|
||||
enum class Key(val code: Char) {
|
||||
N0('0'),
|
||||
N1('1'),
|
||||
N2('2'),
|
||||
N3('3'),
|
||||
N4('4'),
|
||||
N5('5'),
|
||||
N6('6'),
|
||||
N7('7'),
|
||||
N8('8'),
|
||||
N9('9'),
|
||||
STAR('*'),
|
||||
POUND('#'),
|
||||
UP('a'),
|
||||
DOWN('b'),
|
||||
LEFT('c'),
|
||||
RIGHT('d'),
|
||||
SELECT('e'),
|
||||
DELETE('f'),
|
||||
BACK('g'),
|
||||
enum class Key() {
|
||||
N0,
|
||||
N1,
|
||||
N2,
|
||||
N3,
|
||||
N4,
|
||||
N5,
|
||||
N6,
|
||||
N7,
|
||||
N8,
|
||||
N9,
|
||||
FN,
|
||||
STAR,
|
||||
POUND,
|
||||
UP,
|
||||
DOWN,
|
||||
LEFT,
|
||||
RIGHT,
|
||||
SELECT,
|
||||
DELETE,
|
||||
BACK,
|
||||
}
|
||||
@@ -25,7 +25,7 @@ class KeyCodeMapping(
|
||||
16 to Key.N9,
|
||||
17 to Key.STAR,
|
||||
18 to Key.POUND,
|
||||
82 to Key.DELETE,
|
||||
82 to Key.FN,
|
||||
19 to Key.UP,
|
||||
20 to Key.DOWN,
|
||||
21 to Key.LEFT,
|
||||
|
||||
@@ -28,17 +28,6 @@ class KeyCommandResolver (
|
||||
return KeyCommandResolver(
|
||||
onShort = HashMap(mapOf(
|
||||
Key.BACK to Command.BACK,
|
||||
Key.N0 to Command.SPACE,
|
||||
|
||||
Key.N1 to Command.CHARACTER,
|
||||
Key.N2 to Command.CHARACTER,
|
||||
Key.N3 to Command.CHARACTER,
|
||||
Key.N4 to Command.CHARACTER,
|
||||
Key.N5 to Command.CHARACTER,
|
||||
Key.N6 to Command.CHARACTER,
|
||||
Key.N7 to Command.CHARACTER,
|
||||
Key.N8 to Command.CHARACTER,
|
||||
Key.N9 to Command.CHARACTER,
|
||||
|
||||
Key.LEFT to Command.LEFT,
|
||||
Key.RIGHT to Command.RIGHT,
|
||||
@@ -46,7 +35,6 @@ class KeyCommandResolver (
|
||||
Key.DOWN to Command.NAVIGATE,
|
||||
|
||||
Key.STAR to Command.DELETE,
|
||||
Key.DELETE to Command.DELETE,
|
||||
Key.SELECT to Command.SELECT
|
||||
)),
|
||||
|
||||
@@ -67,6 +55,18 @@ class KeyCommandResolver (
|
||||
)),
|
||||
|
||||
afterShort = HashMap(mapOf(
|
||||
Key.N0 to Command.SPACE,
|
||||
|
||||
Key.N1 to Command.CHARACTER,
|
||||
Key.N2 to Command.CHARACTER,
|
||||
Key.N3 to Command.CHARACTER,
|
||||
Key.N4 to Command.CHARACTER,
|
||||
Key.N5 to Command.CHARACTER,
|
||||
Key.N6 to Command.CHARACTER,
|
||||
Key.N7 to Command.CHARACTER,
|
||||
Key.N8 to Command.CHARACTER,
|
||||
Key.N9 to Command.CHARACTER,
|
||||
|
||||
Key.BACK to Command.BACK,
|
||||
Key.POUND to Command.SHIFT_MODE,
|
||||
)),
|
||||
|
||||
@@ -9,6 +9,7 @@ data class KeyEventResult(
|
||||
val startComposing: Boolean = false,
|
||||
val codeWord: StringBuilder? = null,
|
||||
val candidates: List<String>? = null,
|
||||
val commit: String? = null,
|
||||
val timeout: Int? = null,
|
||||
val deleteBeforeCursor: Int = 0,
|
||||
val deleteAfterCursor: Int = 0,
|
||||
|
||||
@@ -3,16 +3,16 @@ package net.mezimmah.wkt9.keypad
|
||||
object KeyLayout {
|
||||
// Map for number input mode
|
||||
val numeric = mapOf(
|
||||
Key.N0 to listOf('0'),
|
||||
Key.N1 to listOf('1'),
|
||||
Key.N2 to listOf('2'),
|
||||
Key.N3 to listOf('3'),
|
||||
Key.N4 to listOf('4'),
|
||||
Key.N5 to listOf('5'),
|
||||
Key.N6 to listOf('6'),
|
||||
Key.N7 to listOf('7'),
|
||||
Key.N8 to listOf('8'),
|
||||
Key.N9 to listOf('9'),
|
||||
Key.N0 to 0,
|
||||
Key.N1 to 1,
|
||||
Key.N2 to 2,
|
||||
Key.N3 to 3,
|
||||
Key.N4 to 4,
|
||||
Key.N5 to 5,
|
||||
Key.N6 to 6,
|
||||
Key.N7 to 7,
|
||||
Key.N8 to 8,
|
||||
Key.N9 to 9,
|
||||
)
|
||||
|
||||
val en_US = mapOf(
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.mezimmah.wkt9.keypad
|
||||
|
||||
import android.util.Log
|
||||
import net.mezimmah.wkt9.exception.MissingLetterCode
|
||||
import java.lang.StringBuilder
|
||||
|
||||
@@ -49,7 +50,8 @@ class Keypad(
|
||||
}
|
||||
|
||||
private fun codeForLetter(letter: Char): Char? {
|
||||
return letterKeyMap[letter]?.code
|
||||
Log.d("wkt9", "Letter key map: letterKeyMap")
|
||||
return ' ' //letterKeyMap[letter]?.code
|
||||
}
|
||||
|
||||
private fun initKeyMaps(layout: Map<Key, List<Char>>): Map<Char, Key> {
|
||||
|
||||
Reference in New Issue
Block a user