Skip to content

Commit dd8d009

Browse files
committed
Remove colorSchemeLoaderJob in favor of blocked loading
1 parent e0bd7b2 commit dd8d009

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

java/src/org/futo/inputmethod/latin/LatinIME.kt

+4-12
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ class LatinIME : InputMethodService(), LifecycleOwner, ViewModelStoreOwner, Save
126126

127127
private var activeThemeOption: ThemeOption? = null
128128
private var activeColorScheme = DarkColorScheme
129-
private var colorSchemeLoaderJob: Job? = null
130129
private var pendingRecreateKeyboard: Boolean = false
131130

132131
val themeOption get() = activeThemeOption
@@ -182,17 +181,10 @@ class LatinIME : InputMethodService(), LifecycleOwner, ViewModelStoreOwner, Save
182181
}
183182

184183
override fun getDrawableProvider(): DynamicThemeProvider {
185-
if (drawableProvider == null) {
186-
if (colorSchemeLoaderJob != null && !colorSchemeLoaderJob!!.isCompleted) {
187-
// Must have completed by now!
188-
runBlocking {
189-
colorSchemeLoaderJob!!.join()
190-
}
191-
}
192-
drawableProvider = BasicThemeProvider(this, activeColorScheme)
184+
return drawableProvider ?: BasicThemeProvider(this, activeColorScheme).let {
185+
drawableProvider = it
186+
it
193187
}
194-
195-
return drawableProvider!!
196188
}
197189

198190
private fun updateColorsIfDynamicChanged() {
@@ -289,7 +281,7 @@ class LatinIME : InputMethodService(), LifecycleOwner, ViewModelStoreOwner, Save
289281
suggestionBlacklist
290282
)
291283

292-
colorSchemeLoaderJob = deferGetSetting(THEME_KEY) {
284+
getSettingBlocking(THEME_KEY).let {
293285
val themeOptionFromSettings = ThemeOptions[it]
294286
val themeOption = when {
295287
themeOptionFromSettings == null -> VoiceInputTheme

0 commit comments

Comments
 (0)