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() {
|
||||
if (sharedPrefs.language != null) {
|
||||
AppCompatDelegate.setApplicationLocales(
|
||||
LocaleListCompat.forLanguageTags(sharedPrefs.language)
|
||||
)
|
||||
viewModelScope.launch(Dispatchers.Main) {
|
||||
AppCompatDelegate.setApplicationLocales(
|
||||
LocaleListCompat.forLanguageTags(sharedPrefs.language)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user