@@ -23,7 +23,9 @@ import com.osfans.trime.ime.enums.KeyCommandType
23
23
import com.osfans.trime.ime.enums.SymbolKeyboardType
24
24
import com.osfans.trime.ime.text.TextInputManager
25
25
import com.osfans.trime.util.dp2px
26
+ import kotlinx.coroutines.Dispatchers
26
27
import kotlinx.coroutines.launch
28
+ import kotlinx.coroutines.withContext
27
29
import timber.log.Timber
28
30
29
31
class LiquidKeyboard (private val context : Context ) {
@@ -223,17 +225,23 @@ class LiquidKeyboard(private val context: Context) {
223
225
when (type) {
224
226
SymbolKeyboardType .CLIPBOARD -> {
225
227
service.lifecycleScope.launch {
226
- dbAdapter.updateBeans(ClipboardHelper .getAll())
228
+ withContext(Dispatchers .IO ) {
229
+ dbAdapter.updateBeans(ClipboardHelper .getAll())
230
+ }
227
231
}
228
232
}
229
233
SymbolKeyboardType .COLLECTION -> {
230
234
service.lifecycleScope.launch {
231
- dbAdapter.updateBeans(CollectionHelper .getAll())
235
+ withContext(Dispatchers .IO ) {
236
+ dbAdapter.updateBeans(CollectionHelper .getAll())
237
+ }
232
238
}
233
239
}
234
240
SymbolKeyboardType .DRAFT -> {
235
241
service.lifecycleScope.launch {
236
- dbAdapter.updateBeans(DraftHelper .getAll())
242
+ withContext(Dispatchers .IO ) {
243
+ dbAdapter.updateBeans(DraftHelper .getAll())
244
+ }
237
245
}
238
246
}
239
247
else -> return
0 commit comments