@@ -11,6 +11,7 @@ import org.fcitx.fcitx5.android.core.FcitxKeyMapping
11
11
import org.fcitx.fcitx5.android.core.KeySym
12
12
import org.fcitx.fcitx5.android.data.prefs.AppPrefs
13
13
import org.fcitx.fcitx5.android.data.theme.Theme
14
+ import org.fcitx.fcitx5.android.data.theme.ThemeManager
14
15
import org.fcitx.fcitx5.android.input.AutoScaleTextView
15
16
import org.fcitx.fcitx5.android.input.keyboard.CustomGestureView
16
17
import org.fcitx.fcitx5.android.input.keyboard.CustomGestureView.OnGestureListener
@@ -28,6 +29,7 @@ import org.fcitx.fcitx5.android.input.keyboard.KeyView
28
29
import org.fcitx.fcitx5.android.input.keyboard.TextKeyView
29
30
import org.fcitx.fcitx5.android.input.popup.PopupAction
30
31
import org.fcitx.fcitx5.android.input.popup.PopupActionListener
32
+ import splitties.views.backgroundColor
31
33
import splitties.views.dsl.constraintlayout.below
32
34
import splitties.views.dsl.constraintlayout.bottomOfParent
33
35
import splitties.views.dsl.constraintlayout.bottomToTopOf
@@ -43,7 +45,15 @@ import splitties.views.dsl.core.Ui
43
45
import splitties.views.dsl.core.add
44
46
import splitties.views.dsl.core.matchParent
45
47
46
- class PickerPageUi (override val ctx : Context , val theme : Theme , private val density : Density ) : Ui {
48
+ class PickerPageUi (
49
+ override val ctx : Context ,
50
+ val theme : Theme ,
51
+ private val density : Density ,
52
+ recentlyUsedFileName : String = " "
53
+ ) : Ui {
54
+ private val keyBorder by ThemeManager .prefs.keyBorder
55
+ private val symbolBorder =
56
+ ThemeManager .prefs.keySymbolBorder.getValue() && recentlyUsedFileName == PickerWindow .Key .Symbol .name
47
57
48
58
enum class Density (
49
59
val pageSize : Int ,
@@ -63,26 +73,25 @@ class PickerPageUi(override val ctx: Context, val theme: Theme, private val dens
63
73
}
64
74
65
75
companion object {
66
- val BackspaceAppearance = Appearance .Image (
67
- src = R .drawable.ic_baseline_backspace_24,
68
- variant = Variant .Alternative ,
69
- border = Border .Off ,
70
- viewId = R .id.button_backspace
71
- )
72
-
73
76
val BackspaceAction = SymAction (KeySym (FcitxKeyMapping .FcitxKey_BackSpace ))
74
-
75
77
private var popupOnKeyPress by AppPrefs .getInstance().keyboard.popupOnKeyPress
76
78
}
77
79
78
80
var keyActionListener: KeyActionListener ? = null
79
81
var popupActionListener: PopupActionListener ? = null
80
82
83
+ private val backspaceAppearance = Appearance .Image (
84
+ src = R .drawable.ic_baseline_backspace_24,
85
+ variant = Variant .Alternative ,
86
+ border = if (symbolBorder) Border .On else Border .Off ,
87
+ viewId = R .id.button_backspace
88
+ )
89
+
81
90
private val keyAppearance = Appearance .Text (
82
91
displayText = " " ,
83
92
textSize = density.textSize,
84
93
variant = Variant .Normal ,
85
- border = Border .Off
94
+ border = if (symbolBorder) Border . On else Border .Off
86
95
)
87
96
88
97
private val keyViews = Array (density.pageSize) {
@@ -96,7 +105,7 @@ class PickerPageUi(override val ctx: Context, val theme: Theme, private val dens
96
105
}
97
106
}
98
107
99
- private val backspaceKey = ImageKeyView (ctx, theme, BackspaceAppearance ).apply {
108
+ private val backspaceKey = ImageKeyView (ctx, theme, backspaceAppearance ).apply {
100
109
setOnClickListener { onBackspaceClick() }
101
110
repeatEnabled = true
102
111
onRepeatListener = { onBackspaceClick() }
@@ -107,6 +116,10 @@ class PickerPageUi(override val ctx: Context, val theme: Theme, private val dens
107
116
}
108
117
109
118
override val root = constraintLayout {
119
+ if (! keyBorder && symbolBorder) {
120
+ backgroundColor = theme.barColor
121
+ }
122
+
110
123
val columnCount = density.columnCount
111
124
val rowCount = density.rowCount
112
125
val keyWidth = 1f / columnCount
0 commit comments