|
|
@@ -2,6 +2,8 @@ package com.sheep.gamegroup.view.activity;
|
|
|
|
|
|
import android.app.Activity;
|
|
|
import android.content.Intent;
|
|
|
+import android.os.Bundle;
|
|
|
+import android.support.annotation.Nullable;
|
|
|
import android.text.TextUtils;
|
|
|
import android.view.View;
|
|
|
import android.widget.ImageView;
|
|
|
@@ -9,8 +11,10 @@ import android.widget.PopupWindow;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.kfzs.duanduan.utils.StatusBarUtils;
|
|
|
import com.sheep.gamegroup.absBase.AbsChooseImageActivity;
|
|
|
import com.sheep.gamegroup.absBase.AbsObserver;
|
|
|
+import com.sheep.gamegroup.event.WXLoginAuthEvent;
|
|
|
import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
|
import com.sheep.gamegroup.model.entity.UserEntity;
|
|
|
import com.sheep.gamegroup.model.util.SheepSubscriber;
|
|
|
@@ -21,14 +25,20 @@ import com.sheep.gamegroup.util.GlideImageLoader;
|
|
|
import com.sheep.gamegroup.util.Jump2View;
|
|
|
import com.sheep.gamegroup.util.ViewUtil;
|
|
|
import com.sheep.gamegroup.util.share.ShareLinkConfig;
|
|
|
+import com.sheep.jiuyan.samllsheep.Config;
|
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
|
import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.G;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
|
|
|
+import com.sheep.jiuyan.samllsheep.wxutil.WXAPIUtil;
|
|
|
import com.umeng.socialize.UMAuthListener;
|
|
|
import com.umeng.socialize.UMShareAPI;
|
|
|
import com.umeng.socialize.bean.SHARE_MEDIA;
|
|
|
|
|
|
+import org.greenrobot.eventbus.EventBus;
|
|
|
+import org.greenrobot.eventbus.Subscribe;
|
|
|
+
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
|
|
|
import butterknife.BindView;
|
|
|
@@ -82,6 +92,18 @@ public class PersonalInfoAct extends AbsChooseImageActivity {
|
|
|
|
|
|
|
|
|
@Override
|
|
|
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
|
+ super.onCreate(savedInstanceState);
|
|
|
+ EventBus.getDefault().register(this);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onDestroy() {
|
|
|
+ EventBus.getDefault().unregister(this);
|
|
|
+ super.onDestroy();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
protected int getLayoutId() {
|
|
|
return R.layout.xpersion_info_act_layout;
|
|
|
}
|
|
|
@@ -270,7 +292,7 @@ public class PersonalInfoAct extends AbsChooseImageActivity {
|
|
|
BIND_WX.onEvent();
|
|
|
break;
|
|
|
case R.id.personal_info_authentication_container: ////跳转授权
|
|
|
- Jump2View.getInstance().goRealNameAuther(activity, userEntity, RealNameAuthenAct.ONLY_FINISH);
|
|
|
+ Jump2View.getInstance().goRealNameAuther(activity, userEntity, RealNameAuthenAct.ONLY_FINISH);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
@@ -301,6 +323,22 @@ public class PersonalInfoAct extends AbsChooseImageActivity {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ @Subscribe
|
|
|
+ public void whenWXAuth(WXLoginAuthEvent ev) {
|
|
|
+ if (!TextUtils.isEmpty(ev.code)) {
|
|
|
+ WXAPIUtil.loadWXUserToken(ev.code, (ret, openid, token) -> {
|
|
|
+ Map<String, String> params = new HashMap<>();
|
|
|
+ params.put("access_token", token);
|
|
|
+ params.put("openid", openid);
|
|
|
+ params.put("account_type", "wx");
|
|
|
+ params.put("app_id", Config.WX_AUTH_APP_ID);
|
|
|
+ bindThird("wechat", token, openid);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ G.shortToast("微信授权失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void bindWX() {
|
|
|
UMShareAPI.get(this).deleteOauth(this, SHARE_MEDIA.WEIXIN, new UMAuthListener() {
|
|
|
@Override
|
|
|
@@ -310,29 +348,7 @@ public class PersonalInfoAct extends AbsChooseImageActivity {
|
|
|
|
|
|
@Override
|
|
|
public void onComplete(SHARE_MEDIA share_media, int i, Map<String, String> map) {
|
|
|
- UMShareAPI.get(activity).doOauthVerify(activity, SHARE_MEDIA.WEIXIN, new UMAuthListener() {
|
|
|
- @Override
|
|
|
- public void onStart(SHARE_MEDIA platform) {
|
|
|
- showProgress();
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onComplete(SHARE_MEDIA platform, int action, Map<String, String> data) {
|
|
|
- bindThird("wechat", data.get("access_token"), data.get("openid"));
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onError(SHARE_MEDIA platform, int action, Throwable t) {
|
|
|
- G.showToast("微信授权失败 请检查网络是否正常");
|
|
|
- hideProgress();
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onCancel(SHARE_MEDIA platform, int action) {
|
|
|
- G.showToast("您取消了微信授权");
|
|
|
- hideProgress();
|
|
|
- }
|
|
|
- });
|
|
|
+ WXAPIUtil.launchAuth(SheepApp.getInstance());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -445,9 +461,9 @@ public class PersonalInfoAct extends AbsChooseImageActivity {
|
|
|
tvSex.setText((userEntity.getGender() == 0) ? "点击设置" : (userEntity.getGender() == 1 ? "男" : "女"));
|
|
|
tvBirthday.setText((userEntity.getBirthday().substring(0, 1)).equals("0") ? "点击设置" : userEntity.getBirthday().substring(0, 10));
|
|
|
personal_info_name.setText(userEntity.getNickname());
|
|
|
- if(TextUtils.isEmpty(userEntity.getUser_name())){
|
|
|
+ if (TextUtils.isEmpty(userEntity.getUser_name())) {
|
|
|
personal_info_loginname.setText("还未设置登录名");
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
personal_info_loginname.setText(userEntity.getUser_name());
|
|
|
}
|
|
|
personal_info_code.setText(userEntity.getInvitation_code());
|