Skip to content

Commit 0a53ba4

Browse files
committed
Delay launch of eventHandlerJob in InputView
1 parent d981724 commit 0a53ba4

File tree

1 file changed

+8
-5
lines changed
  • app/src/main/java/org/fcitx/fcitx5/android/input

1 file changed

+8
-5
lines changed

app/src/main/java/org/fcitx/fcitx5/android/input/InputView.kt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import androidx.annotation.RequiresApi
1616
import androidx.constraintlayout.widget.ConstraintLayout
1717
import androidx.core.view.*
1818
import androidx.lifecycle.lifecycleScope
19+
import kotlinx.coroutines.Job
1920
import kotlinx.coroutines.launch
2021
import org.fcitx.fcitx5.android.R
2122
import org.fcitx.fcitx5.android.core.CapabilityFlags
@@ -83,11 +84,7 @@ class InputView(
8384
setOnClickListener(placeholderOnClickListener)
8485
}
8586

86-
private val eventHandlerJob = service.lifecycleScope.launch {
87-
fcitx.runImmediately { eventFlow }.collect {
88-
handleFcitxEvent(it)
89-
}
90-
}
87+
private val eventHandlerJob: Job
9188

9289
private val scope = DynamicScope()
9390
private val themedContext = context.withTheme(R.style.Theme_InputViewTheme)
@@ -183,6 +180,12 @@ class InputView(
183180
// MUST call before any operation
184181
setupScope()
185182

183+
eventHandlerJob = service.lifecycleScope.launch {
184+
fcitx.runImmediately { eventFlow }.collect {
185+
handleFcitxEvent(it)
186+
}
187+
}
188+
186189
// restore punctuation mapping in case of InputView recreation
187190
fcitx.launchOnReady {
188191
punctuation.updatePunctuationMapping(it.statusAreaActionsCached)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy