mirror of
https://github.com/openMF/mifos-mobile.git
synced 2026-02-06 11:26:51 +00:00
fix: language revert to system default after switching back from a custom language (#3060)
This commit is contained in:
parent
e4ef866b56
commit
8b3f4f915c
@ -10,8 +10,8 @@
|
||||
package cmp.android.app
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import androidx.core.os.LocaleListCompat
|
||||
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
|
||||
@ -33,9 +33,9 @@ import kotlin.getValue
|
||||
* This class is used to set the content view of the activity.
|
||||
*
|
||||
* @constructor Create empty Main activity
|
||||
* @see ComponentActivity
|
||||
* @see AppCompatActivity
|
||||
*/
|
||||
class MainActivity : ComponentActivity() {
|
||||
class MainActivity : AppCompatActivity() {
|
||||
/**
|
||||
* Called when the activity is starting.
|
||||
* This is where most initialization should go: calling [setContentView(int)] to inflate the activity's UI,
|
||||
@ -70,9 +70,15 @@ class MainActivity : ComponentActivity() {
|
||||
AppCompatDelegate.setDefaultNightMode(it)
|
||||
},
|
||||
handleAppLocale = {
|
||||
it?.let {
|
||||
if (it.isNullOrBlank()) {
|
||||
AppCompatDelegate.setApplicationLocales(
|
||||
LocaleListCompat.forLanguageTags(it),
|
||||
LocaleListCompat.getEmptyLocaleList(),
|
||||
)
|
||||
} else {
|
||||
AppCompatDelegate.setApplicationLocales(
|
||||
LocaleListCompat.forLanguageTags(
|
||||
it,
|
||||
),
|
||||
)
|
||||
Locale.setDefault(Locale(it))
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user