Skip to content

Commit

Permalink
fix: fix dynamic keyboard outdated data
Browse files Browse the repository at this point in the history
fix: fix dynamic keyboard outdated data
  • Loading branch information
shitlime committed Jun 15, 2023
1 parent f3dca25 commit c1cf0a7
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions app/src/main/java/com/osfans/trime/ime/symbol/LiquidKeyboard.kt
Expand Up @@ -23,7 +23,9 @@ import com.osfans.trime.ime.enums.KeyCommandType
import com.osfans.trime.ime.enums.SymbolKeyboardType
import com.osfans.trime.ime.text.TextInputManager
import com.osfans.trime.util.dp2px
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import timber.log.Timber

class LiquidKeyboard(private val context: Context) {
Expand Down Expand Up @@ -223,17 +225,23 @@ class LiquidKeyboard(private val context: Context) {
when (type) {
SymbolKeyboardType.CLIPBOARD -> {
service.lifecycleScope.launch {
dbAdapter.updateBeans(ClipboardHelper.getAll())
withContext(Dispatchers.IO) {
dbAdapter.updateBeans(ClipboardHelper.getAll())
}
}
}
SymbolKeyboardType.COLLECTION -> {
service.lifecycleScope.launch {
dbAdapter.updateBeans(CollectionHelper.getAll())
withContext(Dispatchers.IO) {
dbAdapter.updateBeans(CollectionHelper.getAll())
}
}
}
SymbolKeyboardType.DRAFT -> {
service.lifecycleScope.launch {
dbAdapter.updateBeans(DraftHelper.getAll())
withContext(Dispatchers.IO) {
dbAdapter.updateBeans(DraftHelper.getAll())
}
}
}
else -> return
Expand Down

0 comments on commit c1cf0a7

Please sign in to comment.