From 951b441dc4a7bdf599b3b4a9e3308bd26375efd7 Mon Sep 17 00:00:00 2001 From: WhiredPlanck Date: Fri, 1 Nov 2024 23:54:57 +0800 Subject: [PATCH] fix: main keyboard view would disappear after switching schema --- .../com/osfans/trime/ime/core/TrimeInputMethodService.kt | 4 ---- .../java/com/osfans/trime/ime/keyboard/KeyboardWindow.kt | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/osfans/trime/ime/core/TrimeInputMethodService.kt b/app/src/main/java/com/osfans/trime/ime/core/TrimeInputMethodService.kt index f410e91606..5ab57b44dc 100644 --- a/app/src/main/java/com/osfans/trime/ime/core/TrimeInputMethodService.kt +++ b/app/src/main/java/com/osfans/trime/ime/core/TrimeInputMethodService.kt @@ -256,10 +256,6 @@ open class TrimeInputMethodService : LifecycleInputMethodService() { private fun handleRimeCallback(it: RimeCallback) { when (it) { - is RimeNotification.SchemaNotification -> { - recreateInputView(ThemeManager.activeTheme) - } - is RimeNotification.OptionNotification -> { val value = it.value.value when (val option = it.value.option) { diff --git a/app/src/main/java/com/osfans/trime/ime/keyboard/KeyboardWindow.kt b/app/src/main/java/com/osfans/trime/ime/keyboard/KeyboardWindow.kt index 888ba4d4c2..95d01132d2 100644 --- a/app/src/main/java/com/osfans/trime/ime/keyboard/KeyboardWindow.kt +++ b/app/src/main/java/com/osfans/trime/ime/keyboard/KeyboardWindow.kt @@ -15,6 +15,7 @@ import androidx.core.content.ContextCompat import com.osfans.trime.R import com.osfans.trime.core.Rime import com.osfans.trime.core.RimeNotification.OptionNotification +import com.osfans.trime.core.SchemaItem import com.osfans.trime.daemon.RimeSession import com.osfans.trime.data.prefs.AppPrefs import com.osfans.trime.data.schema.SchemaManager @@ -234,6 +235,10 @@ class KeyboardWindow( dispatchCapsState(mainKeyboardView::setShifted) } + override fun onRimeSchemaUpdated(schema: SchemaItem) { + switchKeyboard(smartMatchKeyboard()) + } + override fun onRimeOptionUpdated(value: OptionNotification.Value) { when (val opt = value.option) { "ascii_mode" -> currentKeyboard?.currentAsciiMode = value.value