|
|
@@ -1,6 +1,7 @@
|
|
|
package com.sheep.gamegroup.view.activity;
|
|
|
|
|
|
import android.content.Intent;
|
|
|
+import android.os.Bundle;
|
|
|
import android.text.TextUtils;
|
|
|
import android.view.View;
|
|
|
import android.widget.ImageView;
|
|
|
@@ -11,15 +12,32 @@ import com.bumptech.glide.Glide;
|
|
|
import com.sheep.gamegroup.absBase.BaseActivity;
|
|
|
import com.sheep.gamegroup.di.components.DaggerAccountAndSercuritComponent;
|
|
|
import com.sheep.gamegroup.di.modules.AccountAndSercuritModule;
|
|
|
+import com.sheep.gamegroup.event.UserNameChange;
|
|
|
import com.sheep.gamegroup.model.entity.UserInfoEntity;
|
|
|
import com.sheep.gamegroup.presenter.AccountAndSecuritContract;
|
|
|
import com.sheep.gamegroup.presenter.AccountAndSecuritPresenter;
|
|
|
+import com.sheep.gamegroup.util.Jump2View;
|
|
|
+import com.sheep.gamegroup.util.MyDbManager;
|
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
|
import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
+import com.sheep.jiuyan.samllsheep.utils.SpUtils;
|
|
|
+import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
|
|
|
+import com.umeng.socialize.UMAuthListener;
|
|
|
+import com.umeng.socialize.UMShareAPI;
|
|
|
+import com.umeng.socialize.bean.SHARE_MEDIA;
|
|
|
+import com.umeng.socialize.handler.UMWXHandler;
|
|
|
+
|
|
|
+import org.greenrobot.eventbus.EventBus;
|
|
|
+import org.greenrobot.eventbus.Subscribe;
|
|
|
+import org.greenrobot.eventbus.ThreadMode;
|
|
|
+import org.xutils.ex.DbException;
|
|
|
+
|
|
|
+import java.util.Map;
|
|
|
|
|
|
import javax.inject.Inject;
|
|
|
|
|
|
import butterknife.BindView;
|
|
|
+import butterknife.ButterKnife;
|
|
|
import butterknife.OnClick;
|
|
|
|
|
|
/**
|
|
|
@@ -53,6 +71,8 @@ public class AccountAndSecurityAct extends BaseActivity implements AccountAndSec
|
|
|
@Inject
|
|
|
AccountAndSecuritPresenter presenter;
|
|
|
UserInfoEntity mEntity;
|
|
|
+ @BindView(R.id.tv_submit)
|
|
|
+ TextView tvSubmit;
|
|
|
|
|
|
|
|
|
@Override
|
|
|
@@ -62,13 +82,16 @@ public class AccountAndSecurityAct extends BaseActivity implements AccountAndSec
|
|
|
|
|
|
@Override
|
|
|
public void initView() {
|
|
|
+ TitleBarUtils
|
|
|
+ .getInstance()
|
|
|
+ .setTitle(this, "账号与安全")
|
|
|
+ .setTitleFinish(this);
|
|
|
|
|
|
DaggerAccountAndSercuritComponent.builder()
|
|
|
.netComponent(SheepApp.get(this).getNetComponent())
|
|
|
.accountAndSercuritModule(new AccountAndSercuritModule(this))
|
|
|
.build().inject(this);
|
|
|
|
|
|
-
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -81,11 +104,26 @@ public class AccountAndSecurityAct extends BaseActivity implements AccountAndSec
|
|
|
|
|
|
presenter.getTask(null);
|
|
|
|
|
|
+ EventBus.getDefault().register(this);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
+ @Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
+ public void onMessageEvent(UserNameChange done) {
|
|
|
+ UserInfoEntity user=mEntity;
|
|
|
+ user.setNickname(done.getNikeName());
|
|
|
+ mEntity=user;
|
|
|
+ tvName.setText(mEntity.getNickname());
|
|
|
|
|
|
- @OnClick({R.id.rl_phone, R.id.rl_wx, R.id.rl_auther, R.id.rl_top})
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @OnClick({R.id.rl_phone, R.id.rl_wx, R.id.rl_auther, R.id.rl_top,R.id.tv_submit})
|
|
|
public void onClick(View view) {
|
|
|
switch (view.getId()) {
|
|
|
case R.id.rl_phone: //跳转到绑定手机号
|
|
|
@@ -96,14 +134,63 @@ public class AccountAndSecurityAct extends BaseActivity implements AccountAndSec
|
|
|
case R.id.rl_auther: ////跳转授权
|
|
|
break;
|
|
|
|
|
|
- case R.id.rl_top:
|
|
|
- Intent i=new Intent(AccountAndSecurityAct.this,PersionInfoAct.class);
|
|
|
- i.putExtra("info",mEntity);
|
|
|
- startActivity(i);
|
|
|
+ case R.id.rl_top:
|
|
|
+ Jump2View.getInstance().goPersionInfo(AccountAndSecurityAct.this,mEntity);
|
|
|
+ break;
|
|
|
+ case R.id.tv_submit:
|
|
|
+ loginOut();
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void loginOut(){
|
|
|
+ UMShareAPI api= UMShareAPI.get(this);
|
|
|
+ api.deleteOauth(this, SHARE_MEDIA.WEIXIN, new UMAuthListener() {
|
|
|
+ @Override
|
|
|
+ public void onStart(SHARE_MEDIA platform) {
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onComplete(SHARE_MEDIA platform, int action, Map<String, String> data) {
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onError(SHARE_MEDIA platform, int action, Throwable t) {
|
|
|
+ hideProgress();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onCancel(SHARE_MEDIA platform, int action) {
|
|
|
+ hideProgress();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ api.deleteOauth(this, SHARE_MEDIA.QQ, new UMAuthListener() {
|
|
|
+ @Override
|
|
|
+ public void onStart(SHARE_MEDIA platform) {
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onComplete(SHARE_MEDIA platform, int action, Map<String, String> data) {
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onError(SHARE_MEDIA platform, int action, Throwable t) {
|
|
|
+ hideProgress();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onCancel(SHARE_MEDIA platform, int action) {
|
|
|
+ hideProgress();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ SpUtils.login(this, "");
|
|
|
+ SheepApp.removeAllActivity();
|
|
|
+ Jump2View.getInstance().goLoginView(AccountAndSecurityAct.this,null);
|
|
|
+ finish();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public void NetSuccess(int code, String msg) {
|
|
|
showToast(msg);
|
|
|
@@ -111,7 +198,7 @@ public class AccountAndSecurityAct extends BaseActivity implements AccountAndSec
|
|
|
|
|
|
@Override
|
|
|
public void NetError(int code, String errorMsg) {
|
|
|
- showToast(errorMsg);
|
|
|
+ showToast(errorMsg);
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -122,12 +209,12 @@ public class AccountAndSecurityAct extends BaseActivity implements AccountAndSec
|
|
|
this.runOnUiThread(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
- mEntity=entity;
|
|
|
+ mEntity = entity;
|
|
|
tvName.setText(entity.getNickname());
|
|
|
- tvLinkContent.setText("绵羊号:"+entity.getInvitation_code());
|
|
|
- if(TextUtils.isEmpty(entity.getMobile())){
|
|
|
+ tvLinkContent.setText("绵羊号:" + entity.getInvitation_code());
|
|
|
+ if (TextUtils.isEmpty(entity.getMobile())) {
|
|
|
tvPhone.setText("未绑定");
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
tvPhone.setText(entity.getMobile());
|
|
|
}
|
|
|
|
|
|
@@ -136,23 +223,35 @@ public class AccountAndSecurityAct extends BaseActivity implements AccountAndSec
|
|
|
.placeholder(R.mipmap.ic_launcher)
|
|
|
.into(ivHead);
|
|
|
tvWx.setText(entity.getWx_openid());
|
|
|
- boolean isBanck=TextUtils.isEmpty(entity.getBank_card());
|
|
|
- boolean isId_number=TextUtils.isEmpty(entity.getId_number());
|
|
|
- boolean isRoalName=TextUtils.isEmpty(entity.getReal_name());
|
|
|
+ boolean isBanck = TextUtils.isEmpty(entity.getBank_card());
|
|
|
+ boolean isId_number = TextUtils.isEmpty(entity.getId_number());
|
|
|
+ boolean isRoalName = TextUtils.isEmpty(entity.getReal_name());
|
|
|
|
|
|
- if(isBanck&&isId_number&&isRoalName){
|
|
|
+ if (isBanck && isId_number && isRoalName) {
|
|
|
tvAuther.setText("未认证");
|
|
|
- }else if(!isBanck&&!isId_number&&!isRoalName){
|
|
|
+ } else if (!isBanck && !isId_number && !isRoalName) {
|
|
|
tvAuther.setText("已认证");
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
tvAuther.setText("认证中");
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
+ @Override
|
|
|
+ protected void onCreate(Bundle savedInstanceState) {
|
|
|
+ super.onCreate(savedInstanceState);
|
|
|
+ // TODO: add setContentView(...) invocation
|
|
|
+ ButterKnife.bind(this);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
+ protected void onDestroy() {
|
|
|
+ super.onDestroy();
|
|
|
+ EventBus.getDefault().unregister(this);
|
|
|
}
|
|
|
+
|
|
|
}
|