优化登录流程,修复2.6已知的BUG

This commit is contained in:
kehaoyuan
2017-07-20 18:04:38 +08:00
parent 92d122b0a3
commit a113fc1c73
17 changed files with 232 additions and 148 deletions

View File

@ -23,9 +23,11 @@ import com.gh.base.BaseActivity;
import com.gh.common.util.DialogUtils;
import com.gh.common.util.EntranceUtils;
import com.gh.common.util.LoginUtils;
import com.gh.common.util.StringUtils;
import com.gh.gamecenter.entity.LoginResponseEntity;
import com.gh.gamecenter.eventbus.EBReuse;
import com.gh.gamecenter.eventbus.EBSkip;
import com.gh.gamecenter.personal.PersonalFragment;
import com.kyleduo.switchbutton.SwitchButton;
import com.lightgame.download.FileUtils;
@ -43,14 +45,12 @@ import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
import static com.gh.gamecenter.R.id.setting_rl_about;
import static com.gh.gamecenter.personal.PersonalFragment.LOGIN_CODE;
import static com.gh.gamecenter.personal.PersonalFragment.LOGOUT_TAG;
import static java.lang.Thread.sleep;
/**
* 游戏设置页面
*
* @author 吕方
* @ 吕方
* @since 0814
*/
public class SettingActivity extends BaseActivity implements OnClickListener {
@ -119,12 +119,32 @@ public class SettingActivity extends BaseActivity implements OnClickListener {
}
fontTextSize(checkSizeIndex);
initLoginStatus();
}
private void initLoginStatus() {
LoginResponseEntity loginToken = LoginUtils.getLoginToken(this);
if (loginToken != null) {
String loginType = loginToken.getLoginType();
if (!TextUtils.isEmpty(loginType)) {
mSettingLoginType.setText(loginType);
if (loginToken != null && !TextUtils.isEmpty(loginToken.getLoginType())) {
String loginType = loginToken.getLoginType().trim();
switch (loginType) {
case "qq":
loginType = "QQ";
break;
case "wechat":
loginType = "微信";
break;
case "weibo":
loginType = "新浪微博";
break;
default:
if (loginType.length() == 11) {
String sub1 = loginType.substring(0, 3);
String sub2 = loginType.substring(9, 11);
loginType = StringUtils.buildString(sub1, "******", sub2);
}
break;
}
mSettingLoginType.setText(loginType);
mSettingLoginRl.setVisibility(View.VISIBLE);
} else {
mSettingLoginRl.setVisibility(View.GONE);
@ -245,10 +265,8 @@ public class SettingActivity extends BaseActivity implements OnClickListener {
"确定退出", "取消", new DialogUtils.ConfirmListener() {
@Override
public void onConfirm() {
LoginUtils.cleanUserData(SettingActivity.this);
Intent intent = new Intent();
intent.putExtra("loginStatus", LOGOUT_TAG);
setResult(LOGIN_CODE, intent);
LoginUtils.logout(SettingActivity.this);
EventBus.getDefault().post(new EBReuse(PersonalFragment.LOGOUT_TAG));
finish();
}
}, null);