Skip to content

Commit

Permalink
fix: force show mode, candidates and window components show simultane…
Browse files Browse the repository at this point in the history
…ously (temp)
  • Loading branch information
if-can authored and Bambooin committed Jan 19, 2025
1 parent b771710 commit 0524a7b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/src/main/java/com/osfans/trime/ime/bar/QuickBar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import com.osfans.trime.ime.bar.ui.SuggestionUi
import com.osfans.trime.ime.bar.ui.TabUi
import com.osfans.trime.ime.broadcast.InputBroadcastReceiver
import com.osfans.trime.ime.candidates.CandidateModule
import com.osfans.trime.ime.candidates.popup.PopupCandidatesMode
import com.osfans.trime.ime.candidates.unrolled.window.FlexboxUnrolledCandidateWindow
import com.osfans.trime.ime.core.TrimeInputMethodService
import com.osfans.trime.ime.dependency.InputScope
Expand Down Expand Up @@ -154,7 +155,12 @@ class QuickBar(
candidateUi.unrollButton.visibility = if (enabled) View.VISIBLE else View.INVISIBLE
}

private val candidatesMode by AppPrefs.defaultInstance().candidates.mode

override fun onInputContextUpdate(ctx: RimeProto.Context) {
// TODO: 临时修复状态栏与悬浮窗同时显示,后续需优化:考虑分离数据或寻找更好的实现方式
if (candidatesMode == PopupCandidatesMode.FORCE_SHOW) return

barStateMachine.push(
QuickBarStateMachine.TransitionEvent.CandidatesUpdated,
QuickBarStateMachine.BooleanKey.CandidateEmpty to ctx.menu.candidates.isEmpty(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ import android.widget.PopupWindow
import com.osfans.trime.core.RimeProto
import com.osfans.trime.daemon.RimeSession
import com.osfans.trime.daemon.launchOnReady
import com.osfans.trime.data.prefs.AppPrefs
import com.osfans.trime.data.theme.ColorManager
import com.osfans.trime.data.theme.Theme
import com.osfans.trime.ime.bar.QuickBar
import com.osfans.trime.ime.broadcast.InputBroadcastReceiver
import com.osfans.trime.ime.candidates.popup.PopupCandidatesMode
import com.osfans.trime.ime.dependency.InputScope
import me.tatarka.inject.annotations.Inject
import splitties.views.backgroundColor
Expand Down Expand Up @@ -67,7 +69,12 @@ class PreeditModule(
animationStyle = 0
}

private val candidatesMode by AppPrefs.defaultInstance().candidates.mode

override fun onInputContextUpdate(ctx: RimeProto.Context) {
// TODO: 临时修复状态栏与悬浮窗同时显示,后续需优化:考虑分离数据或寻找更好的实现方式
if (candidatesMode == PopupCandidatesMode.FORCE_SHOW) return

ui.update(ctx.composition)
if (ctx.composition.length > 0) {
val (x, y) = intArrayOf(0, 0).also { bar.view.getLocationInWindow(it) }
Expand Down

0 comments on commit 0524a7b

Please sign in to comment.