|
|
@@ -14,6 +14,8 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.sheep.gamegroup.absBase.BaseActivity;
|
|
|
import com.sheep.gamegroup.di.components.DaggerChangePhoneComponent;
|
|
|
import com.sheep.gamegroup.di.modules.PhoneModule;
|
|
|
+import com.sheep.gamegroup.greendao.DDProviderHelper;
|
|
|
+import com.sheep.gamegroup.greendao.download.SdkLoginUser;
|
|
|
import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
|
import com.sheep.gamegroup.presenter.PhoneContract;
|
|
|
import com.sheep.gamegroup.presenter.PhonePresenter;
|
|
|
@@ -24,6 +26,7 @@ import com.sheep.gamegroup.util.Jump2View;
|
|
|
import com.sheep.gamegroup.util.SelfCountDownTimer;
|
|
|
import com.sheep.gamegroup.util.TestUtil;
|
|
|
import com.sheep.gamegroup.util.UMConfigUtils;
|
|
|
+import com.sheep.gamegroup.util.ViewUtil;
|
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
|
import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.G;
|
|
|
@@ -70,6 +73,17 @@ public class ChangeTelAct extends BaseActivity implements PhoneContract.View {
|
|
|
@BindView(R.id.code_icon_iv)
|
|
|
ImageView code_icon_iv;
|
|
|
|
|
|
+ @BindView(R.id.game_account_layout)
|
|
|
+ View game_account_layout;
|
|
|
+ @BindView(R.id.face_view)
|
|
|
+ ImageView face_view;
|
|
|
+ @BindView(R.id.nickname_view)
|
|
|
+ TextView nickname_view;
|
|
|
+ @BindView(R.id.loginname_view)
|
|
|
+ TextView loginname_view;
|
|
|
+ @BindView(R.id.number_view)
|
|
|
+ TextView number_view;
|
|
|
+
|
|
|
@Inject
|
|
|
PhonePresenter presenter;
|
|
|
|
|
|
@@ -85,6 +99,7 @@ public class ChangeTelAct extends BaseActivity implements PhoneContract.View {
|
|
|
private String hitStr = "请输入手机号";
|
|
|
private String noticeStr = "绑定手机号";
|
|
|
String mobiles;
|
|
|
+ private String foreignToken;
|
|
|
|
|
|
//验证码倒计时
|
|
|
private SelfCountDownTimer selfCountDownTimer;
|
|
|
@@ -114,6 +129,17 @@ public class ChangeTelAct extends BaseActivity implements PhoneContract.View {
|
|
|
.build()
|
|
|
.inject(this);
|
|
|
where_from = getIntent().getIntExtra("where_from", 0);
|
|
|
+ if (getIntent().hasExtra("token")) {
|
|
|
+ foreignToken = getIntent().getStringExtra("token");
|
|
|
+ ViewUtil.setVisibility(game_account_layout, true);
|
|
|
+ SdkLoginUser gameUser = DDProviderHelper.getInstance().getSdkLoginUser(foreignToken);
|
|
|
+ ViewUtil.setText(nickname_view, gameUser.getNickname());
|
|
|
+ ViewUtil.setText(loginname_view, gameUser.getLoginname());
|
|
|
+ ViewUtil.setText(number_view, gameUser.getInvitation_code());
|
|
|
+ ViewUtil.setAvatar(face_view, gameUser.getAvatar());
|
|
|
+ } else {
|
|
|
+ ViewUtil.setVisibility(game_account_layout, false);
|
|
|
+ }
|
|
|
TitleBarUtils titleBarUtils = TitleBarUtils.getInstance()
|
|
|
.setShowOrHide(this, true)
|
|
|
.setTitle(this, noticeStr)
|
|
|
@@ -126,10 +152,10 @@ public class ChangeTelAct extends BaseActivity implements PhoneContract.View {
|
|
|
int skip_login = SpUtils.getOrder(SpUtils.SKIP_LOGIN_FLAG);
|
|
|
switch (where_from) {
|
|
|
case FROM_SPLASH://非第一次登录(如:登录后直接重启),老用户需要绑定手机号
|
|
|
- if(skip_login == 1){
|
|
|
+ if (skip_login == 1) {
|
|
|
|
|
|
startMainAct();
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
titleBarUtils.setRightBtn(this, "跳过", 0, new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
|
@@ -142,10 +168,10 @@ public class ChangeTelAct extends BaseActivity implements PhoneContract.View {
|
|
|
|
|
|
break;
|
|
|
case FROM_LOGIN://用户可以跳过
|
|
|
- if(skip_login == 1){
|
|
|
+ if (skip_login == 1) {
|
|
|
|
|
|
startMainAct();
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
titleBarUtils.setRightBtn(this, "跳过", 0, new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
|
@@ -272,7 +298,11 @@ public class ChangeTelAct extends BaseActivity implements PhoneContract.View {
|
|
|
selfCountDownTimer.reset(SelfCountDownTimer.FULL_SECOND);
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("mobile", mobile + "");
|
|
|
- presenter.smsBindMobile(jsonObject);
|
|
|
+ if (TextUtils.isEmpty(foreignToken)) {
|
|
|
+ presenter.smsBindMobile(SpUtils.getToken(ChangeTelAct.this), jsonObject);
|
|
|
+ } else {
|
|
|
+ presenter.smsBindMobile(foreignToken, jsonObject);
|
|
|
+ }
|
|
|
canGetCaptchaPhone = false;
|
|
|
selfCountDownTimer.start();
|
|
|
return;
|
|
|
@@ -293,7 +323,11 @@ public class ChangeTelAct extends BaseActivity implements PhoneContract.View {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("mobile", mobile + "");
|
|
|
jsonObject.put("sec_code", sec_code + "");
|
|
|
- presenter.bindPhone(jsonObject);
|
|
|
+ if (TextUtils.isEmpty(foreignToken)) {
|
|
|
+ presenter.bindPhone(SpUtils.getToken(ChangeTelAct.this), jsonObject);
|
|
|
+ } else {
|
|
|
+ presenter.bindPhone(foreignToken, jsonObject);
|
|
|
+ }
|
|
|
return;
|
|
|
}
|
|
|
step = 4;
|
|
|
@@ -349,7 +383,11 @@ public class ChangeTelAct extends BaseActivity implements PhoneContract.View {
|
|
|
jsonObject.put("mobile", mobile + "");
|
|
|
break;
|
|
|
}
|
|
|
- presenter.switchPhone(jsonObject);
|
|
|
+ if (TextUtils.isEmpty(foreignToken)) {
|
|
|
+ presenter.switchPhone(SpUtils.getToken(ChangeTelAct.this), jsonObject);
|
|
|
+ } else {
|
|
|
+ presenter.switchPhone(foreignToken, jsonObject);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -391,7 +429,7 @@ public class ChangeTelAct extends BaseActivity implements PhoneContract.View {
|
|
|
case 4:
|
|
|
G.showToast(o);
|
|
|
CommonUtil.getInstance().updateUserInfo(userEntity -> {
|
|
|
- if(userEntity == null){
|
|
|
+ if (userEntity == null) {
|
|
|
DataUtil.getInstance().setChange(true);
|
|
|
}
|
|
|
finish();
|
|
|
@@ -460,7 +498,7 @@ public class ChangeTelAct extends BaseActivity implements PhoneContract.View {
|
|
|
|
|
|
@Override
|
|
|
public void bindTelSmsFail(BaseMessage o) {
|
|
|
- if(TestUtil.isDev()){
|
|
|
+ if (TestUtil.isDev()) {
|
|
|
mobile = "13880742867";
|
|
|
step = 4;
|
|
|
changeTelSuccess(o);
|