fix:修复部分手机切换Application语言无效问题

This commit is contained in:
max
2024-04-11 11:32:47 +08:00
parent 73f24839d4
commit c64d74aa7d
3 changed files with 12 additions and 3 deletions

View File

@@ -5,6 +5,7 @@ import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TY
import android.annotation.SuppressLint;
import android.app.Application;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Color;
import android.net.http.HttpResponseCache;
import android.os.Build;
@@ -12,6 +13,7 @@ import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.multidex.MultiDex;
import com.alibaba.android.arouter.launcher.ARouter;
@@ -547,10 +549,16 @@ public class App extends BaseApp {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
super.attachBaseContext(LanguageHelper.INSTANCE.wrapContext(base));
MultiDex.install(base);
}
@Override
public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
LanguageHelper.INSTANCE.wrapContext(this);
}
@Override
public void onTerminate() {
super.onTerminate();

View File

@@ -520,6 +520,7 @@ public abstract class BaseActivity extends RxAppCompatActivity
@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(LanguageHelper.INSTANCE.wrapContext(newBase));
LanguageHelper.INSTANCE.wrapContext(newBase.getApplicationContext());
}
@Override

View File

@@ -32,8 +32,8 @@ COMPILE_SDK_VERSION=33
MIN_SDK_VERSION=21
TARGET_SDK_VERSION=33
version_name=1.0.2
version_code=4
version_name=1.0.3
version_code=5
#systemProp.https.proxyHost=127.0.0.1
#systemProp.https.proxyPort=7890