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