Browse Source

Merge pull request #2 from CoboVault/bug_fix

fix setPassword UI issue
bug_fix
JunZhang 5 years ago
committed by GitHub
parent
commit
304a9771e4
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      app/src/main/java/com/cobo/cold/ui/fragment/setup/SetPasswordFragment.java

9
app/src/main/java/com/cobo/cold/ui/fragment/setup/SetPasswordFragment.java

@ -65,6 +65,8 @@ public class SetPasswordFragment extends SetupVaultBaseFragment<SetPasswordBindi
public static final String MNEMONIC = "mnemonic"; public static final String MNEMONIC = "mnemonic";
private boolean paused;
@Override @Override
protected int setView() { protected int setView() {
return R.layout.set_password; return R.layout.set_password;
@ -83,6 +85,7 @@ public class SetPasswordFragment extends SetupVaultBaseFragment<SetPasswordBindi
mBinding.pwd1.setOnFocusChangeListener((v, hasFocus) -> { mBinding.pwd1.setOnFocusChangeListener((v, hasFocus) -> {
if (!hasFocus) { if (!hasFocus) {
if (!paused) {
SetupVaultViewModel.PasswordValidationResult result = viewModel.validatePassword(); SetupVaultViewModel.PasswordValidationResult result = viewModel.validatePassword();
if (result != RESULT_OK) { if (result != RESULT_OK) {
mBinding.hint.setTextColor(mActivity.getColor(R.color.red)); mBinding.hint.setTextColor(mActivity.getColor(R.color.red));
@ -92,6 +95,7 @@ public class SetPasswordFragment extends SetupVaultBaseFragment<SetPasswordBindi
} else { } else {
inputValid = true; inputValid = true;
} }
}
} else { } else {
mBinding.hint.setTextColor(mActivity.getColor(R.color.white)); mBinding.hint.setTextColor(mActivity.getColor(R.color.white));
mBinding.hint.setText(R.string.text_password_required); mBinding.hint.setText(R.string.text_password_required);
@ -142,8 +146,6 @@ public class SetPasswordFragment extends SetupVaultBaseFragment<SetPasswordBindi
mBinding.toolbar.setNavigationOnClickListener(v -> { mBinding.toolbar.setNavigationOnClickListener(v -> {
Keyboard.hide(mActivity, mBinding.pwd1); Keyboard.hide(mActivity, mBinding.pwd1);
navigateUp(); navigateUp();
viewModel.getPwd1().set("");
viewModel.getPwd2().set("");
}); });
} }
mBinding.confirm.setOnClickListener(v -> validatePassword()); mBinding.confirm.setOnClickListener(v -> validatePassword());
@ -212,8 +214,6 @@ public class SetPasswordFragment extends SetupVaultBaseFragment<SetPasswordBindi
handler.post(() -> { handler.post(() -> {
Keyboard.hide(mActivity, mBinding.pwd2); Keyboard.hide(mActivity, mBinding.pwd2);
action.run(); action.run();
viewModel.getPwd1().set("");
viewModel.getPwd2().set("");
}); });
}); });
} }
@ -249,5 +249,6 @@ public class SetPasswordFragment extends SetupVaultBaseFragment<SetPasswordBindi
super.onPause(); super.onPause();
viewModel.getPwd1().set(""); viewModel.getPwd1().set("");
viewModel.getPwd2().set(""); viewModel.getPwd2().set("");
paused = true;
} }
} }

Loading…
Cancel
Save