From de2d3696f975cf6e6df2e580bab305fa9859feea Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期四, 26 十月 2023 17:55:36 +0800
Subject: [PATCH] 2023年10月26日17:55:33
---
app/src/main/java/com/hdl/photovoltaic/ui/HomeLoginActivity.java | 103 ++++++++++++++++++++++++++++-----------------------
1 files changed, 56 insertions(+), 47 deletions(-)
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/HomeLoginActivity.java b/app/src/main/java/com/hdl/photovoltaic/ui/HomeLoginActivity.java
index 9f38e75..f9ca155 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/HomeLoginActivity.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/HomeLoginActivity.java
@@ -11,7 +11,6 @@
import android.text.method.HideReturnsTransformationMethod;
import android.text.method.PasswordTransformationMethod;
import android.text.style.ForegroundColorSpan;
-import android.util.Log;
import android.view.View;
import android.widget.TextView;
@@ -96,33 +95,7 @@
private void initEvent() {
- viewBinding.homeLoginAccountEt.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) {
- Log.d("HomeLoginActivity2", String.format("CharSequence=%s,start=%s,before=%s,count=%s", s, start, before, count));
-
- }
-
- @Override
- public void afterTextChanged(Editable s) {
- if (s.length() > 0) {
- if (viewBinding.homeLoginClearContentsIv.getVisibility() == View.GONE) {
- viewBinding.homeLoginClearContentsIv.setVisibility(View.VISIBLE);
- }
- } else {
- if (viewBinding.homeLoginClearContentsIv.getVisibility() == View.VISIBLE) {
- viewBinding.homeLoginClearContentsIv.setVisibility(View.GONE);
- }
- }
- isLoginTextViewEnabled();
-
- }
- });
+ viewBinding.homeLoginAccountEt.addTextChangedListener(accountTextWatcher);
viewBinding.homeLoginClearContentsIv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -130,22 +103,7 @@
}
});
- viewBinding.homeLoginPasswordEt.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) {
-
- }
-
- @Override
- public void afterTextChanged(Editable s) {
- isLoginTextViewEnabled();
- }
- });
+ viewBinding.homeLoginPasswordEt.addTextChangedListener(passwordTextWatcher);
viewBinding.homeLoginHideIv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -215,7 +173,7 @@
// //闅愮鍗忚鎻愮ず
// return;
// }
- showLoading(getString(R.string.home_login_鐧诲綍涓�));
+ showLoading(getString(R.string.home_login_be_logging_in));
HdlAccountLogic.getInstance().regionByAccount(account, new CloudCallBeak<HDLUserRegionBean>() {
@Override
public void onSuccess(HDLUserRegionBean obj) {
@@ -311,12 +269,12 @@
private boolean isLocalCheckAccountAndPassword(String account, String password) {
if (TextUtils.isEmpty(account)) {
viewBinding.homeLoginLine1V.setBackgroundColor(getColor(R.color.text_D34545));
- viewBinding.homeLoginAccountTextErrorTv.setText(R.string.home_login_error_璐﹀彿涓嶈兘涓虹┖);
+ viewBinding.homeLoginAccountTextErrorTv.setText(R.string.home_login_error_account_null);
return false;
}
if (TextUtils.isEmpty(password)) {
viewBinding.homeLoginLine2V.setBackgroundColor(getColor(R.color.text_D34545));
- viewBinding.homeLoginPasswordTextErrorTv.setText(R.string.home_login_error_瀵嗙爜涓嶈兘涓虹┖);
+ viewBinding.homeLoginPasswordTextErrorTv.setText(R.string.home_login_error_password_null);
return false;
}
@@ -359,5 +317,56 @@
view.setText(spannable);
}
+ /**
+ * 杈撳叆璐﹀彿
+ */
+ 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) {
+ }
+
+ @Override
+ public void afterTextChanged(Editable s) {
+ if (s.length() > 0) {
+ if (viewBinding.homeLoginClearContentsIv.getVisibility() == View.GONE) {
+ viewBinding.homeLoginClearContentsIv.setVisibility(View.VISIBLE);
+ }
+ } else {
+ if (viewBinding.homeLoginClearContentsIv.getVisibility() == View.VISIBLE) {
+ viewBinding.homeLoginClearContentsIv.setVisibility(View.GONE);
+ }
+ }
+ isLoginTextViewEnabled();
+ }
+ };
+ /**
+ * 杈撳叆瀵嗙爜
+ */
+ private final TextWatcher passwordTextWatcher = 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) {
+ }
+
+ @Override
+ public void afterTextChanged(Editable s) {
+ isLoginTextViewEnabled();
+ }
+ };
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ viewBinding.homeLoginAccountEt.removeTextChangedListener(accountTextWatcher);
+ viewBinding.homeLoginPasswordEt.removeTextChangedListener(passwordTextWatcher);
+ }
}
\ No newline at end of file
--
Gitblit v1.8.0