Compare commits
2 Commits
43df87f5ef
...
c89d4f0204
Author | SHA1 | Date | |
---|---|---|---|
c89d4f0204 | |||
e9c1fe030e |
@ -40,6 +40,14 @@ open class BaseInputMode: InputMode {
|
||||
return KeyEventResult()
|
||||
}
|
||||
|
||||
protected fun commit(text: String, composing: Boolean): KeyEventResult {
|
||||
return KeyEventResult(
|
||||
consumed = true,
|
||||
finishComposing = composing,
|
||||
commit = text
|
||||
)
|
||||
}
|
||||
|
||||
protected open fun commitNumber(key: Key, composing: Boolean): KeyEventResult {
|
||||
val number = KeyLayout.numeric[key] ?: return KeyEventResult(true)
|
||||
|
||||
|
@ -12,6 +12,7 @@ class FNInputMode: BaseInputMode() {
|
||||
parent = super.keyCommandResolver,
|
||||
|
||||
onShort = HashMap(mapOf(
|
||||
Key.N0 to Command.NEWLINE,
|
||||
Key.UP to Command.VOL_UP,
|
||||
Key.DOWN to Command.VOL_DOWN,
|
||||
Key.LEFT to Command.BRIGHTNESS_DOWN,
|
||||
@ -19,6 +20,7 @@ class FNInputMode: BaseInputMode() {
|
||||
)),
|
||||
|
||||
onRepeat = HashMap(mapOf(
|
||||
Key.N0 to Command.NEWLINE,
|
||||
Key.UP to Command.VOL_UP,
|
||||
Key.DOWN to Command.VOL_DOWN,
|
||||
Key.LEFT to Command.BRIGHTNESS_DOWN,
|
||||
@ -38,10 +40,11 @@ class FNInputMode: BaseInputMode() {
|
||||
override fun onKeyDown(key: Key, composing: Boolean): KeyEventResult {
|
||||
return when(keyCommandResolver.getCommand(key)) {
|
||||
Command.BACK -> KeyEventResult(false)
|
||||
Command.VOL_UP -> volumeUp()
|
||||
Command.VOL_DOWN -> volumeDown()
|
||||
Command.BRIGHTNESS_DOWN -> brightnessDown()
|
||||
Command.BRIGHTNESS_UP -> brightnessUp()
|
||||
Command.NEWLINE -> commit("\n", composing)
|
||||
Command.VOL_UP -> volumeUp()
|
||||
Command.VOL_DOWN -> volumeDown()
|
||||
else -> KeyEventResult(true)
|
||||
}
|
||||
}
|
||||
@ -53,10 +56,11 @@ class FNInputMode: BaseInputMode() {
|
||||
override fun onKeyDownRepeatedly(key: Key, repeat: Int, composing: Boolean): KeyEventResult {
|
||||
return when(keyCommandResolver.getCommand(key, repeat = repeat)) {
|
||||
Command.HOME -> goHome(repeat, composing)
|
||||
Command.VOL_UP -> volumeUp()
|
||||
Command.VOL_DOWN -> volumeDown()
|
||||
Command.BRIGHTNESS_DOWN -> brightnessDown()
|
||||
Command.BRIGHTNESS_UP -> brightnessUp()
|
||||
Command.NEWLINE -> commit("\n", composing)
|
||||
Command.VOL_UP -> volumeUp()
|
||||
Command.VOL_DOWN -> volumeDown()
|
||||
else -> KeyEventResult(true)
|
||||
}
|
||||
}
|
||||
|
@ -66,6 +66,12 @@ class WordInputMode: BaseInputMode() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun commitNumber(key: Key, composing: Boolean): KeyEventResult {
|
||||
codeWord.clear()
|
||||
|
||||
return super.commitNumber(key, composing)
|
||||
}
|
||||
|
||||
override fun deleteCharacter(composing: Boolean): KeyEventResult {
|
||||
codeWord.clear()
|
||||
|
||||
@ -115,12 +121,6 @@ class WordInputMode: BaseInputMode() {
|
||||
)
|
||||
}
|
||||
|
||||
override fun commitNumber(key: Key, composing: Boolean): KeyEventResult {
|
||||
codeWord.clear()
|
||||
|
||||
return super.commitNumber(key, composing)
|
||||
}
|
||||
|
||||
private fun reset() {
|
||||
codeWord.clear()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user