@@ -8,7 +8,7 @@ import com.osfans.trime.data.theme.ColorManager
8
8
import com.osfans.trime.data.theme.EventManager
9
9
import com.osfans.trime.data.theme.FontManager
10
10
import com.osfans.trime.data.theme.Theme
11
- import com.osfans.trime.ime.text.TextInputManager
11
+ import com.osfans.trime.ime.core.TrimeInputMethodService
12
12
import splitties.dimensions.dp
13
13
import splitties.views.backgroundColor
14
14
import splitties.views.dsl.constraintlayout.above
@@ -34,7 +34,7 @@ import splitties.views.gravityCenter
34
34
import splitties.views.padding
35
35
36
36
@SuppressLint(" ViewConstructor" )
37
- class LiquidLayout (context : Context , theme : Theme ) : ConstraintLayout(context) {
37
+ class LiquidLayout (context : Context , service : TrimeInputMethodService , theme : Theme ) : ConstraintLayout(context) {
38
38
// TODO: 继承一个键盘视图嵌入到这里,而不是自定义一个视图
39
39
val operations =
40
40
constraintLayout {
@@ -59,10 +59,15 @@ class LiquidLayout(context: Context, theme: Theme) : ConstraintLayout(context) {
59
59
)
60
60
ColorManager .getColor(" key_back_color" )?.let { bg -> backgroundColor = bg }
61
61
setOnClickListener {
62
- val event = EventManager .getEvent(operation.first)
63
- TextInputManager .getInstance().run {
64
- onPress(event.code)
65
- onEvent(event)
62
+ // TODO: 这个方式不太优雅,还需打磨
63
+ if (operation.first == " liquid_keyboard_exit" ) {
64
+ service.selectLiquidKeyboard(- 1 )
65
+ } else {
66
+ val event = EventManager .getEvent(operation.first)
67
+ service.textInputManager?.run {
68
+ onPress(event.code)
69
+ onEvent(event)
70
+ }
66
71
}
67
72
}
68
73
}
0 commit comments