From 3437ede62f248eaa4597c9475e2b1e426b67704d Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期二, 14 一月 2025 13:32:51 +0800
Subject: [PATCH] 2025年01月14日13:32:50

---
 app/src/main/res/layout/dialog_confirm_cancel.xml            |    3 
 app/src/main/java/com/hdl/photovoltaic/ui/StartActivity.java |  141 ++++++++++++++++++++++++++++++++++++++++++++++-
 app/src/main/res/values-zh/strings.xml                       |    3 +
 app/src/main/res/values/strings.xml                          |    3 +
 app/src/main/res/values-en/strings.xml                       |    3 +
 5 files changed, 149 insertions(+), 4 deletions(-)

diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/StartActivity.java b/app/src/main/java/com/hdl/photovoltaic/ui/StartActivity.java
index 4d8d701..2407b1a 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/StartActivity.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/StartActivity.java
@@ -3,8 +3,16 @@
 
 import android.content.Intent;
 import android.os.Bundle;
+import android.text.SpannableStringBuilder;
+import android.text.TextPaint;
 import android.text.TextUtils;
+import android.text.method.LinkMovementMethod;
+import android.text.style.ClickableSpan;
 import android.util.Log;
+import android.view.View;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
 
 import com.hdl.linkpm.sdk.core.exception.HDLException;
 import com.hdl.linkpm.sdk.user.HDLLinkPMUser;
@@ -13,8 +21,13 @@
 import com.hdl.photovoltaic.config.AppConfigManage;
 import com.hdl.photovoltaic.config.UserConfigManage;
 import com.hdl.photovoltaic.listener.CloudCallBeak;
+import com.hdl.photovoltaic.other.HdlCommonLogic;
 import com.hdl.photovoltaic.other.HdlResidenceLogic;
 import com.hdl.photovoltaic.ui.bean.HouseIdBean;
+import com.hdl.photovoltaic.ui.me.WebActivity;
+import com.hdl.photovoltaic.utils.LocalManageUtil;
+import com.hdl.photovoltaic.utils.SharedPreUtils;
+import com.hdl.photovoltaic.widget.ConfirmationCancelDialog;
 
 import java.util.List;
 
@@ -65,9 +78,40 @@
                 });
             }
         } else {
-            Intent intent = new Intent();
-            intent.setClass(this, LoginActivity.class);
-            openActivity(intent);
+            //鍙戝竷瀹℃牳灏忕背搴旂敤甯傚満瑕佹眰APP绗竴娆″惎鍔ㄦ彁鍓嶆彁绀恒�婄敤鎴峰崗璁�嬪拰銆婇殣绉佹斂绛栥�嬫墠鍏佽涓婄嚎
+            final String key = "is_login";
+            boolean isLogin = SharedPreUtils.getBoolean(key);
+            if (isLogin) {
+                Intent intent = new Intent();
+                intent.setClass(StartActivity.this, LoginActivity.class);
+                openActivity(intent);
+            } else {
+                ConfirmationCancelDialog confirmationCancelDialog = new ConfirmationCancelDialog(this);
+                confirmationCancelDialog.setTitle(getString(R.string.user_agreement_and_privacy_agreement));
+                confirmationCancelDialog.setContent(getString(R.string.thank_you_for_using));
+                confirmationCancelDialog.setConfirmation(getString(R.string.agree));
+                confirmationCancelDialog.setCancel(getString(R.string.loading_on_agree));
+                confirmationCancelDialog.show();
+                setStringDifferentColors(confirmationCancelDialog.getContentTextView());
+                confirmationCancelDialog.setNoOnclickListener(new ConfirmationCancelDialog.onNoOnclickListener() {
+                    @Override
+                    public void Cancel() {
+                        SharedPreUtils.putBoolean(key, false);
+                        finish();
+                    }
+                });
+                confirmationCancelDialog.setYesOnclickListener(new ConfirmationCancelDialog.onYesOnclickListener() {
+                    @Override
+                    public void Confirm() {
+                        SharedPreUtils.putBoolean(key, true);
+                        Intent intent = new Intent();
+                        intent.setClass(StartActivity.this, LoginActivity.class);
+                        openActivity(intent);
+                    }
+                });
+            }
+
+
         }
 
 
@@ -91,5 +135,96 @@
         overridePendingTransition(0, 0);
     }
 
+    /**
+     * 璁剧疆涓�涓插瓧绗﹀绉嶉鑹蹭互鍙婄偣鍑讳簨浠�
+     *
+     * @param textView 褰撳墠缁勪欢
+     */
+    private void setStringDifferentColors(TextView textView) {
+        try {
+
+
+            if (textView == null) {
+                return;
+            }
+
+            String s = textView.getText().toString();
+            if (!s.contains("銆�")) {
+                return;
+            }
+
+            int startIndex1 = s.indexOf("銆�");
+            int endIndex1 = s.indexOf("銆�") + 1;
+
+
+            int startIndex2 = s.lastIndexOf("銆�");
+            int endIndex2 = s.lastIndexOf("銆�") + 1;
+            if (UserConfigManage.getInstance().getCurrentAppLanguage().equals(LocalManageUtil.en)) {
+                s = s.replace("銆�", "").replace("銆�", "");
+                endIndex1 -= 1;
+                startIndex2 -= 2;//绉婚櫎"銆�"鍜�"銆�"鎬婚暱搴﹀彂鐢熷彉鍖栵紝绱㈠紩涔熸敼鍙�;
+                endIndex2 -= 4;//绉婚櫎"銆�"鍜�"銆�"鎬婚暱搴﹀彂鐢熷彉鍖栵紝绱㈠紩涔熸敼鍙�;
+            }
+            SpannableStringBuilder spannable = new SpannableStringBuilder(s);
+            //璁剧疆鏂囧瓧鐨勫墠鏅壊
+            if (textView.getTag() != null && textView.getTag().toString().equals("click")) {
+                spannable.setSpan(new ClickableSpan() {
+                    @Override
+                    public void onClick(@NonNull View widget) {
+                        //todo 闇�瑕佽烦杞埌鏈嶅姟鍗忚鐣岄潰
+                        Intent intent = new Intent();
+                        intent.putExtra("type", WebActivity.ServiceAgreement);
+                        intent.setClass(_mActivity, WebActivity.class);
+                        startActivity(intent);
+                    }
+
+                    @Override
+                    public void updateDrawState(@NonNull TextPaint ds) {
+                        super.updateDrawState(ds);
+                        //璁剧疆瀛椾綋棰滆壊
+                        ds.setColor(getResources().getColor(R.color.text_E6FFFFFF, null));
+                        // 鍘绘帀涓嬪垝绾�
+                        ds.setUnderlineText(!UserConfigManage.getInstance().isZh());
+                    }
+
+
+                }, startIndex1, endIndex1, 0);
+//                spannable.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), startIndex1, endIndex1, 0);
+
+                spannable.setSpan(new ClickableSpan() {
+                    @Override
+                    public void onClick(@NonNull View widget) {
+                        //todo 闇�瑕佽烦杞埌闅愮鐣岄潰
+                        Intent intent = new Intent();
+                        intent.putExtra("type", WebActivity.PrivacyAgreement);
+                        intent.setClass(_mActivity, WebActivity.class);
+                        startActivity(intent);
+                    }
+
+                    @Override
+                    public void updateDrawState(@NonNull TextPaint ds) {
+                        super.updateDrawState(ds);
+                        //璁剧疆瀛椾綋棰滆壊
+                        ds.setColor(getResources().getColor(R.color.text_E6FFFFFF, null));
+                        // 鍘绘帀涓嬪垝绾�
+                        ds.setUnderlineText(!UserConfigManage.getInstance().isZh());
+                    }
+
+
+                }, startIndex2, endIndex2, 0);
+//                spannable.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), startIndex2, endIndex2, 0);
+
+
+            }
+            textView.setText(spannable);
+            //涓�旈亣鍒扮偣鍑诲悗瀛椾綋鏄剧ず楂樹寒锛屽彇娑堥珮浜�
+            textView.setHighlightColor(getResources().getColor(R.color.text_66FFFFFF, null));
+            //鏈�鍚庤缃彲鐐瑰嚮锛屽繀椤诲疄鐜帮紝鍚﹀垯鍙兘鏄剧ず鏍峰紡锛屾棤娉曞疄鐜扮偣鍑绘晥鏋�
+            textView.setMovementMethod(LinkMovementMethod.getInstance());
+        } catch (Exception ignored) {
+        }
+
+    }
+
 
 }
diff --git a/app/src/main/res/layout/dialog_confirm_cancel.xml b/app/src/main/res/layout/dialog_confirm_cancel.xml
index d29cfee..064a519 100644
--- a/app/src/main/res/layout/dialog_confirm_cancel.xml
+++ b/app/src/main/res/layout/dialog_confirm_cancel.xml
@@ -37,7 +37,7 @@
             android:layout_width="0dp"
             android:layout_height="wrap_content"
             android:layout_marginStart="@dimen/dp_20"
-            android:layout_marginTop="@dimen/dp_25"
+            android:layout_marginTop="@dimen/dp_20"
             android:layout_marginEnd="@dimen/dp_20"
             android:layout_marginBottom="@dimen/dp_25"
             android:gravity="center"
@@ -45,6 +45,7 @@
             android:tag="click"
             android:textColor="@color/text_66FFFFFF"
             android:textSize="@dimen/text_14"
+            android:lineSpacingExtra="@dimen/dp_2"
             app:layout_constraintBottom_toTopOf="@+id/dialog_confirm_bottom_line_ly"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintStart_toStartOf="parent"
diff --git a/app/src/main/res/values-en/strings.xml b/app/src/main/res/values-en/strings.xml
index 34764c7..d0044ef 100644
--- a/app/src/main/res/values-en/strings.xml
+++ b/app/src/main/res/values-en/strings.xml
@@ -336,5 +336,8 @@
     <string name="camera_storage_instructions">Camera and Storage Permission Usage Instructions:</string>
     <string name="camera_storage_purpose">Used for scanning codes, taking photos, uploading pictures from albums, reading and writing photos on devices, and other scenarios</string>
     <string name="set_location_permissions">Please go to set open location permissions</string>
+    <string name="agree">Agree</string>
+    <string name="user_agreement_and_privacy_agreement">User Agreement and Privacy Agreement</string>
+    <string name="thank_you_for_using">Thank you for using Xenterra Solar. During your use, we may collect and use some of your personal information. Please read carefully, and ensure that you fully understand our rules for handling your personal information. If you agree to the 銆奤ser Agreement銆� and 銆奝rivacy Agreement銆�, please click "Agree" to start using Xenterra Solar.</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 0d90988..3c80b20 100644
--- a/app/src/main/res/values-zh/strings.xml
+++ b/app/src/main/res/values-zh/strings.xml
@@ -333,6 +333,9 @@
     <string name="camera_storage_instructions">鐩告満銆佸瓨鍌ㄦ潈闄愪娇鐢ㄨ鏄庯細</string>
     <string name="camera_storage_purpose">鐢ㄤ簬鎵爜銆佹媿鐓с�佷粠鐩稿唽涓婁紶鍥剧墖銆佽鍐欒澶囦笂鐨勭収鐗囩瓑鍦烘櫙</string>
     <string name="set_location_permissions">璇峰墠寰�璁剧疆鎵撳紑浣嶇疆鏉冮檺</string>
+    <string name="agree">鍚屾剰</string>
+    <string name="user_agreement_and_privacy_agreement">鐢ㄦ埛鍗忚鍜岄殣绉佸崗璁�</string>
+    <string name="thank_you_for_using">鎰熻阿鎮ㄤ娇鐢ㄦ柊鐗归攼鑳� App锛屽湪鎮ㄤ娇鐢ㄨ繃绋嬩腑锛屾垜浠彲鑳戒細瀵规偍鐨勯儴鍒嗕釜浜轰俊鎭繘琛屾敹闆嗐�佷娇鐢�,璇锋偍浠旂粏闃呰銆婄敤鎴峰崗璁�嬪拰銆婇殣绉佸崗璁�嬶紝骞剁‘瀹氬畬鍏ㄤ簡瑙f垜浠鎮ㄤ釜浜轰俊鎭殑澶勭悊瑙勫垯銆傚鎮ㄥ悓鎰忕敤鎴峰崗璁拰闅愮鍗忚锛岃鐐瑰嚮鈥滃悓鎰忊�濓紝寮�濮嬩娇鐢ㄦ柊鐗归攼鑳� App銆�</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 4b23b89..ee51300 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -333,6 +333,9 @@
     <string name="camera_storage_instructions">鐩告満銆佸瓨鍌ㄦ潈闄愪娇鐢ㄨ鏄庯細</string>
     <string name="camera_storage_purpose">鐢ㄤ簬鎵爜銆佹媿鐓с�佷粠鐩稿唽涓婁紶鍥剧墖銆佽鍐欒澶囦笂鐨勭収鐗囩瓑鍦烘櫙</string>
     <string name="set_location_permissions">璇峰墠寰�璁剧疆鎵撳紑浣嶇疆鏉冮檺</string>
+    <string name="agree">鍚屾剰</string>
+    <string name="user_agreement_and_privacy_agreement">鐢ㄦ埛鍗忚鍜岄殣绉佸崗璁�</string>
+    <string name="thank_you_for_using">鎰熻阿鎮ㄤ娇鐢ㄦ柊鐗归攼鑳� App锛屽湪鎮ㄤ娇鐢ㄨ繃绋嬩腑锛屾垜浠彲鑳戒細瀵规偍鐨勯儴鍒嗕釜浜轰俊鎭繘琛屾敹闆嗐�佷娇鐢�,璇锋偍浠旂粏闃呰銆婄敤鎴峰崗璁�嬪拰銆婇殣绉佸崗璁�嬶紝骞剁‘瀹氬畬鍏ㄤ簡瑙f垜浠鎮ㄤ釜浜轰俊鎭殑澶勭悊瑙勫垯銆傚鎮ㄥ悓鎰忕敤鎴峰崗璁拰闅愮鍗忚锛岃鐐瑰嚮鈥滃悓鎰忊�濓紝寮�濮嬩娇鐢ㄦ柊鐗归攼鑳� App銆�</string>
 
 
 </resources>
\ No newline at end of file

--
Gitblit v1.8.0