|
|
@@ -42,6 +42,7 @@ public class ActPayPassword extends BaseContainerActivity {
|
|
|
public final static int ACTION_SEND_CAPTCHA = 3;
|
|
|
public final static int ACTION_CONFIRM_UPDATE = 4;
|
|
|
public final static int ACTION_VERIFY_PAY_PWD = 5;
|
|
|
+ public final static int ACTION_CANCEL_PWD = 6;
|
|
|
|
|
|
@BindView(R.id.frame_container)
|
|
|
View container;
|
|
|
@@ -60,20 +61,22 @@ public class ActPayPassword extends BaseContainerActivity {
|
|
|
@Override
|
|
|
protected Fragment initFragment() {
|
|
|
int action = getIntent().getIntExtra("action", -1);
|
|
|
- return getFragment(action);
|
|
|
+ return getFragment(action, "");
|
|
|
}
|
|
|
|
|
|
- private Fragment getFragment(int action) {
|
|
|
+ private Fragment getFragment(int action, String extra) {
|
|
|
if (action == ACTION_COMPLETION) {
|
|
|
return new CompletionInfoFragment();
|
|
|
} else if (action == ACTION_SEND_CAPTCHA) {
|
|
|
- return CheckCaptchaFragment.newInstance(getIntent().getStringExtra("mobile"));
|
|
|
+ return CheckCaptchaFragment.newInstance(getIntent().getStringExtra("mobile"), CheckCaptchaFragment.FOR_SET, "");
|
|
|
} else if (action == ACTION_CONFIRM_UPDATE) {
|
|
|
return new ConfirmUpdateFragment();
|
|
|
} else if (action == ACTION_SET_PWD) {
|
|
|
return new SetPasswordFragment();
|
|
|
} else if (action == ACTION_VERIFY_PAY_PWD) {
|
|
|
return VerifyPayPwdFragment.newInstance(getIntent().getStringExtra("token"), getIntent().getStringExtra("ext"));
|
|
|
+ } else if (action == ACTION_CANCEL_PWD) {
|
|
|
+ return CheckCaptchaFragment.newInstance(getIntent().getStringExtra("mobile"), CheckCaptchaFragment.FOR_CLEAR, extra);
|
|
|
} else {
|
|
|
return null;
|
|
|
}
|
|
|
@@ -81,7 +84,7 @@ public class ActPayPassword extends BaseContainerActivity {
|
|
|
|
|
|
@Subscribe
|
|
|
public void whenActionComming(PayPasswordEvent ev) {
|
|
|
- replaceFragment(getFragment(ev.action));
|
|
|
+ replaceFragment(getFragment(ev.action, ev.extra));
|
|
|
}
|
|
|
|
|
|
public static void setPwd(Context context) {
|
|
|
@@ -101,6 +104,16 @@ public class ActPayPassword extends BaseContainerActivity {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ public static void clearPwd(Context context) {
|
|
|
+ CommonUtil.getInstance().getUserInfo(SpUtils.getToken(context), (user) -> {
|
|
|
+ if (user == null) return;
|
|
|
+ Intent in = new Intent(context, ActPayPassword.class);
|
|
|
+ in.putExtra("action", ACTION_CANCEL_PWD);
|
|
|
+ in.putExtra("mobile", user.getMobile());
|
|
|
+ context.startActivity(in);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
public static void verifyPwd(Activity activity, String token, String ext, PayPasswordCallback callback) {
|
|
|
CommonUtil.getInstance().getUserInfo(token, (user) -> {
|
|
|
if (user != null && user.hasPayPwd()) {
|
|
|
@@ -122,10 +135,16 @@ public class ActPayPassword extends BaseContainerActivity {
|
|
|
|
|
|
public static class PayPasswordEvent {
|
|
|
public int action;
|
|
|
+ public String extra;
|
|
|
|
|
|
public PayPasswordEvent(int action) {
|
|
|
this.action = action;
|
|
|
}
|
|
|
+
|
|
|
+ public PayPasswordEvent(int action, String extra) {
|
|
|
+ this.action = action;
|
|
|
+ this.extra = extra;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|