优化
This commit is contained in:
@@ -9,9 +9,13 @@ import android.graphics.drawable.AnimationDrawable;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
|
import android.text.InputType;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.text.method.PasswordTransformationMethod;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
import com.ckkj.water.ConstantUtil;
|
import com.ckkj.water.ConstantUtil;
|
||||||
import com.ckkj.water.R;
|
import com.ckkj.water.R;
|
||||||
@@ -46,6 +50,8 @@ public class SelectWifiActivity extends BaseActivity<DeviceResetWifiBinding, Dev
|
|||||||
implements DeviceContract.DeviceView {
|
implements DeviceContract.DeviceView {
|
||||||
|
|
||||||
private static final long BLE_CONNECT_TIMEOUT = 40 * 1000L;
|
private static final long BLE_CONNECT_TIMEOUT = 40 * 1000L;
|
||||||
|
//当前密码显示/隐藏
|
||||||
|
private boolean isPasswordVisible = false;
|
||||||
|
|
||||||
private WifiListAdapter wifiListAdapter;
|
private WifiListAdapter wifiListAdapter;
|
||||||
//100 来自设备添加, 200 来自设备信息
|
//100 来自设备添加, 200 来自设备信息
|
||||||
@@ -166,6 +172,7 @@ public class SelectWifiActivity extends BaseActivity<DeviceResetWifiBinding, Dev
|
|||||||
setClick(viewBinding.includedTitle.imgBack);
|
setClick(viewBinding.includedTitle.imgBack);
|
||||||
setClick(viewBinding.tvSelectWifi);
|
setClick(viewBinding.tvSelectWifi);
|
||||||
setClick(viewBinding.tvNext);
|
setClick(viewBinding.tvNext);
|
||||||
|
setClick(viewBinding.imgPsdShowHide);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setClick(View view) {
|
private void setClick(View view) {
|
||||||
@@ -210,9 +217,38 @@ public class SelectWifiActivity extends BaseActivity<DeviceResetWifiBinding, Dev
|
|||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case R.id.img_psd_show_hide:
|
||||||
|
togglePasswordVisibility();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void togglePasswordVisibility() {
|
||||||
|
EditText etPassword = viewBinding.etInputPsd;
|
||||||
|
ImageView ivToggle = viewBinding.imgPsdShowHide;
|
||||||
|
|
||||||
|
if (etPassword == null || ivToggle == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isPasswordVisible) {
|
||||||
|
// 隐藏密码
|
||||||
|
etPassword.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
|
||||||
|
etPassword.setTransformationMethod(PasswordTransformationMethod.getInstance());
|
||||||
|
ivToggle.setImageResource(R.mipmap.icon_psd_hide);
|
||||||
|
} else {
|
||||||
|
// 显示密码
|
||||||
|
etPassword.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
|
||||||
|
etPassword.setTransformationMethod(null);
|
||||||
|
ivToggle.setImageResource(R.mipmap.icon_psd_show);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保持光标位置
|
||||||
|
etPassword.setSelection(etPassword.getText().length());
|
||||||
|
isPasswordVisible = !isPasswordVisible;
|
||||||
|
}
|
||||||
|
|
||||||
private void goToDeviceConnect(String wifiPassword) {
|
private void goToDeviceConnect(String wifiPassword) {
|
||||||
if (espProvisionManager == null) {
|
if (espProvisionManager == null) {
|
||||||
initEspProvision();
|
initEspProvision();
|
||||||
|
|||||||
@@ -564,6 +564,10 @@ public class WaterConfigFragment extends BaseFragment<WaterConfigFragmentLayoutC
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConfirmClisk(String content) {
|
public void onConfirmClisk(String content) {
|
||||||
|
if(TextUtils.isEmpty(content)){
|
||||||
|
ToastUtil.showShort(mContext, getString(R.string.input_water_plan_time_error));
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (Integer.parseInt(content) <= 0) {
|
if (Integer.parseInt(content) <= 0) {
|
||||||
ToastUtil.showShort(mContext, getString(R.string.input_water_plan_time_error));
|
ToastUtil.showShort(mContext, getString(R.string.input_water_plan_time_error));
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -91,14 +91,22 @@
|
|||||||
android:src="@mipmap/icon_phone_code"/>
|
android:src="@mipmap/icon_phone_code"/>
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/et_input_psd"
|
android:id="@+id/et_input_psd"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="8"
|
||||||
android:layout_marginLeft="@dimen/dp_5"
|
android:layout_marginLeft="@dimen/dp_5"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
|
android:inputType="textPassword"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textColorHint="@color/textPrimaryColor"
|
android:textColorHint="@color/textPrimaryColor"
|
||||||
android:textColor="@color/textPrimaryColor"
|
android:textColor="@color/textPrimaryColor"
|
||||||
android:hint="@string/input_wifi_psd_tip"/>
|
android:hint="@string/input_wifi_psd_tip"/>
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/img_psd_show_hide"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:layout_weight="0.5"
|
||||||
|
android:src="@mipmap/icon_psd_hide"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -106,6 +106,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginLeft="5dp"
|
||||||
|
android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textColor="@color/color_222222"
|
android:textColor="@color/color_222222"
|
||||||
@@ -133,6 +134,7 @@
|
|||||||
android:layout_weight="2"
|
android:layout_weight="2"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginLeft="5dp"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
|
android:inputType="number"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textColor="@color/color_222222"
|
android:textColor="@color/color_222222"
|
||||||
android:hint="@string/hint_input_verifi"/>
|
android:hint="@string/hint_input_verifi"/>
|
||||||
@@ -178,7 +180,7 @@
|
|||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/img_psd_show_hide"
|
android:id="@+id/img_psd_show_hide"
|
||||||
android:layout_width="24dp"
|
android:layout_width="24dp"
|
||||||
android:layout_height="24dp"
|
android:layout_height="20dp"
|
||||||
android:layout_weight="0.5"
|
android:layout_weight="0.5"
|
||||||
android:src="@mipmap/icon_psd_hide"/>
|
android:src="@mipmap/icon_psd_hide"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
@@ -43,6 +43,7 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginLeft="@dimen/dp_5"
|
android:layout_marginLeft="@dimen/dp_5"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
|
android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textColor="@color/text_hint_theme_color"
|
android:textColor="@color/text_hint_theme_color"
|
||||||
android:textColorHint="@color/text_hint_theme_color"
|
android:textColorHint="@color/text_hint_theme_color"
|
||||||
@@ -70,6 +71,7 @@
|
|||||||
android:layout_weight="2"
|
android:layout_weight="2"
|
||||||
android:layout_marginLeft="@dimen/dp_5"
|
android:layout_marginLeft="@dimen/dp_5"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
|
android:inputType="number"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textColor="@color/text_hint_theme_color"
|
android:textColor="@color/text_hint_theme_color"
|
||||||
android:textColorHint="@color/text_hint_theme_color"
|
android:textColorHint="@color/text_hint_theme_color"
|
||||||
@@ -112,11 +114,11 @@
|
|||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textColor="@color/text_hint_theme_color"
|
android:textColor="@color/text_hint_theme_color"
|
||||||
android:textColorHint="@color/text_hint_theme_color"
|
android:textColorHint="@color/text_hint_theme_color"
|
||||||
android:hint="@string/hint_input_psd"/>
|
android:hint="@string/hint_input_new_psd"/>
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/img_psd_show_hide"
|
android:id="@+id/img_psd_show_hide"
|
||||||
android:layout_width="24dp"
|
android:layout_width="24dp"
|
||||||
android:layout_height="24dp"
|
android:layout_height="20dp"
|
||||||
android:layout_weight="0.5"
|
android:layout_weight="0.5"
|
||||||
android:src="@mipmap/icon_psd_hide"/>
|
android:src="@mipmap/icon_psd_hide"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -146,11 +148,11 @@
|
|||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textColor="@color/text_hint_theme_color"
|
android:textColor="@color/text_hint_theme_color"
|
||||||
android:textColorHint="@color/text_hint_theme_color"
|
android:textColorHint="@color/text_hint_theme_color"
|
||||||
android:hint="@string/hint_input_psd_agin"/>
|
android:hint="@string/hint_input_new_psd_agin"/>
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/img_psd_show_hide_agin"
|
android:id="@+id/img_psd_show_hide_agin"
|
||||||
android:layout_width="24dp"
|
android:layout_width="24dp"
|
||||||
android:layout_height="24dp"
|
android:layout_height="20dp"
|
||||||
android:layout_weight="0.5"
|
android:layout_weight="0.5"
|
||||||
android:src="@mipmap/icon_psd_hide"/>
|
android:src="@mipmap/icon_psd_hide"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="@dimen/dp_5"
|
android:layout_marginLeft="@dimen/dp_5"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
|
android:inputType="textPassword"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textColor="@color/text_hint_theme_color"
|
android:textColor="@color/text_hint_theme_color"
|
||||||
android:textColorHint="@color/text_hint_theme_color"
|
android:textColorHint="@color/text_hint_theme_color"
|
||||||
@@ -58,6 +59,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="@dimen/dp_5"
|
android:layout_marginLeft="@dimen/dp_5"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
|
android:inputType="textPassword"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textColor="@color/text_hint_theme_color"
|
android:textColor="@color/text_hint_theme_color"
|
||||||
android:textColorHint="@color/text_hint_theme_color"
|
android:textColorHint="@color/text_hint_theme_color"
|
||||||
@@ -84,6 +86,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="@dimen/dp_5"
|
android:layout_marginLeft="@dimen/dp_5"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
|
android:inputType="textPassword"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textColor="@color/text_hint_theme_color"
|
android:textColor="@color/text_hint_theme_color"
|
||||||
android:textColorHint="@color/text_hint_theme_color"
|
android:textColorHint="@color/text_hint_theme_color"
|
||||||
|
|||||||
Reference in New Issue
Block a user