Commit e0b73d8bd3b49774548c36db8934134cc9bdbe91

Authored by 韩亚云
1 parent 606860ab

添加绑定管理页面,三方登录绑定测试

Showing 25 changed files with 968 additions and 16 deletions
app/strike/src/main/java/com/cnlive/strike/demo/activity/DemoMvpActivity.java
@@ -15,6 +15,7 @@ import com.alibaba.android.arouter.launcher.ARouter; @@ -15,6 +15,7 @@ import com.alibaba.android.arouter.launcher.ARouter;
15 import com.cnlive.cloud.R; 15 import com.cnlive.cloud.R;
16 import com.cnlive.cloud.databinding.ActivityDemoMvpMainBinding; 16 import com.cnlive.cloud.databinding.ActivityDemoMvpMainBinding;
17 import com.cnlive.cloud.user.auth.UserService; 17 import com.cnlive.cloud.user.auth.UserService;
  18 +import com.cnlive.cloud.user.ui.activity.BindPhoneMangerActivity;
18 import com.cnlive.cloud.user.ui.activity.FirstLoginActivity; 19 import com.cnlive.cloud.user.ui.activity.FirstLoginActivity;
19 import com.cnlive.cloud.user.ui.activity.LoginActivity; 20 import com.cnlive.cloud.user.ui.activity.LoginActivity;
20 import com.cnlive.cloud.user.ui.activity.LoginDialogActivity; 21 import com.cnlive.cloud.user.ui.activity.LoginDialogActivity;
@@ -87,6 +88,10 @@ public class DemoMvpActivity extends BaseActivity<DemoActivityView, DemoActivity @@ -87,6 +88,10 @@ public class DemoMvpActivity extends BaseActivity<DemoActivityView, DemoActivity
87 overridePendingTransition(R.anim.activity_in, R.anim.activity_out); 88 overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
88 } 89 }
89 }); 90 });
  91 +
  92 + //绑定管理
  93 + binding.btnLoginBingding.setOnClickListener(view -> BindPhoneMangerActivity.startActivity(DemoMvpActivity.this));
  94 +
90 //新用户头像设置 95 //新用户头像设置
91 binding.btnNewUserFace.setOnClickListener(new View.OnClickListener() { 96 binding.btnNewUserFace.setOnClickListener(new View.OnClickListener() {
92 @Override 97 @Override
app/strike/src/main/res/layout/activity_demo_mvp_main.xml
@@ -30,6 +30,12 @@ @@ -30,6 +30,12 @@
30 android:text="登录对话框" /> 30 android:text="登录对话框" />
31 31
32 <Button 32 <Button
  33 + android:id="@+id/btn_login_bingding"
  34 + android:layout_width="match_parent"
  35 + android:layout_height="wrap_content"
  36 + android:text="账号三方绑定管理"/>
  37 +
  38 + <Button
33 android:id="@+id/btn_new_user_face" 39 android:id="@+id/btn_new_user_face"
34 android:layout_width="match_parent" 40 android:layout_width="match_parent"
35 android:layout_height="wrap_content" 41 android:layout_height="wrap_content"
cloud/third_tool/src/debug/AndroidManifest.xml
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 5
6 6
7 <activity 7 <activity
8 - android:name="com.cnlive.cloud.debug.wxapi.WXEntryActivity" 8 + android:name="com.cnlive.strike.debug.wxapi.WXEntryActivity"
9 android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" 9 android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
10 android:label="@string/app_name" 10 android:label="@string/app_name"
11 android:exported="true" 11 android:exported="true"
cloud/third_tool/src/main/java/com/cnlive/login/utils/ThirdLoginUtil.java
@@ -72,11 +72,30 @@ public class ThirdLoginUtil { @@ -72,11 +72,30 @@ public class ThirdLoginUtil {
72 * @param context 72 * @param context
73 * @return 73 * @return
74 */ 74 */
75 - public static boolean isQQInstalled(Activity context){ 75 + public static boolean isQQInstalled(Activity context,boolean isLogin){
76 boolean isInstall = false; 76 boolean isInstall = false;
77 mContext = context; 77 mContext = context;
78 isInstall = (Util.checkQQ(context) || Util.isQQClientAvailable(context) || mTencent.isQQInstalled(context)); 78 isInstall = (Util.checkQQ(context) || Util.isQQClientAvailable(context) || mTencent.isQQInstalled(context));
79 - if(isInstall) mTencent.login(context, ACOPE_ALL, listener); 79 + if(isInstall) mTencent.login(context, ACOPE_ALL, new IUiListener() {
  80 + @Override
  81 + public void onComplete(Object o) {
  82 + getQQInfo(mContext, mTencent, o);
  83 + }
  84 +
  85 + @Override
  86 + public void onError(UiError uiError) {
  87 + String msg = "登录失败";
  88 + if(!isLogin) msg = "绑定失败";
  89 + AlertUtil.showDeftToast(mContext, msg);
  90 + }
  91 +
  92 + @Override
  93 + public void onCancel() {
  94 + String msg = "取消登录";
  95 + if(!isLogin) msg = "取消绑定";
  96 + AlertUtil.showDeftToast(mContext, msg);
  97 + }
  98 + });
80 return isInstall; 99 return isInstall;
81 } 100 }
82 101
@@ -86,8 +105,27 @@ public class ThirdLoginUtil { @@ -86,8 +105,27 @@ public class ThirdLoginUtil {
86 * @param resultCode 105 * @param resultCode
87 * @param data 106 * @param data
88 */ 107 */
89 - public static void getQQResult(int requestCode, int resultCode, Intent data){  
90 - Tencent.onActivityResultData(requestCode, resultCode, data, listener); 108 + public static void getQQResult(int requestCode, int resultCode, Intent data,boolean isLogin){
  109 + Tencent.onActivityResultData(requestCode, resultCode, data, new IUiListener() {
  110 + @Override
  111 + public void onComplete(Object o) {
  112 + getQQInfo(mContext, mTencent, o);
  113 + }
  114 +
  115 + @Override
  116 + public void onError(UiError uiError) {
  117 + String msg = "登录失败";
  118 + if(!isLogin) msg = "绑定失败";
  119 + AlertUtil.showDeftToast(mContext, msg);
  120 + }
  121 +
  122 + @Override
  123 + public void onCancel() {
  124 + String msg = "取消登录";
  125 + if(!isLogin) msg = "取消绑定";
  126 + AlertUtil.showDeftToast(mContext, msg);
  127 + }
  128 + });
91 } 129 }
92 130
93 131
@@ -95,7 +133,7 @@ public class ThirdLoginUtil { @@ -95,7 +133,7 @@ public class ThirdLoginUtil {
95 * 微博登录 133 * 微博登录
96 * @param activity 134 * @param activity
97 */ 135 */
98 - public static void loginWeibo(Activity activity){ 136 + public static void loginWeibo(Activity activity,boolean isLogin){
99 if(mSsoHandler == null)mSsoHandler = new SsoHandler(activity); 137 if(mSsoHandler == null)mSsoHandler = new SsoHandler(activity);
100 mSsoHandler.authorize(new WbAuthListener() { 138 mSsoHandler.authorize(new WbAuthListener() {
101 @Override 139 @Override
@@ -105,12 +143,16 @@ public class ThirdLoginUtil { @@ -105,12 +143,16 @@ public class ThirdLoginUtil {
105 143
106 @Override 144 @Override
107 public void cancel() { 145 public void cancel() {
108 - AlertUtil.showDeftToast(activity, "取消登录"); 146 + String msg = "取消登录";
  147 + if(!isLogin) msg = "取消绑定";
  148 + AlertUtil.showDeftToast(activity, msg);
109 } 149 }
110 150
111 @Override 151 @Override
112 public void onFailure(WbConnectErrorMessage wbConnectErrorMessage) { 152 public void onFailure(WbConnectErrorMessage wbConnectErrorMessage) {
113 - AlertUtil.showDeftToast(activity, "登录失败"); 153 + String msg = "登录失败";
  154 + if(!isLogin) msg = "绑定失败";
  155 + AlertUtil.showDeftToast(activity, msg);
114 } 156 }
115 }); 157 });
116 } 158 }
cloud/third_tool/src/release/AndroidManifest.xml
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 <application> 4 <application>
5 5
6 <activity 6 <activity
7 - android:name="com.cnlive.cloud.wxapi.WXEntryActivity" 7 + android:name="com.cnlive.strike.debug.wxapi.WXEntryActivity"
8 android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" 8 android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
9 android:exported="true" 9 android:exported="true"
10 android:launchMode="singleTop"> 10 android:launchMode="singleTop">
cloud/user/src/main/AndroidManifest.xml
@@ -31,7 +31,9 @@ @@ -31,7 +31,9 @@
31 <uses-permission android:name="android.permission.INTERNET" /> 31 <uses-permission android:name="android.permission.INTERNET" />
32 32
33 <application android:largeHeap="true"> 33 <application android:largeHeap="true">
34 - <activity android:name=".ui.activity.BindPhoneNumberActivity"></activity> 34 + <activity android:name=".ui.activity.UnBindThreeLoginCheckActivity"></activity>
  35 + <activity android:name=".ui.activity.BindPhoneMangerActivity" />
  36 + <activity android:name=".ui.activity.BindPhoneNumberActivity" />
35 37
36 <meta-data 38 <meta-data
37 android:name="WEIBO_APPKEY" 39 android:name="WEIBO_APPKEY"
cloud/user/src/main/java/com/cnlive/cloud/user/frame/presenter/BindPhoneMangerPresenter.java 0 → 100644
  1 +package com.cnlive.cloud.user.frame.presenter;
  2 +
  3 +import com.cnlive.cloud.user.auth.UserService;
  4 +import com.cnlive.cloud.user.frame.view.BindPhoneMangerView;
  5 +import com.cnlive.cloud.user.model.BindPhoneNumberInfo;
  6 +import com.cnlive.cloud.user.ui.activity.BindPhoneMangerActivity;
  7 +import com.cnlive.core.libs.base.application.AppConfig;
  8 +import com.cnlive.core.libs.base.frame.presenter.BasePresenter;
  9 +import com.cnlive.core.network.HttpConn;
  10 +import com.cnlive.core.network.NetCallBack;
  11 +import com.cnlive.core.network.api.ApiBaseServiceOpen;
  12 +import com.cnlive.core.network.model.BaseResult;
  13 +import com.cnlive.core.network.request.BaseRequest;
  14 +import com.cnlive.login.model.OtherUserInfo;
  15 +
  16 +import java.util.HashMap;
  17 +
  18 +
  19 +/**
  20 + * 作者: 吴奎庆
  21 + * <p>
  22 + * 时间: 2019/9/9
  23 + * <p>
  24 + * 简介:
  25 + */
  26 +public class BindPhoneMangerPresenter extends BasePresenter<BindPhoneMangerView> {
  27 +
  28 + public void unBindLogin(BindPhoneMangerActivity mangerActivity, BindPhoneNumberInfo info) {
  29 + if (mangerActivity == null) return;
  30 + UserService userService = UserService.getInstance(mangerActivity);
  31 + if (userService == null) return;
  32 + HashMap<String, String> requestMap = new HashMap<>();
  33 + requestMap.put("appId", AppConfig.getAppId());
  34 +
  35 + requestMap.put("uid", userService.getAppAccount().getUid());
  36 +
  37 + switch (info.getType()) {
  38 + case 1:
  39 + requestMap.put("thirdPartyId", userService.getAppAccount().getSinaUid());
  40 + break;
  41 + case 2:
  42 +
  43 + requestMap.put("thirdPartyId", userService.getAppAccount().getQqUid());
  44 + break;
  45 + case 3:
  46 + requestMap.put("thirdPartyId", userService.getAppAccount().getWxUid());
  47 + break;
  48 + }
  49 + requestMap.put("thirdPartyPlat", info.getType() + "");
  50 + requestMap.put("token", userService.getAppAccount().getToken());
  51 + requestMap.put("clientPlat", "a");
  52 +
  53 + HttpConn.action(BaseRequest.init().service(ApiBaseServiceOpen.class).unBind3rd(requestMap), new NetCallBack<BaseResult>() {
  54 + @Override
  55 + public void onRequestState(int state) {
  56 +
  57 + }
  58 +
  59 + @Override
  60 + public void onSuccess(BaseResult data) {
  61 + if ("0".equals(data.getCode())) {
  62 + //接触绑定成功
  63 + ifViewAttached(view -> view.unBindSuccess());
  64 +
  65 + }
  66 + }
  67 +
  68 + @Override
  69 + public void onFailure(String errCode, String errMsg, Exception e) {
  70 + ifViewAttached(view -> view.showMessage(errMsg));
  71 + }
  72 + });
  73 + }
  74 +
  75 + public void bindLogin(BindPhoneMangerActivity mangerActivity, OtherUserInfo info) {
  76 + if (mangerActivity == null) return;
  77 + UserService userService = UserService.getInstance(mangerActivity);
  78 + if (userService == null) return;
  79 + HashMap<String, String> requestMap = new HashMap<>();
  80 + requestMap.put("appId", AppConfig.getAppId());
  81 +
  82 + requestMap.put("uid", userService.getAppAccount().getUid());
  83 + requestMap.put("thirdPartyId", info.getThirdPartyId());
  84 + requestMap.put("thirdPartyPlat", info.getLoginType() + "");
  85 + requestMap.put("token", userService.getAppAccount().getToken());
  86 + requestMap.put("clientPlat", "a");
  87 +
  88 + HttpConn.action(BaseRequest.init().service(ApiBaseServiceOpen.class).bind3rd(requestMap), new NetCallBack<BaseResult>() {
  89 + @Override
  90 + public void onRequestState(int state) {
  91 +
  92 + }
  93 +
  94 + @Override
  95 + public void onSuccess(BaseResult data) {
  96 + if ("0".equals(data.getCode())) {
  97 + //接触绑定成功
  98 + ifViewAttached(view -> view.bindSuccess(info));
  99 + }
  100 + }
  101 +
  102 + @Override
  103 + public void onFailure(String errCode, String errMsg, Exception e) {
  104 + ifViewAttached(view -> view.showMessage(errMsg));
  105 + }
  106 + });
  107 + }
  108 +
  109 + //绑定
  110 + public void otherLogin(BindPhoneMangerActivity mangerActivity, OtherUserInfo otherUserInfo) {
  111 +
  112 + }
  113 +}
cloud/user/src/main/java/com/cnlive/cloud/user/frame/view/BindPhoneMangerView.java 0 → 100644
  1 +package com.cnlive.cloud.user.frame.view;
  2 +
  3 +import android.text.TextUtils;
  4 +import android.view.View;
  5 +
  6 +import com.cnlive.cloud.user.R;
  7 +import com.cnlive.cloud.user.auth.UserService;
  8 +import com.cnlive.cloud.user.model.BindPhoneNumberInfo;
  9 +import com.cnlive.cloud.user.model.CNLiveUserInfo;
  10 +import com.cnlive.cloud.user.ui.activity.BindPhoneMangerActivity;
  11 +import com.cnlive.cloud.user.ui.activity.LoginDialogActivity;
  12 +import com.cnlive.cloud.user.ui.activity.UnBindThreeLoginCheckActivity;
  13 +import com.cnlive.cloud.user.ui.adapter.BindPhoneNumberAdapter;
  14 +import com.cnlive.core.libs.base.application.AppConfig;
  15 +import com.cnlive.core.libs.base.frame.view.BaseView;
  16 +import com.cnlive.core.libs.base.util.AlertUtil;
  17 +import com.cnlive.core.libs.base.util.DoublePressed;
  18 +import com.cnlive.login.model.OtherUserInfo;
  19 +import com.cnlive.login.utils.ThirdLoginUtil;
  20 +import com.cnlive.share.util.Util;
  21 +import com.qmuiteam.qmui.widget.QMUITopBar;
  22 +
  23 +import java.util.ArrayList;
  24 +import java.util.List;
  25 +
  26 +import androidx.recyclerview.widget.LinearLayoutManager;
  27 +
  28 +/**
  29 + * 作者: 吴奎庆
  30 + * <p>
  31 + * 时间: 2019/9/9
  32 + * <p>
  33 + * 简介:
  34 + */
  35 +public class BindPhoneMangerView extends BaseView {
  36 +
  37 + BindPhoneMangerActivity mangerActivity;
  38 + private BindPhoneNumberAdapter mAdapter;
  39 + int curPosition = -1;
  40 +
  41 + public BindPhoneMangerView(BindPhoneMangerActivity activity) {
  42 + mangerActivity = activity;
  43 + }
  44 +
  45 + public void initView() {
  46 + QMUITopBar toolbar = (QMUITopBar) mangerActivity.binding.includeToolbar;
  47 + toolbar.setTitle("绑定管理");
  48 + toolbar.setBackgroundColor(mangerActivity.getResources().getColor(R.color.white));
  49 + toolbar.addLeftImageButton(R.drawable.back_black, R.id.qmui_topbar_item_left_back).setOnClickListener(new View.OnClickListener() {
  50 + @Override
  51 + public void onClick(View v) {
  52 + mangerActivity.finish();
  53 + }
  54 + });
  55 + LinearLayoutManager linearLayoutManager = new LinearLayoutManager(mangerActivity);
  56 +
  57 + mAdapter = new BindPhoneNumberAdapter(mangerActivity);
  58 + mangerActivity.binding.rvContent.setLayoutManager(linearLayoutManager);
  59 + mangerActivity.binding.rvContent.setAdapter(mAdapter);
  60 + CNLiveUserInfo userInfo = UserService.getInstance(mangerActivity).getAppAccount();
  61 +
  62 + List<BindPhoneNumberInfo> list = new ArrayList<>();
  63 +
  64 + BindPhoneNumberInfo infoTitle = new BindPhoneNumberInfo();
  65 + infoTitle.setItemType(BindPhoneNumberInfo.TYPE_TITLE);
  66 + infoTitle.setItemName("您已绑定网家家手机号账号");
  67 + list.add(infoTitle);
  68 +
  69 + BindPhoneNumberInfo infophone = new BindPhoneNumberInfo();
  70 + infophone.setTypeName("手机号");
  71 + String outMobile = userInfo.getMobile().replaceAll("(?<=\\d{3})\\d(?=\\d{4})", "*");
  72 + infophone.setType(0);
  73 + infophone.setUserName(outMobile);
  74 + infophone.setItemType(BindPhoneNumberInfo.TYPE_LOGIN);
  75 + infophone.setBind(true);
  76 + infophone.setTypeIcon(mangerActivity.getResources().getDrawable(R.drawable.bind_phone));
  77 + list.add(infophone);
  78 +
  79 + BindPhoneNumberInfo infoTitle2 = new BindPhoneNumberInfo();
  80 + infoTitle2.setItemType(BindPhoneNumberInfo.TYPE_TITLE);
  81 + infoTitle2.setItemName("其他绑定方式");
  82 + list.add(infoTitle2);
  83 +
  84 + BindPhoneNumberInfo infoWc = new BindPhoneNumberInfo();
  85 + infoWc.setTypeName("微信");
  86 + infoWc.setType(3);
  87 + if (userInfo != null && !TextUtils.isEmpty(userInfo.getWxUid())) {
  88 + infoWc.setBind(true);
  89 + infoWc.setUserName(userInfo.getNickName());
  90 + } else {
  91 + infoWc.setBind(false);
  92 + infoWc.setUserName("未绑定微信");
  93 + }
  94 + infoWc.setItemType(BindPhoneNumberInfo.TYPE_LOGIN);
  95 + infoWc.setTypeIcon(mangerActivity.getResources().getDrawable(R.drawable.wechat));
  96 + list.add(infoWc);
  97 +
  98 + BindPhoneNumberInfo infoQq = new BindPhoneNumberInfo();
  99 + infoQq.setTypeName("QQ");
  100 + infoQq.setType(2);
  101 + if (userInfo != null && !TextUtils.isEmpty(userInfo.getQqUid())) {
  102 + infoQq.setBind(true);
  103 + infoQq.setUserName(userInfo.getNickName());
  104 + } else {
  105 + infoQq.setBind(false);
  106 + infoQq.setUserName("未绑定QQ");
  107 + }
  108 + infoQq.setItemType(BindPhoneNumberInfo.TYPE_LOGIN);
  109 + infoQq.setTypeIcon(mangerActivity.getResources().getDrawable(R.drawable.qq));
  110 + list.add(infoQq);
  111 +
  112 + BindPhoneNumberInfo infoWb = new BindPhoneNumberInfo();
  113 + infoWb.setTypeName("微博");
  114 + if (userInfo != null && !TextUtils.isEmpty(userInfo.getSinaUid())) {
  115 + infoWb.setBind(true);
  116 + infoWb.setUserName(userInfo.getNickName());
  117 + } else {
  118 + infoWb.setBind(false);
  119 + infoWb.setUserName("未绑定微博");
  120 + }
  121 + infoWb.setItemType(BindPhoneNumberInfo.TYPE_LOGIN);
  122 + infoWb.setTypeIcon(mangerActivity.getResources().getDrawable(R.drawable.weibo));
  123 + infoWb.setType(1);
  124 + list.add(infoWb);
  125 + mAdapter.addItems(list);
  126 + mAdapter.setItemClickListener(new BindPhoneNumberAdapter.OnItemClickListener() {
  127 + @Override
  128 + public void onItemClick(BindPhoneNumberInfo info, View view, int position) {
  129 +
  130 + if (info.getType()==0|| DoublePressed.onDoublePressed()) return;
  131 + curPosition = position;
  132 + processClick(info, view);
  133 + }
  134 + });
  135 + }
  136 +
  137 + private void processClick(BindPhoneNumberInfo info, View view) {
  138 + //类型 0手机号 3 微信 2 qq 1 微博
  139 + if (view.getId() == R.id.tv_bind) {
  140 + switch (info.getType()) {
  141 + case 0:
  142 +// showMessage("解绑手机号");
  143 + break;
  144 + case 1:
  145 + if (info.isBind()) {
  146 + processUnBind(info);
  147 + } else {
  148 + if (Util.isWeiboInstallAndInit(mangerActivity)) {
  149 + ThirdLoginUtil.loginWeibo(mangerActivity,false);
  150 + } else {
  151 + showMessage("您未安装该第三方应用,无法获取用户信息!");
  152 + }
  153 +
  154 + }
  155 + break;
  156 + case 2:
  157 + if (info.isBind()) {
  158 + processUnBind(info);
  159 + } else {
  160 + if (!ThirdLoginUtil.isQQInstalled(mangerActivity,false))
  161 + showMessage("您未安装该第三方应用,无法获取用户信息!");
  162 + }
  163 + break;
  164 + case 3:
  165 + if (info.isBind()) {
  166 + processUnBind(info);
  167 + } else {
  168 +
  169 + if (Util.isWXAppInstalledAndSupported(mangerActivity)) {
  170 + new Thread(() -> {
  171 + ThirdLoginUtil.loginWechat(mangerActivity, AppConfig.getWechatAppid());
  172 + }).start();
  173 + } else {
  174 + showMessage("您未安装该第三方应用,无法获取用户信息!");
  175 + }
  176 + }
  177 + break;
  178 + }
  179 + }
  180 + }
  181 +
  182 + private void processUnBind(BindPhoneNumberInfo info) {
  183 + if (mangerActivity == null || info == null) return;
  184 + mangerActivity.checkInfo = info;
  185 + UnBindThreeLoginCheckActivity.startUnBindThreeLoginCheckActivity(mangerActivity, mangerActivity.openCode);
  186 + }
  187 +
  188 + public void showMessage(String message) {
  189 + if (mangerActivity == null) return;
  190 + AlertUtil.showDeftToast(mangerActivity, message);
  191 + }
  192 +
  193 + //类型 0手机号 3 微信 2 qq 1 微博
  194 + public void bindSuccess(OtherUserInfo info) {
  195 + if (curPosition == -1 || mAdapter == null) return;
  196 + BindPhoneNumberInfo infos = mAdapter.getItem(curPosition);
  197 + switch (infos.getType()) {
  198 + case 1:
  199 + UserService.getInstance(mangerActivity).setUserWBUID(info.getThirdPartyId());
  200 + break;
  201 + case 2:
  202 + UserService.getInstance(mangerActivity).setUserQQUID(info.getThirdPartyId());
  203 + break;
  204 + case 3:
  205 + UserService.getInstance(mangerActivity).setUserWXUID(info.getThirdPartyId());
  206 + break;
  207 + }
  208 + infos.setUserName(info.getNickName());
  209 + infos.setBind(!infos.isBind());
  210 + mAdapter.notifyItemChanged(curPosition, info);
  211 + }
  212 +
  213 + //类型 0手机号 3 微信 2 qq 1 微博
  214 + public void unBindSuccess() {
  215 + if (curPosition == -1 || mAdapter == null) return;
  216 + BindPhoneNumberInfo info = mAdapter.getItem(curPosition);
  217 + switch (info.getType()) {
  218 + case 1:
  219 + info.setUserName("未绑定微博");
  220 + UserService.getInstance(mangerActivity).setUserWBUID("");
  221 + break;
  222 + case 2:
  223 + info.setUserName("未绑定QQ");
  224 + UserService.getInstance(mangerActivity).setUserQQUID("");
  225 + break;
  226 + case 3:
  227 + info.setUserName("未绑定微信");
  228 + UserService.getInstance(mangerActivity).setUserWXUID("");
  229 + break;
  230 + }
  231 +
  232 + info.setBind(!info.isBind());
  233 + mAdapter.notifyItemChanged(curPosition, info);
  234 + showMessage("解绑成功");
  235 + }
  236 +
  237 +}
cloud/user/src/main/java/com/cnlive/cloud/user/ui/activity/BindPhoneMangerActivity.java 0 → 100644
  1 +package com.cnlive.cloud.user.ui.activity;
  2 +
  3 +
  4 +import android.app.Activity;
  5 +import android.content.Intent;
  6 +import android.text.TextUtils;
  7 +
  8 +import com.cnlive.cloud.user.R;
  9 +import com.cnlive.cloud.user.databinding.ActivityBindPhoneMangerBinding;
  10 +import com.cnlive.cloud.user.databinding.ActivityBindPhoneNumberBinding;
  11 +import com.cnlive.cloud.user.frame.presenter.BindPhoneMangerPresenter;
  12 +import com.cnlive.cloud.user.frame.view.BindPhoneMangerView;
  13 +import com.cnlive.cloud.user.model.BindPhoneNumberInfo;
  14 +import com.cnlive.core.libs.base.frame.activity.BaseActivity;
  15 +import com.cnlive.login.model.OtherUserInfo;
  16 +import com.cnlive.login.model.ThirdLoginInfo;
  17 +import com.cnlive.login.observer.ThirdLoginObservable;
  18 +import com.cnlive.login.observer.WechatLoginObservable;
  19 +import com.cnlive.login.utils.ThirdLoginUtil;
  20 +import com.cnlive.share.data.WeChatInfo;
  21 +
  22 +import java.util.Observable;
  23 +import java.util.Observer;
  24 +
  25 +import androidx.annotation.Nullable;
  26 +import androidx.databinding.ViewDataBinding;
  27 +
  28 +public class BindPhoneMangerActivity extends BaseActivity<BindPhoneMangerView, BindPhoneMangerPresenter> implements Observer {
  29 + //三方登陆的信息
  30 + public OtherUserInfo otherUserInfo;
  31 + //qq的权限
  32 + public final String ACOPE_ALL = "all";
  33 + public BindPhoneNumberInfo checkInfo;
  34 + public int openCode = 10010;
  35 + public ActivityBindPhoneMangerBinding binding;
  36 +
  37 + public static void startActivity(Activity context) {
  38 + Intent intent = new Intent();
  39 + intent.setClass(context, BindPhoneMangerActivity.class);
  40 + context.startActivity(intent);
  41 + }
  42 +
  43 + @Override
  44 + protected int getBindLayoutId() {
  45 + return R.layout.activity_bind_phone_manger;
  46 + }
  47 +
  48 + @Override
  49 + protected void initBindingLayoutData(ViewDataBinding baseBinding) {
  50 + binding = (ActivityBindPhoneMangerBinding) baseBinding;
  51 + }
  52 +
  53 + @Override
  54 + protected void initView() {
  55 + showDefaultWhiteStatusBar();
  56 + if (getMvpView() != null) getMvpView().initView();
  57 + initThreeLogin();
  58 + }
  59 +
  60 + /**
  61 + * 初始化第三方
  62 + */
  63 + private void initThreeLogin() {
  64 + ThirdLoginUtil.init(this);
  65 + WechatLoginObservable.getInstance().addObserver(this);
  66 + ThirdLoginObservable.getInstance().addObserver(this);
  67 + }
  68 +
  69 + @Override
  70 + protected void onResume() {
  71 + super.onResume();
  72 + showDefaultWhiteStatusBar();
  73 + }
  74 +
  75 + @Override
  76 + protected void onDestroy() {
  77 + super.onDestroy();
  78 + WechatLoginObservable.getInstance().deleteObserver(this);
  79 + ThirdLoginObservable.getInstance().deleteObserver(this);
  80 + }
  81 +
  82 + @Override
  83 + protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
  84 + super.onActivityResult(requestCode, resultCode, data);
  85 + if (resultCode == 10086 && requestCode == openCode && checkInfo != null) {
  86 + getPresenter().unBindLogin(this, checkInfo);
  87 + return;
  88 + } else if (resultCode == 10010 && requestCode == openCode) {
  89 + return;
  90 + }
  91 +
  92 + ThirdLoginUtil.getQQResult(requestCode, resultCode, data,false);
  93 + ThirdLoginUtil.getWeiboResult(requestCode, resultCode, data);
  94 + }
  95 +
  96 +
  97 + //微信登录回调接口
  98 + @Override
  99 + public void update(Observable observable, Object o) {
  100 + if (observable instanceof WechatLoginObservable && null != o) {
  101 + WeChatInfo weChatInfo = (WeChatInfo) o;
  102 + if (weChatInfo != null) {
  103 + otherUserInfo = new OtherUserInfo();
  104 + otherUserInfo.setFaceUrl(weChatInfo.getHeadimgurl());
  105 + if ("1".equals(weChatInfo.getSex())) {
  106 + otherUserInfo.setGender("m");
  107 + } else if ("2".equals(weChatInfo.getSex())) {
  108 + otherUserInfo.setGender("f");
  109 + } else {
  110 + otherUserInfo.setGender("n");
  111 + }
  112 +
  113 + otherUserInfo.setNickName(weChatInfo.getNickname());
  114 + if (!TextUtils.isEmpty(weChatInfo.getProvince())) {
  115 + otherUserInfo.setLocation(weChatInfo.getProvince());
  116 + } else {
  117 + otherUserInfo.setLocation(weChatInfo.getCountry());
  118 + }
  119 +
  120 + otherUserInfo.setThirdPartyId(weChatInfo.getUnionid());
  121 + otherUserInfo.setLoginType("3");
  122 + }
  123 + if (otherUserInfo != null && getPresenter() != null)
  124 + getPresenter().bindLogin(this, otherUserInfo);
  125 + } else if (observable instanceof ThirdLoginObservable) {
  126 + ThirdLoginInfo info = (ThirdLoginInfo) o;
  127 + if (info != null) {
  128 + if (info.getType() == 1) {
  129 + if (info.getOtherUserInfo() != null) otherUserInfo = info.getOtherUserInfo();
  130 + getPresenter().bindLogin(this, otherUserInfo);
  131 + } else if (info.getType() == 2) {
  132 + if (getMvpView() != null) getMvpView().showMessage(info.getMessage());
  133 + }
  134 + }
  135 +
  136 + }
  137 + }
  138 +}
cloud/user/src/main/java/com/cnlive/cloud/user/ui/activity/LoginDialogActivity.java
@@ -171,12 +171,12 @@ public class LoginDialogActivity extends BaseActivity&lt;LoginDialogView, LoginDial @@ -171,12 +171,12 @@ public class LoginDialogActivity extends BaseActivity&lt;LoginDialogView, LoginDial
171 // } 171 // }
172 else if (id == R.id.iv_qq) { 172 else if (id == R.id.iv_qq) {
173 if (DoublePressed.onDoublePressed()) return; 173 if (DoublePressed.onDoublePressed()) return;
174 - if (!ThirdLoginUtil.isQQInstalled(LoginDialogActivity.this) && getMvpView() != null) 174 + if (!ThirdLoginUtil.isQQInstalled(LoginDialogActivity.this,true) && getMvpView() != null)
175 getMvpView().showToast("您未安装该第三方应用,无法获取用户信息!"); 175 getMvpView().showToast("您未安装该第三方应用,无法获取用户信息!");
176 } else if (id == R.id.iv_wb) { 176 } else if (id == R.id.iv_wb) {
177 if (DoublePressed.onDoublePressed()) return; 177 if (DoublePressed.onDoublePressed()) return;
178 if (Util.isWeiboInstallAndInit(this)) { 178 if (Util.isWeiboInstallAndInit(this)) {
179 - ThirdLoginUtil.loginWeibo(LoginDialogActivity.this); 179 + ThirdLoginUtil.loginWeibo(LoginDialogActivity.this,true);
180 } else { 180 } else {
181 if (getMvpView() != null) getMvpView().showToast("您未安装该第三方应用,无法获取用户信息!"); 181 if (getMvpView() != null) getMvpView().showToast("您未安装该第三方应用,无法获取用户信息!");
182 } 182 }
@@ -251,7 +251,7 @@ public class LoginDialogActivity extends BaseActivity&lt;LoginDialogView, LoginDial @@ -251,7 +251,7 @@ public class LoginDialogActivity extends BaseActivity&lt;LoginDialogView, LoginDial
251 } 251 }
252 } 252 }
253 253
254 - ThirdLoginUtil.getQQResult(requestCode, resultCode, data); 254 + ThirdLoginUtil.getQQResult(requestCode, resultCode, data,true);
255 ThirdLoginUtil.getWeiboResult(requestCode, resultCode, data); 255 ThirdLoginUtil.getWeiboResult(requestCode, resultCode, data);
256 256
257 } 257 }
cloud/user/src/main/java/com/cnlive/cloud/user/ui/activity/UnBindThreeLoginCheckActivity.java 0 → 100644
  1 +package com.cnlive.cloud.user.ui.activity;
  2 +
  3 +import androidx.annotation.Nullable;
  4 +import androidx.appcompat.app.AppCompatActivity;
  5 +import androidx.databinding.DataBindingUtil;
  6 +
  7 +import android.app.Activity;
  8 +import android.content.Context;
  9 +import android.content.Intent;
  10 +import android.os.Bundle;
  11 +import android.view.View;
  12 +
  13 +import com.cnlive.cloud.user.R;
  14 +import com.cnlive.cloud.user.databinding.ActivityUnBindThreeLoginCheckBinding;
  15 +
  16 +public class UnBindThreeLoginCheckActivity extends AppCompatActivity implements View.OnClickListener {
  17 +
  18 + private ActivityUnBindThreeLoginCheckBinding binding;
  19 +
  20 + public static void startUnBindThreeLoginCheckActivity(Context context, int openCode) {
  21 + Intent intent = new Intent(context, UnBindThreeLoginCheckActivity.class);
  22 + Activity activity = (Activity) context;
  23 + activity.startActivityForResult(intent,openCode);
  24 + activity.overridePendingTransition(R.anim.activity_trans, R.anim.activity_out);
  25 + }
  26 +
  27 +
  28 + @Override
  29 + protected void onCreate(@Nullable Bundle savedInstanceState) {
  30 + super.onCreate(savedInstanceState);
  31 + binding = DataBindingUtil.setContentView(this, R.layout.activity_un_bind_three_login_check);
  32 + binding.tvOk.setOnClickListener(this);
  33 + binding.tvCancle.setOnClickListener(this);
  34 + }
  35 +
  36 +
  37 + @Override
  38 + public void finish() {
  39 + super.finish();
  40 + overridePendingTransition(R.anim.activity_trans, R.anim.fade_out);
  41 + }
  42 +
  43 +
  44 + @Override
  45 + public void onClick(View view) {
  46 + Intent intent=new Intent();
  47 + if (view.getId() == R.id.tv_ok) {
  48 + setResult(10086, intent);
  49 + finish();
  50 + } else if (view.getId() == R.id.tv_cancle) {
  51 + setResult(10010, intent);
  52 + finish();
  53 + finish();
  54 + }
  55 +
  56 + }
  57 +}
cloud/user/src/main/java/com/cnlive/cloud/user/ui/adapter/BindPhoneNumberAdapter.java 0 → 100644
  1 +package com.cnlive.cloud.user.ui.adapter;
  2 +
  3 +import android.content.Context;
  4 +import android.view.LayoutInflater;
  5 +import android.view.View;
  6 +import android.view.ViewGroup;
  7 +
  8 +import com.cnlive.cloud.user.R;
  9 +import com.cnlive.cloud.user.databinding.ItemBindTitleBinding;
  10 +import com.cnlive.cloud.user.databinding.ItemBindUserBinding;
  11 +import com.cnlive.cloud.user.model.BindPhoneNumberInfo;
  12 +import com.cnlive.core.libs.base.frame.adapter.DataBindingAdapter;
  13 +import com.cnlive.core.libs.base.frame.adapter.holder.DataBindingViewHolder;
  14 +
  15 +import androidx.databinding.DataBindingUtil;
  16 +import androidx.databinding.ViewDataBinding;
  17 +import androidx.recyclerview.widget.RecyclerView;
  18 +
  19 +/**
  20 + * 作者: 吴奎庆
  21 + * <p>
  22 + * 时间: 2019/9/9
  23 + * <p>
  24 + * 简介:
  25 + */
  26 +public class BindPhoneNumberAdapter extends DataBindingAdapter<BindPhoneNumberInfo> {
  27 + Context mContext;
  28 + OnItemClickListener listener;
  29 +
  30 + public BindPhoneNumberAdapter(Context context) {
  31 + super(context);
  32 + mContext = context;
  33 + }
  34 +
  35 + public void setItemClickListener(OnItemClickListener listener) {
  36 + this.listener = listener;
  37 +
  38 + }
  39 +
  40 + @Override
  41 + public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
  42 +
  43 + switch (viewType) {
  44 + case BindPhoneNumberInfo.TYPE_TITLE:
  45 + ViewDataBinding titleDataBinding = DataBindingUtil.inflate(LayoutInflater.from(mContext), R.layout.item_bind_title, parent, false);
  46 + DataBindingViewHolder titleViewHolder = new DataBindingViewHolder(titleDataBinding.getRoot());
  47 + titleViewHolder.setBinding(titleDataBinding);
  48 + return titleViewHolder;
  49 +
  50 + case BindPhoneNumberInfo.TYPE_LOGIN:
  51 + ViewDataBinding titlelogin = DataBindingUtil.inflate(LayoutInflater.from(mContext), R.layout.item_bind_user, parent, false);
  52 + DataBindingViewHolder loginHolder = new DataBindingViewHolder(titlelogin.getRoot());
  53 + loginHolder.setBinding(titlelogin);
  54 + return loginHolder;
  55 +
  56 + }
  57 + return null;
  58 + }
  59 +
  60 + @Override
  61 + public int getItemViewType(int position) {
  62 + return mItems.get(position).getItemType();
  63 + }
  64 +
  65 + @Override
  66 + public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
  67 + super.onBindViewHolder(holder, position);
  68 + int itemType = getItem(position).getItemType();
  69 + DataBindingViewHolder bindingViewHolder = (DataBindingViewHolder) holder;
  70 + switch (itemType) {
  71 + case BindPhoneNumberInfo.TYPE_TITLE:
  72 + ItemBindTitleBinding bindTitleBinding = (ItemBindTitleBinding) bindingViewHolder.getBinding();
  73 + bindTitleBinding.setData(getItem(position));
  74 + break;
  75 + case BindPhoneNumberInfo.TYPE_LOGIN:
  76 + ItemBindUserBinding bindUserBinding = (ItemBindUserBinding) bindingViewHolder.getBinding();
  77 + bindUserBinding.setData(getItem(position));
  78 + bindUserBinding.tvBind.setOnClickListener(view -> {
  79 + listener.onItemClick(getItem(position), bindUserBinding.tvBind,position);
  80 + });
  81 + break;
  82 + }
  83 + }
  84 +
  85 +
  86 + public interface OnItemClickListener {
  87 + void onItemClick(BindPhoneNumberInfo info, View view, int position);
  88 + }
  89 +}
cloud/user/src/main/java/com/cnlive/cloud/user/ui/fragment/QuickLoginFragment.java
@@ -186,12 +186,12 @@ public class QuickLoginFragment extends BaseFragment&lt;QuickLoginView, QuickLoginP @@ -186,12 +186,12 @@ public class QuickLoginFragment extends BaseFragment&lt;QuickLoginView, QuickLoginP
186 186
187 }else if (id == R.id.iv_qq) { 187 }else if (id == R.id.iv_qq) {
188 if (DoublePressed.onDoublePressed()) return; 188 if (DoublePressed.onDoublePressed()) return;
189 - if (!ThirdLoginUtil.isQQInstalled(getActivity()) && getMvpView() != null) 189 + if (!ThirdLoginUtil.isQQInstalled(getActivity(),true) && getMvpView() != null)
190 getMvpView().showToast("您未安装该第三方应用,无法获取用户信息!"); 190 getMvpView().showToast("您未安装该第三方应用,无法获取用户信息!");
191 } else if (id == R.id.iv_wb) { 191 } else if (id == R.id.iv_wb) {
192 if (DoublePressed.onDoublePressed()) return; 192 if (DoublePressed.onDoublePressed()) return;
193 if (Util.isWeiboInstallAndInit(getActivity())) { 193 if (Util.isWeiboInstallAndInit(getActivity())) {
194 - ThirdLoginUtil.loginWeibo(getActivity()); 194 + ThirdLoginUtil.loginWeibo(getActivity(),true);
195 } else { 195 } else {
196 if (getMvpView() != null) getMvpView().showToast("您未安装该第三方应用,无法获取用户信息!"); 196 if (getMvpView() != null) getMvpView().showToast("您未安装该第三方应用,无法获取用户信息!");
197 } 197 }
@@ -265,7 +265,7 @@ public class QuickLoginFragment extends BaseFragment&lt;QuickLoginView, QuickLoginP @@ -265,7 +265,7 @@ public class QuickLoginFragment extends BaseFragment&lt;QuickLoginView, QuickLoginP
265 } 265 }
266 } 266 }
267 267
268 - ThirdLoginUtil.getQQResult(requestCode, resultCode, data); 268 + ThirdLoginUtil.getQQResult(requestCode, resultCode, data,true);
269 ThirdLoginUtil.getWeiboResult(requestCode, resultCode, data); 269 ThirdLoginUtil.getWeiboResult(requestCode, resultCode, data);
270 } 270 }
271 271
cloud/user/src/main/res/drawable-hdpi/bind_phone.webp 0 → 100644
No preview for this file type
cloud/user/src/main/res/drawable-xhdpi/bind_phone.webp 0 → 100644
No preview for this file type
cloud/user/src/main/res/drawable-xxhdpi/bind_phone.webp 0 → 100644
No preview for this file type
cloud/user/src/main/res/drawable/shape_bind_black_bg.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<shape android:shape="rectangle"
  3 + xmlns:android="http://schemas.android.com/apk/res/android">
  4 + <solid android:color="#D9D9D9" />
  5 + <corners android:topLeftRadius="15dp" android:topRightRadius="15dp" android:bottomLeftRadius="15dp" android:bottomRightRadius="15dp" />
  6 +</shape>
0 \ No newline at end of file 7 \ No newline at end of file
cloud/user/src/main/res/drawable/shape_bind_green_bg.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<shape android:shape="rectangle"
  3 + xmlns:android="http://schemas.android.com/apk/res/android">
  4 + <solid android:color="#ff23d41e" />
  5 + <corners android:topLeftRadius="15dp" android:topRightRadius="15dp" android:bottomLeftRadius="15dp" android:bottomRightRadius="15dp" />
  6 +</shape>
0 \ No newline at end of file 7 \ No newline at end of file
cloud/user/src/main/res/drawable/shape_update.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<shape xmlns:android="http://schemas.android.com/apk/res/android">
  3 + <solid android:color="@color/white" />
  4 + <corners android:topLeftRadius="10dp"
  5 + android:topRightRadius="10dp"
  6 + android:bottomRightRadius="10dp"
  7 + android:bottomLeftRadius="10dp"/>
  8 +
  9 + <!-- 间隔 -->
  10 + <!--<padding-->
  11 + <!--android:left="10dp"-->
  12 + <!--android:top="3dp"-->
  13 + <!--android:right="10dp"-->
  14 + <!--android:bottom="3dp"/>&lt;!&ndash; 各方向的间隔 &ndash;&gt;-->
  15 + <stroke android:width="1dp" android:color="@color/white" />
  16 +</shape>
0 \ No newline at end of file 17 \ No newline at end of file
cloud/user/src/main/res/layout/activity_bind_phone_manger.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<layout>
  3 +
  4 +
  5 + <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  6 + android:layout_width="match_parent"
  7 + android:layout_height="match_parent"
  8 + android:background="@color/white"
  9 + android:orientation="vertical">
  10 +
  11 + <include
  12 + android:id="@+id/includeToolbar"
  13 + layout="@layout/layout_title_toolbar" />
  14 +
  15 + <View
  16 + android:id="@+id/line"
  17 + android:layout_width="match_parent"
  18 + android:layout_height="1dp"
  19 + android:layout_below="@+id/includeToolbar"
  20 + android:background="@color/whiteGary" />
  21 +
  22 + <androidx.recyclerview.widget.RecyclerView
  23 + android:background="#F4F4F4"
  24 + android:id="@+id/rv_content"
  25 + android:layout_width="match_parent"
  26 + android:layout_height="match_parent" />
  27 +
  28 +
  29 + </LinearLayout>
  30 +
  31 +</layout>
cloud/user/src/main/res/layout/activity_un_bind_three_login_check.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<layout xmlns:android="http://schemas.android.com/apk/res/android">
  3 +
  4 + <RelativeLayout
  5 + android:id="@+id/root"
  6 + android:layout_width="match_parent"
  7 + android:layout_height="match_parent"
  8 + android:layout_gravity="center"
  9 + android:background="@color/transparent">
  10 +
  11 +
  12 + <LinearLayout
  13 + android:layout_width="match_parent"
  14 + android:layout_height="wrap_content"
  15 + android:layout_centerInParent="true"
  16 + android:layout_margin="20dp"
  17 + android:layout_marginLeft="2dp"
  18 + android:layout_marginRight="2dp"
  19 + android:background="@drawable/shape_update"
  20 + android:orientation="vertical">
  21 +
  22 + <TextView
  23 + android:id="@+id/tv_title"
  24 + android:layout_width="wrap_content"
  25 + android:layout_height="wrap_content"
  26 + android:layout_gravity="center_horizontal"
  27 + android:layout_marginLeft="10dp"
  28 + android:layout_marginTop="48dp"
  29 + android:layout_marginRight="10dp"
  30 + android:background="@null"
  31 + android:text="确定解除绑定? "
  32 + android:textColor="@color/black"
  33 + android:textSize="18sp" />
  34 +
  35 +
  36 + <View
  37 + android:layout_marginTop="30dp"
  38 + android:layout_width="match_parent"
  39 + android:layout_height="1dp"
  40 + android:background="@color/driver_list" />
  41 +
  42 + <LinearLayout
  43 + android:layout_width="match_parent"
  44 + android:layout_height="wrap_content"
  45 + android:layout_gravity="center_horizontal"
  46 + android:gravity="center"
  47 + android:orientation="vertical">
  48 +
  49 + <LinearLayout
  50 + android:layout_width="match_parent"
  51 + android:layout_height="44dp"
  52 + android:orientation="horizontal">
  53 +
  54 + <TextView
  55 + android:id="@+id/tv_cancle"
  56 + android:layout_width="0dp"
  57 + android:layout_height="wrap_content"
  58 + android:layout_weight="1"
  59 + android:gravity="center"
  60 + android:padding="10dp"
  61 + android:singleLine="true"
  62 + android:text="取消"
  63 + android:textColor="@color/color_23d41e"
  64 + android:textSize="17sp" />
  65 +
  66 + <View
  67 + android:layout_width="1dp"
  68 + android:layout_height="match_parent"
  69 + android:background="@color/driver_list" />
  70 +
  71 + <TextView
  72 + android:id="@+id/tv_ok"
  73 + android:layout_width="0dp"
  74 + android:layout_height="wrap_content"
  75 + android:layout_weight="1"
  76 + android:gravity="center"
  77 + android:padding="10dp"
  78 + android:singleLine="true"
  79 + android:text="确定"
  80 + android:textColor="@color/color_23d41e"
  81 + android:textSize="17sp" />
  82 +
  83 +
  84 + </LinearLayout>
  85 +
  86 +
  87 + </LinearLayout>
  88 +
  89 +
  90 + </LinearLayout>
  91 +
  92 +
  93 + </RelativeLayout>
  94 +
  95 +
  96 +</layout>
0 \ No newline at end of file 97 \ No newline at end of file
cloud/user/src/main/res/layout/item_bind_title.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<layout>
  3 +
  4 + <data>
  5 +
  6 + <variable
  7 + name="data"
  8 + type="com.cnlive.cloud.user.model.BindPhoneNumberInfo" />
  9 +
  10 + </data>
  11 +
  12 + <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  13 + android:layout_width="match_parent"
  14 + android:background="#F4F4F4"
  15 + android:layout_height="38dp">
  16 + <TextView
  17 + android:id="@+id/tv_title"
  18 + android:layout_marginLeft="15.5dp"
  19 + android:layout_gravity="center_vertical"
  20 + android:layout_width="wrap_content"
  21 + android:layout_height="wrap_content"
  22 + android:text="@{data.itemName}"
  23 + android:textColor="#ff999999"
  24 + android:textSize="14sp"
  25 + />
  26 + </LinearLayout>
  27 +</layout>
cloud/user/src/main/res/layout/item_bind_user.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<layout>
  3 +
  4 + <data>
  5 + <variable
  6 + name="data"
  7 + type="com.cnlive.cloud.user.model.BindPhoneNumberInfo" />
  8 +
  9 + </data>
  10 +
  11 + <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  12 + android:layout_width="match_parent"
  13 + android:layout_height="77dp"
  14 + android:background="@color/white">
  15 +
  16 + <ImageView
  17 + android:id="@+id/iv_login"
  18 + android:layout_width="47dp"
  19 + android:layout_height="47dp"
  20 + android:layout_centerVertical="true"
  21 + android:layout_marginLeft="15dp"
  22 + android:src="@{data.typeIcon}" />
  23 +
  24 +
  25 + <LinearLayout
  26 + android:layout_width="wrap_content"
  27 + android:layout_height="wrap_content"
  28 + android:layout_centerVertical="true"
  29 + android:layout_marginLeft="11.5dp"
  30 + android:layout_toRightOf="@+id/iv_login"
  31 + android:orientation="vertical">
  32 +
  33 + <TextView
  34 + android:layout_width="wrap_content"
  35 + android:layout_height="wrap_content"
  36 + android:text="@{data.typeName}"
  37 + android:textColor="#ff333333"
  38 + android:textSize="16sp" />
  39 +
  40 + <TextView
  41 + android:layout_width="wrap_content"
  42 + android:layout_height="wrap_content"
  43 + android:text="@{data.userName}"
  44 + android:textColor="#ff999999"
  45 + android:textSize="12sp" />
  46 + </LinearLayout>
  47 +
  48 +
  49 + <TextView
  50 + android:id="@+id/tv_bind"
  51 + android:layout_width="68dp"
  52 + android:layout_height="30dp"
  53 + android:layout_alignParentRight="true"
  54 + android:layout_centerVertical="true"
  55 + android:layout_marginRight="15dp"
  56 + android:background="@{data.bind?@drawable/shape_bind_black_bg:@drawable/shape_bind_green_bg}"
  57 + android:gravity="center"
  58 + android:text="@{data.bind?@string/three_login_bind:@string/three_login_bind_un}"
  59 + android:textColor="@color/white" />
  60 +
  61 + </RelativeLayout>
  62 +</layout>
cloud/user/src/main/res/values/strings.xml
@@ -20,4 +20,6 @@ @@ -20,4 +20,6 @@
20 20
21 <string name="msg_exit">再次点击退出网家家</string> 21 <string name="msg_exit">再次点击退出网家家</string>
22 <string name="msg_exit_login">再次点击返回登录</string> 22 <string name="msg_exit_login">再次点击返回登录</string>
  23 + <string name="three_login_bind">已绑定</string>
  24 + <string name="three_login_bind_un">未绑定</string>
23 </resources> 25 </resources>
core/network/src/main/java/com/cnlive/core/network/api/ApiBaseServiceOpen.java
@@ -14,6 +14,7 @@ import java.util.Map; @@ -14,6 +14,7 @@ import java.util.Map;
14 import io.reactivex.Observable; 14 import io.reactivex.Observable;
15 import okhttp3.MultipartBody; 15 import okhttp3.MultipartBody;
16 import okhttp3.RequestBody; 16 import okhttp3.RequestBody;
  17 +import retrofit2.adapter.rxjava2.Result;
17 import retrofit2.http.Multipart; 18 import retrofit2.http.Multipart;
18 import retrofit2.http.POST; 19 import retrofit2.http.POST;
19 import retrofit2.http.Part; 20 import retrofit2.http.Part;
@@ -177,4 +178,20 @@ public interface ApiBaseServiceOpen { @@ -177,4 +178,20 @@ public interface ApiBaseServiceOpen {
177 @POST("open/api2/user/loginIn3rdAndMobileForWJJ") 178 @POST("open/api2/user/loginIn3rdAndMobileForWJJ")
178 Observable<BaseResult<UserData>> loginIn3rdAndMobileForWJJ(@QueryMap Map<String, String> map); 179 Observable<BaseResult<UserData>> loginIn3rdAndMobileForWJJ(@QueryMap Map<String, String> map);
179 180
  181 +
  182 + /**
  183 + * 解除绑定
  184 + * @param map
  185 + * @return
  186 + */
  187 + @POST("open/api2/user/unBind3rd")
  188 + Observable<BaseResult> unBind3rd(@QueryMap Map<String, String> map);
  189 +
  190 + /**
  191 + * 绑定
  192 + * @param map
  193 + * @return
  194 + */
  195 + @POST("open/api2/user/bind3rd")
  196 + Observable<BaseResult> bind3rd(@QueryMap Map<String, String> map);
180 } 197 }