From 413b905fb1af7f421b801a3d7ad0b84b57e919ab Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期二, 15 四月 2025 08:54:11 +0800
Subject: [PATCH] 2025年04月15日08:54:09
---
app/src/main/java/com/hdl/photovoltaic/HDLApp.java | 36 +++++++++++++++++++++++++++++-------
1 files changed, 29 insertions(+), 7 deletions(-)
diff --git a/app/src/main/java/com/hdl/photovoltaic/HDLApp.java b/app/src/main/java/com/hdl/photovoltaic/HDLApp.java
index 0108f24..b4ba57d 100644
--- a/app/src/main/java/com/hdl/photovoltaic/HDLApp.java
+++ b/app/src/main/java/com/hdl/photovoltaic/HDLApp.java
@@ -41,6 +41,7 @@
import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus;
import com.hdl.sdk.link.core.connect.HDLUdpConnect;
import com.hdl.sdk.link.core.utils.QueueUtils;
+import com.hdl.sdk.link.core.utils.mqtt.MqttRecvClient;
import org.greenrobot.eventbus.EventBus;
@@ -90,14 +91,16 @@
//棰勫垱寤鸿剼鏈琷son鏂囦欢澶�
HdlFileLogic.getInstance().createHdlESLocalJsonDirectory();
init();
+
+
}
public void getAppLanguage() {
String language = UserConfigManage.getInstance().getCurrentAppLanguage();
if (TextUtils.isEmpty(language)) {
//浠庡唴瀛橀噷闈㈣幏鍙栦笉鍒拌瑷�,鑾峰彇褰撳墠绯荤粺鐨�;
- String str = getResources().getConfiguration().locale.getCountry();
- if (str.equals("CN") || str.equals("TW")) {
+ String str = getResources().getConfiguration().locale.getLanguage();
+ if (str.equals(LocalManageUtil.zh)) {
UserConfigManage.getInstance().setCurrentAppLanguage(LocalManageUtil.zh);
} else {
UserConfigManage.getInstance().setCurrentAppLanguage(LocalManageUtil.en);
@@ -200,7 +203,7 @@
HDLLinkPMUser.getInstance().setOnReloginListener(new IOnReloginListener() {
@Override
public void onReLogin(int type) {
- HdlLogLogic.print("閫�鍒扮櫥褰曠晫闈�---" + type, true);
+ HdlLogLogic.print("鐩戝惉鍒扮櫥褰曢��鍑�---" + type, true);
//type: 0:姝e父閫�鍑� 1锛氭瀬鍏夋帹閫佸己鍒堕��鍑�
//鏀跺埌鐧诲綍澶勭悊閫氱煡锛屽叧闂墍鏈夐〉闈㈠苟鎵撳紑鐧诲綍椤甸潰
AppManagerUtils.getAppManager().finishAllActivity();
@@ -222,10 +225,10 @@
if (mInfoMap != null) {
mInfoMap.clear();
}
-// //鏂紑mqtt杩炴帴
-// if (MqttRecvClient.getInstance() != null) {
-// MqttRecvClient.getInstance().disConnect();
-// }
+ //鏂紑mqtt杩炴帴
+ if (MqttRecvClient.getInstance() != null) {
+ MqttRecvClient.getInstance().disConnect();
+ }
//鏂紑鎵�鏈塼cp杩炴帴涓旀竻绌鸿繛鎺ョ紦瀛�
// TODO: 10/10/23
// TcpSocketBoot.stopAllConnectLinkGateway();
@@ -346,6 +349,7 @@
});
}
+
/**
* 鍒濆鍖杣ni app mqtt
*/
@@ -363,6 +367,7 @@
}
}
+
@Override
protected void attachBaseContext(Context base) {
MultiDex.install(base);
@@ -372,6 +377,23 @@
/**
* 鏀寔涓嫳鏂囧垏鎹�
*/
+ public Context getAppLocaleContext(Context context) {
+ try {
+ Locale locale = new Locale(UserConfigManage.getInstance().getCurrentAppLanguage());
+ Configuration configuration = context.getResources().getConfiguration();
+ configuration.setLocale(locale);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+ configuration.setLocales(new LocaleList(locale));
+ }
+ return context.createConfigurationContext(configuration);
+ } catch (Exception e) {
+ return context;
+ }
+ }
+
+ /**
+ * 鏀寔涓嫳鏂囧垏鎹�
+ */
public Context getAppLocaleContext() {
try {
Locale locale = new Locale(UserConfigManage.getInstance().getCurrentAppLanguage());
--
Gitblit v1.8.0