Skip to content

Commit 6a25d9f

Browse files
committed
feat: handle onInlineSuggestion() in QuickBar with suggestionUi
1 parent 47aca9f commit 6a25d9f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

app/src/main/java/com/osfans/trime/ime/bar/QuickBar.kt

+19
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,17 @@ class QuickBar(
9797
CandidateUi(context, candidate.compactCandidateModule.view)
9898
}
9999

100+
private val suggestionUi by lazy {
101+
SuggestionUi(context, candidate.suggestionCandidateModule.view).apply {
102+
homeButton.setOnClickListener {
103+
barStateMachine.push(
104+
QuickBarStateMachine.TransitionEvent.SuggestionUpdated,
105+
QuickBarStateMachine.BooleanKey.SuggestionEmpty to true,
106+
)
107+
}
108+
}
109+
}
110+
100111
private val tabUi by lazy {
101112
TabUi(context)
102113
}
@@ -183,6 +194,7 @@ class QuickBar(
183194
add(alwaysUi.root, lParams(matchParent, matchParent))
184195
add(candidateUi.root, lParams(matchParent, matchParent))
185196
add(tabUi.root, lParams(matchParent, matchParent))
197+
add(suggestionUi.root, lParams(matchParent, matchParent))
186198

187199
evalAlwaysUiState()
188200
}
@@ -226,4 +238,11 @@ class QuickBar(
226238
override fun onWindowDetached(window: BoardWindow) {
227239
barStateMachine.push(QuickBarStateMachine.TransitionEvent.WindowDetached)
228240
}
241+
242+
override fun onInlineSuggestion(views: List<View>) {
243+
barStateMachine.push(
244+
QuickBarStateMachine.TransitionEvent.SuggestionUpdated,
245+
QuickBarStateMachine.BooleanKey.SuggestionEmpty to views.isEmpty(),
246+
)
247+
}
229248
}

0 commit comments

Comments
 (0)