android: maybe fixes lang changer in some situations (#2739)

This commit is contained in:
Stanislav Dmitrenko
2023-07-20 16:13:59 +03:00
committed by GitHub
parent d63c7d2abc
commit 87c35b037e
2 changed files with 2 additions and 3 deletions
@@ -66,11 +66,11 @@ class MainActivity: FragmentActivity() {
private val destroyedAfterBackPress = mutableStateOf(false)
override fun onCreate(savedInstanceState: Bundle?) {
applyAppLocale(ChatModel.controller.appPrefs.appLanguage)
super.onCreate(savedInstanceState)
SimplexApp.context.mainActivity = WeakReference(this)
// testJson()
val m = vm.chatModel
applyAppLocale(m.controller.appPrefs.appLanguage)
// When call ended and orientation changes, it re-process old intent, it's unneeded.
// Only needed to be processed on first creation of activity
if (savedInstanceState == null) {
@@ -626,8 +626,7 @@ fun saveAppLocale(pref: SharedPreference<String?>, activity: Activity, languageC
fun Activity.applyAppLocale(pref: SharedPreference<String?>) {
// if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
val lang = pref.get()
if (lang == null || lang == Locale.getDefault().language) return
val lang = pref.get() ?: return
applyLocale(Locale.forLanguageTag(lang))
// }
}