Просмотр исходного кода

give mobile param to send captcha

hanjing лет назад: 6
Родитель
Сommit
ebef7228dd

+ 7 - 6
app/src/main/java/com/sheep/gamegroup/module/pay/activity/ActPayPassword.java

@@ -67,7 +67,7 @@ public class ActPayPassword extends BaseContainerActivity {
         if (action == ACTION_COMPLETION) {
             return new CompletionInfoFragment();
         } else if (action == ACTION_SEND_CAPTCHA) {
-            return new CheckCaptchaFragment();
+            return CheckCaptchaFragment.newInstance(getIntent().getStringExtra("mobile"));
         } else if (action == ACTION_CONFIRM_UPDATE) {
             return new ConfirmUpdateFragment();
         } else if (action == ACTION_SET_PWD) {
@@ -85,7 +85,7 @@ public class ActPayPassword extends BaseContainerActivity {
     }
 
     public static void setPwd(Context context) {
-        CommonUtil.getInstance().getUserInfo(SpUtils.getToken(context), (user)->{
+        CommonUtil.getInstance().getUserInfo(SpUtils.getToken(context), (user) -> {
             Intent in = new Intent(context, ActPayPassword.class);
             if (TextUtils.isEmpty(user.getMobile())) {
                 in.putExtra("action", ACTION_COMPLETION);
@@ -93,26 +93,27 @@ public class ActPayPassword extends BaseContainerActivity {
                 in.putExtra("action", ACTION_CONFIRM_UPDATE);
             } else {
                 in.putExtra("action", ACTION_SEND_CAPTCHA);
+                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.hasPayPwd()) {
+        CommonUtil.getInstance().getUserInfo(token, (user) -> {
+            if (user.hasPayPwd()) {
                 Intent in = new Intent(activity, ActPayPassword.class);
                 in.putExtra("action", ACTION_VERIFY_PAY_PWD);
                 in.putExtra("ext", ext);
                 activity.startActivityForResult(in, 3);
                 callback.callback(true);
-            } else{
+            } else {
                 callback.callback(false);
             }
         });
     }
 
-    public interface PayPasswordCallback{
+    public interface PayPasswordCallback {
         void callback(boolean ret);
     }
 

+ 8 - 5
app/src/main/java/com/sheep/gamegroup/module/pay/fragment/CheckCaptchaFragment.java

@@ -34,7 +34,13 @@ public class CheckCaptchaFragment extends AbsConfirmFragment {
     @BindView(R.id.captcha_box)
     EditText captchaBox;
 
-    private UserEntity user;
+    private String mobile;
+
+    public static CheckCaptchaFragment newInstance(String mobile){
+        CheckCaptchaFragment fragment = new CheckCaptchaFragment();
+        fragment.mobile = mobile;
+        return fragment;
+    }
 
     @Override
     public int getInnerLayoutId() {
@@ -45,10 +51,7 @@ public class CheckCaptchaFragment extends AbsConfirmFragment {
     public void onViewCreated() {
         super.onViewCreated();
         setTitle("身份验证");
-        user = DataUtil.getInstance().getUserEntity();
-        String mobile = user.getMobile();
-        Log.i("CheckMobile", mobile + "");
-        mobile = mobile.substring(0, 3) + "****" + mobile.substring(8);
+        mobile = mobile.substring(0, 3) + "****" + mobile.substring(7);
         mobileView.append(mobile);
     }