优化密码相关,隐藏/显示
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
package com.ckkj.water.mine;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.text.InputType;
|
||||
import android.text.TextUtils;
|
||||
import android.text.method.PasswordTransformationMethod;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.ckkj.water.R;
|
||||
import com.ckkj.water.base.BaseActivity;
|
||||
@@ -25,6 +29,10 @@ import com.gyf.immersionbar.ImmersionBar;
|
||||
public class ResetPsdActivity extends BaseActivity<ResetPsdLayoutBinding, MinePresenter>
|
||||
implements MineContract.MineView {
|
||||
|
||||
private boolean isOldPasswordVisible = false;
|
||||
private boolean isNewPasswordVisible = false;
|
||||
private boolean isConfirmPasswordVisible = false;
|
||||
|
||||
@Override
|
||||
public void initData(Bundle savedInstanceState) {
|
||||
super.initData(savedInstanceState);
|
||||
@@ -41,6 +49,9 @@ public class ResetPsdActivity extends BaseActivity<ResetPsdLayoutBinding, MinePr
|
||||
private void initListener() {
|
||||
setClick(viewBinding.includedTitle.imgBack);
|
||||
setClick(viewBinding.tvCommit);
|
||||
setClick(viewBinding.imgPsdShowHideOld);
|
||||
setClick(viewBinding.imgPsdShowHideNew1);
|
||||
setClick(viewBinding.imgPsdShowHideNew2);
|
||||
}
|
||||
|
||||
private void setClick(View view) {
|
||||
@@ -78,9 +89,45 @@ public class ResetPsdActivity extends BaseActivity<ResetPsdLayoutBinding, MinePr
|
||||
mPresenter.updateUserPsdByOld(viewBinding.etCurrentPsd.getText().toString(),
|
||||
viewBinding.etInputConfirmPsd.getText().toString());
|
||||
break;
|
||||
|
||||
case R.id.img_psd_show_hide_old:
|
||||
togglePasswordVisibility(viewBinding.etCurrentPsd, viewBinding.imgPsdShowHideOld,
|
||||
isOldPasswordVisible);
|
||||
isOldPasswordVisible = !isOldPasswordVisible;
|
||||
break;
|
||||
|
||||
case R.id.img_psd_show_hide_new1:
|
||||
togglePasswordVisibility(viewBinding.etNewPsd, viewBinding.imgPsdShowHideNew1,
|
||||
isNewPasswordVisible);
|
||||
isNewPasswordVisible = !isNewPasswordVisible;
|
||||
break;
|
||||
|
||||
case R.id.img_psd_show_hide_new2:
|
||||
togglePasswordVisibility(viewBinding.etInputConfirmPsd, viewBinding.imgPsdShowHideNew2,
|
||||
isConfirmPasswordVisible);
|
||||
isConfirmPasswordVisible = !isConfirmPasswordVisible;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void togglePasswordVisibility(EditText editText, ImageView imageView, boolean isVisible) {
|
||||
if (editText == null || imageView == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isVisible) {
|
||||
editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
|
||||
editText.setTransformationMethod(PasswordTransformationMethod.getInstance());
|
||||
imageView.setImageResource(R.mipmap.icon_psd_hide);
|
||||
} else {
|
||||
editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
|
||||
editText.setTransformationMethod(null);
|
||||
imageView.setImageResource(R.mipmap.icon_psd_show);
|
||||
}
|
||||
|
||||
editText.setSelection(editText.getText().length());
|
||||
}
|
||||
|
||||
/**
|
||||
* 密码重置成功
|
||||
* @param bean
|
||||
|
||||
@@ -38,6 +38,7 @@ import com.yanzhenjie.recyclerview.widget.DefaultItemDecoration;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@@ -524,6 +525,18 @@ public class WaterConfigFragment extends BaseFragment<WaterConfigFragmentLayoutC
|
||||
*/
|
||||
private void selectStartTime(int position) {
|
||||
boolean times[] = {false, false, false, true, true, false};
|
||||
Calendar selectedTime = Calendar.getInstance();
|
||||
String startTime = weekList.get(mWeekAdapter.getmPos()).getTimeData().get(position).getStartTime();
|
||||
if (!TextUtils.isEmpty(startTime)) {
|
||||
try {
|
||||
SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm", Locale.getDefault());
|
||||
timeFormat.setLenient(false);
|
||||
Date date = timeFormat.parse(startTime);
|
||||
selectedTime.set(Calendar.HOUR_OF_DAY, date.getHours());
|
||||
selectedTime.set(Calendar.MINUTE, date.getMinutes());
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
//时间选择器
|
||||
TimePickerView pvTime = new TimePickerBuilder(mContext, new OnTimeSelectListener() {
|
||||
@Override
|
||||
@@ -537,6 +550,7 @@ public class WaterConfigFragment extends BaseFragment<WaterConfigFragmentLayoutC
|
||||
.setCancelColor(mContext.getColor(R.color.color_999999))
|
||||
.setSubmitColor(mContext.getColor(R.color.color_zhu))
|
||||
.setTextColorCenter(mContext.getColor(R.color.color_zhu))
|
||||
.setDate(selectedTime)
|
||||
.build();
|
||||
pvTime.show();
|
||||
}
|
||||
|
||||
@@ -135,6 +135,7 @@
|
||||
android:layout_marginLeft="5dp"
|
||||
android:background="@null"
|
||||
android:inputType="number"
|
||||
android:maxLength="6"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/color_222222"
|
||||
android:hint="@string/hint_input_verifi"/>
|
||||
@@ -174,6 +175,7 @@
|
||||
android:layout_marginLeft="5dp"
|
||||
android:background="@null"
|
||||
android:textSize="14sp"
|
||||
android:maxLength="16"
|
||||
android:textColor="@color/color_222222"
|
||||
android:hint="@string/hint_input_psd"
|
||||
android:inputType="textPassword"/>
|
||||
|
||||
@@ -72,6 +72,7 @@
|
||||
android:layout_marginLeft="@dimen/dp_5"
|
||||
android:background="@null"
|
||||
android:inputType="number"
|
||||
android:maxLength="6"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/text_hint_theme_color"
|
||||
android:textColorHint="@color/text_hint_theme_color"
|
||||
@@ -111,6 +112,7 @@
|
||||
android:layout_marginLeft="@dimen/dp_5"
|
||||
android:background="@null"
|
||||
android:inputType="textPassword"
|
||||
android:maxLength="16"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/text_hint_theme_color"
|
||||
android:textColorHint="@color/text_hint_theme_color"
|
||||
@@ -145,6 +147,7 @@
|
||||
android:layout_marginLeft="@dimen/dp_5"
|
||||
android:inputType="textPassword"
|
||||
android:background="@null"
|
||||
android:maxLength="16"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/text_hint_theme_color"
|
||||
android:textColorHint="@color/text_hint_theme_color"
|
||||
|
||||
@@ -29,15 +29,23 @@
|
||||
android:src="@mipmap/icon_psd"/>
|
||||
<EditText
|
||||
android:id="@+id/et_current_psd"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="8"
|
||||
android:layout_marginLeft="@dimen/dp_5"
|
||||
android:background="@null"
|
||||
android:inputType="textPassword"
|
||||
android:maxLength="16"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/text_hint_theme_color"
|
||||
android:textColorHint="@color/text_hint_theme_color"
|
||||
android:hint="@string/hint_input_old_psd"/>
|
||||
<ImageView
|
||||
android:id="@+id/img_psd_show_hide_old"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_weight="0.5"
|
||||
android:src="@mipmap/icon_psd_hide"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@@ -55,15 +63,23 @@
|
||||
android:src="@mipmap/icon_psd"/>
|
||||
<EditText
|
||||
android:id="@+id/et_new_psd"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="8"
|
||||
android:layout_marginLeft="@dimen/dp_5"
|
||||
android:background="@null"
|
||||
android:inputType="textPassword"
|
||||
android:maxLength="16"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/text_hint_theme_color"
|
||||
android:textColorHint="@color/text_hint_theme_color"
|
||||
android:hint="@string/hint_input_new_psd"/>
|
||||
<ImageView
|
||||
android:id="@+id/img_psd_show_hide_new1"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_weight="0.5"
|
||||
android:src="@mipmap/icon_psd_hide"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@@ -82,15 +98,23 @@
|
||||
android:src="@mipmap/icon_psd"/>
|
||||
<EditText
|
||||
android:id="@+id/et_input_confirm_psd"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="8"
|
||||
android:layout_marginLeft="@dimen/dp_5"
|
||||
android:background="@null"
|
||||
android:inputType="textPassword"
|
||||
android:maxLength="16"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/text_hint_theme_color"
|
||||
android:textColorHint="@color/text_hint_theme_color"
|
||||
android:hint="@string/hint_input_new_psd_agin"/>
|
||||
<ImageView
|
||||
android:id="@+id/img_psd_show_hide_new2"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_weight="0.5"
|
||||
android:src="@mipmap/icon_psd_hide"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
@@ -7,5 +7,5 @@
|
||||
android:id="@+id/ivRefresh"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:src="@mipmap/icon_water_loading" />
|
||||
android:src="@mipmap/icon_water_head_refresh" />
|
||||
</RelativeLayout>
|
||||
BIN
app/src/main/res/mipmap-xxhdpi/icon_water_head_refresh.png
Normal file
BIN
app/src/main/res/mipmap-xxhdpi/icon_water_head_refresh.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.3 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/icon_water_head_refresh.png
Normal file
BIN
app/src/main/res/mipmap-xxxhdpi/icon_water_head_refresh.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.1 KiB |
Reference in New Issue
Block a user