From 6139d9d4b4d42d43039fc5cec7c064d9cc20725b Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期四, 19 十月 2023 17:10:37 +0800
Subject: [PATCH] 2023年10月19日17:10:30

---
 app/src/main/java/com/hdl/photovoltaic/ui/account/RegisterAccountActivity.java |  188 +++++++++++++++++++++++++++--------------------
 1 files changed, 108 insertions(+), 80 deletions(-)

diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/account/RegisterAccountActivity.java b/app/src/main/java/com/hdl/photovoltaic/ui/account/RegisterAccountActivity.java
index 0a099e0..6da6dac 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/account/RegisterAccountActivity.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/account/RegisterAccountActivity.java
@@ -143,22 +143,7 @@
         });
 
         //杈撳叆瀵嗙爜
-        viewBinding.registerPswEt.addTextChangedListener(new TextWatcher() {
-            @Override
-            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
-
-            }
-
-            @Override
-            public void onTextChanged(CharSequence s, int start, int before, int count) {
-                isCompleteEnabled();
-            }
-
-            @Override
-            public void afterTextChanged(Editable s) {
-
-            }
-        });
+        viewBinding.registerPswEt.addTextChangedListener(changePswTextWatcher);
         //瀵嗙爜鏄剧ず鎴栬�呴殣钘�
         viewBinding.registerPswHideIv.setOnClickListener(new View.OnClickListener() {
             @Override
@@ -180,22 +165,7 @@
             }
         });
         //杈撳叆纭瀵嗙爜
-        viewBinding.registerConfirmPswEt.addTextChangedListener(new TextWatcher() {
-            @Override
-            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
-
-            }
-
-            @Override
-            public void onTextChanged(CharSequence s, int start, int before, int count) {
-                isCompleteEnabled();
-            }
-
-            @Override
-            public void afterTextChanged(Editable s) {
-
-            }
-        });
+        viewBinding.registerConfirmPswEt.addTextChangedListener(changeConfirmPswTextWatcher);
         //纭瀵嗙爜鏄剧ず鎴栬�呴殣钘�
         viewBinding.registerConfirmPswHideIv.setOnClickListener(new View.OnClickListener() {
             @Override
@@ -216,22 +186,7 @@
             }
         });
         //杈撳叆鎵嬫満鍙锋垨鑰呴偖绠�
-        viewBinding.registerAccountEt.addTextChangedListener(new TextWatcher() {
-            @Override
-            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
-
-            }
-
-            @Override
-            public void onTextChanged(CharSequence s, int start, int before, int count) {
-                isCompleteEnabled();
-            }
-
-            @Override
-            public void afterTextChanged(Editable s) {
-
-            }
-        });
+        viewBinding.registerAccountEt.addTextChangedListener(accountTextWatcher);
         //鎵嬫満鍙疯幏鍙栭獙璇佺爜
         viewBinding.registerPhoneVerificationTv.setOnClickListener(new View.OnClickListener() {
             @Override
@@ -241,22 +196,7 @@
             }
         });
         //杈撳叆鎵嬫満楠岃瘉鐮�
-        viewBinding.registerPhoneVerificationEt.addTextChangedListener(new TextWatcher() {
-            @Override
-            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
-
-            }
-
-            @Override
-            public void onTextChanged(CharSequence s, int start, int before, int count) {
-                isCompleteEnabled();
-            }
-
-            @Override
-            public void afterTextChanged(Editable s) {
-
-            }
-        });
+        viewBinding.registerPhoneVerificationEt.addTextChangedListener(phoneVerificationTextWatcher);
         //閭鑾峰彇楠岃瘉鐮�
         viewBinding.registerMailVerificationTv.setOnClickListener(new View.OnClickListener() {
             @Override
@@ -266,22 +206,7 @@
             }
         });
         //杈撳叆閭楠岃瘉鐮�
-        viewBinding.registerMailVerificationEt.addTextChangedListener(new TextWatcher() {
-            @Override
-            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
-
-            }
-
-            @Override
-            public void onTextChanged(CharSequence s, int start, int before, int count) {
-                isCompleteEnabled();
-            }
-
-            @Override
-            public void afterTextChanged(Editable s) {
-
-            }
-        });
+        viewBinding.registerMailVerificationEt.addTextChangedListener(mailVerificationTextWatcher);
         //娉ㄥ唽璐﹀彿
         viewBinding.registerCompleteTv.setOnClickListener(new View.OnClickListener() {
             @Override
@@ -551,5 +476,108 @@
             mailCountDownTimer.cancel();
             mailCountDownTimer = null;
         }
+        viewBinding.registerAccountEt.removeTextChangedListener(accountTextWatcher);
+        viewBinding.registerPhoneVerificationEt.removeTextChangedListener(phoneVerificationTextWatcher);
+        viewBinding.registerMailVerificationEt.removeTextChangedListener(mailVerificationTextWatcher);
+        viewBinding.registerPswEt.removeTextChangedListener(changePswTextWatcher);
+        viewBinding.registerConfirmPswEt.removeTextChangedListener(changeConfirmPswTextWatcher);
     }
+
+    /**
+     * 杈撳叆鎵嬫満鍙锋垨鑰呴偖绠�
+     */
+    private final TextWatcher accountTextWatcher = new TextWatcher() {
+        @Override
+        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+
+        }
+
+        @Override
+        public void onTextChanged(CharSequence s, int start, int before, int count) {
+            isCompleteEnabled();
+        }
+
+        @Override
+        public void afterTextChanged(Editable s) {
+
+        }
+    };
+    /**
+     * 杈撳叆鎵嬫満楠岃瘉鐮�
+     */
+    private final TextWatcher phoneVerificationTextWatcher = new TextWatcher() {
+        @Override
+        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+
+        }
+
+        @Override
+        public void onTextChanged(CharSequence s, int start, int before, int count) {
+            isCompleteEnabled();
+        }
+
+        @Override
+        public void afterTextChanged(Editable s) {
+
+        }
+    };
+
+    /**
+     * 閭鑾峰彇楠岃瘉鐮�
+     */
+    private final TextWatcher mailVerificationTextWatcher = new TextWatcher() {
+        @Override
+        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+
+        }
+
+        @Override
+        public void onTextChanged(CharSequence s, int start, int before, int count) {
+            isCompleteEnabled();
+        }
+
+        @Override
+        public void afterTextChanged(Editable s) {
+
+        }
+    };
+
+    /**
+     * 杈撳叆瀵嗙爜
+     */
+    private final TextWatcher changePswTextWatcher = new TextWatcher() {
+        @Override
+        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+
+        }
+
+        @Override
+        public void onTextChanged(CharSequence s, int start, int before, int count) {
+            isCompleteEnabled();
+        }
+
+        @Override
+        public void afterTextChanged(Editable s) {
+
+        }
+    };
+    /**
+     * 杈撳叆纭瀵嗙爜
+     */
+    private final TextWatcher changeConfirmPswTextWatcher = new TextWatcher() {
+        @Override
+        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+
+        }
+
+        @Override
+        public void onTextChanged(CharSequence s, int start, int before, int count) {
+            isCompleteEnabled();
+        }
+
+        @Override
+        public void afterTextChanged(Editable s) {
+
+        }
+    };
 }
\ No newline at end of file

--
Gitblit v1.8.0