From 5645ad0ea692bd3ed2246e19af065e0abefde80a Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期四, 26 六月 2025 10:59:44 +0800 Subject: [PATCH] 2025年06月26日10:59:42 --- app/src/main/java/com/hdl/photovoltaic/ui/LoginActivity.java | 39 +++++++++++++++++++++++++++++++++++---- app/src/main/res/values-zh/strings.xml | 1 + app/src/main/res/values/strings.xml | 2 +- app/src/main/java/com/hdl/photovoltaic/widget/ConfirmationCancelDialog.java | 1 + app/src/main/res/values-en/strings.xml | 1 + 5 files changed, 39 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/LoginActivity.java b/app/src/main/java/com/hdl/photovoltaic/ui/LoginActivity.java index 4329638..1757cae 100644 --- a/app/src/main/java/com/hdl/photovoltaic/ui/LoginActivity.java +++ b/app/src/main/java/com/hdl/photovoltaic/ui/LoginActivity.java @@ -12,6 +12,7 @@ import android.text.method.LinkMovementMethod; import android.text.method.PasswordTransformationMethod; import android.text.style.ClickableSpan; +import android.view.Gravity; import android.view.View; import android.widget.TextView; @@ -318,10 +319,40 @@ viewBinding.homeNoNetworkModeLoginTv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - UserConfigManage.getInstance().setNoNetworkFlag(true); - UserConfigManage.getInstance().Save(); - String path = HDLUniMP.UNI_EVENT_OPEN_NONETWORKDEVICELIST + "?mac=" + UserConfigManage.getInstance().getNoNetworkDeviceMac() + "&password=" + UserConfigManage.getInstance().getNoNetworkPassword() + "&autoVerify=" +UserConfigManage.getInstance().isNoNetworkFlag(); - HdlUniLogic.getInstance().openUniMP(path, null); + boolean isNoNetworkModeLogin = SharedPreUtils.getBoolean("no_network_mode"); + if (!isNoNetworkModeLogin) { + //绗竴娆℃墦寮�瑕佹彁绀� + ConfirmationCancelDialog confirmationCancelDialog = new ConfirmationCancelDialog(_mActivity); + confirmationCancelDialog.setTitle(getString(R.string.loading_title_tip)); + confirmationCancelDialog.setContent(getString(R.string.no_network_mode_tip)); + confirmationCancelDialog.setConfirmation(getString(R.string.home_login_affirm)); + confirmationCancelDialog.setCancel(getString(R.string.scan_cancel)); + confirmationCancelDialog.show(); + confirmationCancelDialog.getContentTextView().setGravity(Gravity.START); + confirmationCancelDialog.setNoOnclickListener(new ConfirmationCancelDialog.onNoOnclickListener() { + @Override + public void Cancel() { + confirmationCancelDialog.dismiss(); + SharedPreUtils.putBoolean("no_network_mode", false); + } + }); + confirmationCancelDialog.setYesOnclickListener(new ConfirmationCancelDialog.onYesOnclickListener() { + @Override + public void Confirm() { + confirmationCancelDialog.dismiss(); + SharedPreUtils.putBoolean("no_network_mode", true); + UserConfigManage.getInstance().setNoNetworkFlag(true); + UserConfigManage.getInstance().Save(); + String path = HDLUniMP.UNI_EVENT_OPEN_NONETWORKDEVICELIST + "?mac=" + UserConfigManage.getInstance().getNoNetworkDeviceMac() + "&password=" + UserConfigManage.getInstance().getNoNetworkPassword() + "&autoVerify=" + UserConfigManage.getInstance().isNoNetworkFlag(); + HdlUniLogic.getInstance().openUniMP(path, null); + } + }); + } else { + UserConfigManage.getInstance().setNoNetworkFlag(true); + UserConfigManage.getInstance().Save(); + String path = HDLUniMP.UNI_EVENT_OPEN_NONETWORKDEVICELIST + "?mac=" + UserConfigManage.getInstance().getNoNetworkDeviceMac() + "&password=" + UserConfigManage.getInstance().getNoNetworkPassword() + "&autoVerify=" + UserConfigManage.getInstance().isNoNetworkFlag(); + HdlUniLogic.getInstance().openUniMP(path, null); + } } }); diff --git a/app/src/main/java/com/hdl/photovoltaic/widget/ConfirmationCancelDialog.java b/app/src/main/java/com/hdl/photovoltaic/widget/ConfirmationCancelDialog.java index 5d64da3..cc90c09 100644 --- a/app/src/main/java/com/hdl/photovoltaic/widget/ConfirmationCancelDialog.java +++ b/app/src/main/java/com/hdl/photovoltaic/widget/ConfirmationCancelDialog.java @@ -129,6 +129,7 @@ } } + public TextView getContentTextView() { if (viewBinding == null) { return null; diff --git a/app/src/main/res/values-en/strings.xml b/app/src/main/res/values-en/strings.xml index 6cf282b..362b7b0 100644 --- a/app/src/main/res/values-en/strings.xml +++ b/app/src/main/res/values-en/strings.xml @@ -365,4 +365,5 @@ <string name="device_failed_to_certificate">Device failed to certificate</string> <string name="no_network_mode">No network mode</string> <string name="confirm_deletion">Delete confirmation required</string> + <string name="no_network_mode_tip">Before using the offline mode, please make sure that the phone and the device are in the same local area network, otherwise it will not work properly. You can try the following two methods:\n\n1. Connect the phone to the device hotspot;\n\n2. Connect the phone to the router Wi-Fi, and the device to the router LAN port via an Ethernet cable.</string> </resources> \ No newline at end of file diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 48db3de..382dddf 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -361,5 +361,6 @@ <string name="device_failed_to_certificate">鏌ヨ璁惧璁よ瘉澶辫触</string> <string name="no_network_mode">鏃犵綉妯″紡</string> <string name="confirm_deletion">纭畾闇�瑕佸垹闄�</string> + <string name="no_network_mode_tip">浣跨敤鏃犵綉妯″紡鍓嶏紝璇风‘淇濇墜鏈轰笌璁惧澶勪簬鍚屼竴灞�鍩熺綉鍐咃紝鍚﹀垯灏嗘棤娉曟甯镐娇鐢紝浣犲彲浠ュ皾璇曚互涓嬩袱绉嶆柟寮忥細\n\n1.鎵嬫満杩炴帴璁惧鐑偣锛沑n\n2.鎵嬫満杩炴帴璺敱鍣╓i-Fi锛岃澶囬�氳繃缃戠嚎鎺ュ叆璺敱鍣↙AN鍙c��</string> </resources> \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e45b9f4..cb3c3d2 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -367,7 +367,7 @@ <string name="device_failed_to_certificate">Device failed to certificate</string> <string name="no_network_mode">No network mode</string> <string name="confirm_deletion">Delete confirmation required</string> - + <string name="no_network_mode_tip">Before using the offline mode, please make sure that the phone and the device are in the same local area network, otherwise it will not work properly. You can try the following two methods:\n\n1. Connect the phone to the device hotspot;\n\n2. Connect the phone to the router Wi-Fi, and the device to the router LAN port via an Ethernet cable.</string> -- Gitblit v1.8.0