Commit 7ae255cd authored by wanglei's avatar wanglei

...

parent 2f3e1720
...@@ -64,29 +64,29 @@ abstract class BaseActivity<T : ViewBinding> : AppCompatActivity() { ...@@ -64,29 +64,29 @@ abstract class BaseActivity<T : ViewBinding> : AppCompatActivity() {
activityTag: String? = null, activityTag: String? = null,
activityChangeCallback: ((language: String) -> Unit)? = null activityChangeCallback: ((language: String) -> Unit)? = null
): Boolean { ): Boolean {
LogEx.logDebug( // LogEx.logDebug(
TAG, // TAG,
"activityTag=$activityTag " + // "activityTag=$activityTag " +
"appLanguageSp=$appLanguageSp " + // "appLanguageSp=$appLanguageSp " +
"changeLanguageSp=$changeLanguageSp " + // "changeLanguageSp=$changeLanguageSp " +
"activityLanguage=$activityLanguage" // "activityLanguage=$activityLanguage"
) // )
var isRecreate = false // var isRecreate = false
//
if (appLanguageSp != changeLanguageSp || activityLanguage != changeLanguageSp) { // if (appLanguageSp != changeLanguageSp || activityLanguage != changeLanguageSp) {
//
changeAppLanguage(this, changeLanguageSp) // changeAppLanguage(this, changeLanguageSp)
// Restart the app // // Restart the app
appLanguageSp = changeLanguageSp // appLanguageSp = changeLanguageSp
activityChangeCallback?.invoke(changeLanguageSp) // activityChangeCallback?.invoke(changeLanguageSp)
LogEx.logDebug(TAG, "activityTag=$activityTag recreate") // LogEx.logDebug(TAG, "activityTag=$activityTag recreate")
isRecreate = true // isRecreate = true
//
//https://stackoverflow.com/questions/63209993/getting-lifecycle-exception-while-recreating-the-activity // //https://stackoverflow.com/questions/63209993/getting-lifecycle-exception-while-recreating-the-activity
//MIUI recreate // //MIUI recreate
this@BaseActivity.recreate() // this@BaseActivity.recreate()
} // }
return isRecreate return false
} }
fun isLanguageRecreate(activityLanguage: String): Boolean { fun isLanguageRecreate(activityLanguage: String): Boolean {
......
...@@ -181,7 +181,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(), SplashView { ...@@ -181,7 +181,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(), SplashView {
private fun firstLauncherJump() { private fun firstLauncherJump() {
if (Locale.getDefault().language + "_" + Locale.getDefault().country != Locale.ENGLISH.language + "_" + Locale.ENGLISH.country) { if (Locale.getDefault().language + "_" + Locale.getDefault().country != Locale.ENGLISH.language + "_" + Locale.ENGLISH.country) {
startActivity(Intent(this, LanguageActivity::class.java).apply { startActivity(Intent(this, HowUseActivity::class.java).apply {
putExtra("isGuide", true) putExtra("isGuide", true)
}) })
} else { } else {
......
...@@ -207,7 +207,8 @@ ...@@ -207,7 +207,8 @@
android:layout_height="61dp" android:layout_height="61dp"
android:background="?android:attr/selectableItemBackground" android:background="?android:attr/selectableItemBackground"
android:clickable="true" android:clickable="true"
android:focusable="true"> android:focusable="true"
android:visibility="gone">
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
...@@ -243,7 +244,8 @@ ...@@ -243,7 +244,8 @@
android:layout_height="61dp" android:layout_height="61dp"
android:background="?android:attr/selectableItemBackground" android:background="?android:attr/selectableItemBackground"
android:clickable="true" android:clickable="true"
android:focusable="true"> android:focusable="true"
android:visibility="gone">
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment