Skip to content

Commit

Permalink
refactor: remove unused override onWindowShown/Hidden in TrimeInput…
Browse files Browse the repository at this point in the history
…MethodService
  • Loading branch information
WhiredPlanck committed Nov 21, 2024
1 parent e512068 commit 2e1328c
Showing 1 changed file with 0 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ import kotlinx.coroutines.Job
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.consumeEach
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import splitties.bitflags.hasFlag
import splitties.systemservices.inputMethodManager
import splitties.views.gravityBottom
Expand All @@ -85,7 +84,6 @@ open class TrimeInputMethodService : LifecycleInputMethodService() {
var inputView: InputView? = null
private var initializationUi: InitializationUi? = null
private var mIntentReceiver: IntentReceiver? = null
private var isWindowShown = false // 键盘窗口是否已显示
private var isComposable: Boolean = false
private val locales = Array(2) { Locale.getDefault() }

Expand Down Expand Up @@ -124,35 +122,6 @@ open class TrimeInputMethodService : LifecycleInputMethodService() {
*/
fun postRimeJob(block: suspend RimeApi.() -> Unit) = postJob(rime.lifecycleScope) { rime.runOnReady(block) }

override fun onWindowShown() {
super.onWindowShown()
if (isWindowShown) {
Timber.i("Ignoring (is already shown)")
return
} else {
Timber.i("onWindowShown...")
}
postRimeJob {
if (currentInputEditorInfo != null) {
isWindowShown = true
withContext(Dispatchers.Main) {
updateComposing()
}
}
}
}

override fun onWindowHidden() {
super.onWindowHidden()
if (!isWindowShown) {
Timber.d("Ignoring (window is already hidden)")
return
} else {
Timber.d("onWindowHidden")
}
isWindowShown = false
}

private suspend fun updateRimeOption(api: RimeApi) {
try {
api.setRuntimeOption("soft_cursor", prefs.keyboard.softCursorEnabled) // 軟光標
Expand Down

0 comments on commit 2e1328c

Please sign in to comment.