Making sure the UI update from language is in the Main thread.
This commit is contained in:
+5
-3
@@ -109,9 +109,11 @@ class SharedPreferencesViewModel : ViewModel() {
|
|||||||
|
|
||||||
fun updateLanguageInTheUI() {
|
fun updateLanguageInTheUI() {
|
||||||
if (sharedPrefs.language != null) {
|
if (sharedPrefs.language != null) {
|
||||||
AppCompatDelegate.setApplicationLocales(
|
viewModelScope.launch(Dispatchers.Main) {
|
||||||
LocaleListCompat.forLanguageTags(sharedPrefs.language)
|
AppCompatDelegate.setApplicationLocales(
|
||||||
)
|
LocaleListCompat.forLanguageTags(sharedPrefs.language)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user