|
|
@@ -8,7 +8,6 @@ import android.os.Bundle;
|
|
8
|
8
|
import android.os.Handler;
|
|
9
|
9
|
import android.os.Message;
|
|
10
|
10
|
import android.text.TextUtils;
|
|
11
|
|
-import android.util.Log;
|
|
12
|
11
|
import android.view.View;
|
|
13
|
12
|
import android.widget.Toast;
|
|
14
|
13
|
|
|
|
@@ -33,19 +32,17 @@ import com.yihucha.hbyhc.network.BaseObserver;
|
|
33
|
32
|
import com.yihucha.hbyhc.network.DataResponse;
|
|
34
|
33
|
import com.yihucha.hbyhc.network.NetworkApi;
|
|
35
|
34
|
import com.yihucha.hbyhc.network.service.AuthService;
|
|
36
|
|
-import com.yihucha.hbyhc.presentation.agent.IncomeDetailActivity;
|
|
37
|
|
-import com.yihucha.hbyhc.presentation.login.model.LoginModel;
|
|
38
|
35
|
import com.yihucha.hbyhc.presentation.mine.model.BindingStateBean;
|
|
39
|
36
|
import com.yihucha.hbyhc.presentation.mine.view_model.BindingStateBViewModel;
|
|
40
|
|
-import com.yihucha.hbyhc.utils.DataCleanManager;
|
|
41
|
|
-import com.yihucha.hbyhc.utils.GlideUtils;
|
|
42
|
37
|
import com.yihucha.hbyhc.utils.LogUtil;
|
|
43
|
38
|
import com.yihucha.hbyhc.view.CustomDialog;
|
|
44
|
39
|
import com.yihucha.hbyhc.view.MyToast;
|
|
45
|
|
-import com.yihucha.hbyhc.view.ShowLoadingDialog;
|
|
|
40
|
+
|
|
|
41
|
+import org.greenrobot.eventbus.EventBus;
|
|
|
42
|
+import org.greenrobot.eventbus.Subscribe;
|
|
|
43
|
+import org.greenrobot.eventbus.ThreadMode;
|
|
46
|
44
|
|
|
47
|
45
|
import java.util.HashMap;
|
|
48
|
|
-import java.util.List;
|
|
49
|
46
|
import java.util.Map;
|
|
50
|
47
|
|
|
51
|
48
|
/**
|
|
|
@@ -117,6 +114,7 @@ public class ThirdPartyBindingActivity extends ViewBindingTitleBaseActivity<Acti
|
|
117
|
114
|
initView();
|
|
118
|
115
|
initClick();
|
|
119
|
116
|
initData();
|
|
|
117
|
+ EventBus.getDefault().register(this);
|
|
120
|
118
|
}
|
|
121
|
119
|
|
|
122
|
120
|
@Override
|
|
|
@@ -125,60 +123,70 @@ public class ThirdPartyBindingActivity extends ViewBindingTitleBaseActivity<Acti
|
|
125
|
123
|
number = 0 ;
|
|
126
|
124
|
mBindingStateBViewModel.getBindingState();
|
|
127
|
125
|
}
|
|
|
126
|
+ @Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
127
|
+ public void refreshState(String msg){
|
|
|
128
|
+ if ("success".equals(msg)){
|
|
|
129
|
+ mBindingStateBViewModel.getBindingState();
|
|
|
130
|
+ }
|
|
|
131
|
+ }
|
|
|
132
|
+
|
|
|
133
|
+ @Override
|
|
|
134
|
+ protected void onDestroy() {
|
|
|
135
|
+ super.onDestroy();
|
|
|
136
|
+ EventBus.getDefault().unregister(this);
|
|
|
137
|
+ }
|
|
128
|
138
|
|
|
129
|
139
|
private void initData() {
|
|
130
|
140
|
|
|
131
|
141
|
flagWechatAuthorization = false ;
|
|
132
|
142
|
flagAlipayAuthorization = false;
|
|
133
|
|
- mBindingStateBViewModel.mBindingStateBean.observe(this, new Observer<List<BindingStateBean>>() {
|
|
134
|
|
- @Override
|
|
135
|
|
- public void onChanged(List<BindingStateBean> bindingStateBeans) {
|
|
136
|
|
-
|
|
137
|
|
- for (int i = 0; i < bindingStateBeans.size(); i++) {
|
|
138
|
|
- if (bindingStateBeans.get(i).getType().equals("1")) {
|
|
139
|
|
- wechatBean = bindingStateBeans.get(i);
|
|
140
|
|
- mViewBinding.tvWxBeAuthorized.setVisibility(View.VISIBLE);
|
|
141
|
|
- mViewBinding.tvWxUnauthorized.setVisibility(View.GONE);
|
|
142
|
|
- mViewBinding.llWechatInfo.setVisibility(View.VISIBLE);
|
|
143
|
|
- String imageUrl = wechatBean.getAvater(); // Replace with your actual IP address and image path
|
|
144
|
|
- Glide.with(ThirdPartyBindingActivity.this)
|
|
145
|
|
- .load(imageUrl)
|
|
146
|
|
- .apply(RequestOptions.circleCropTransform()) // Apply circular crop
|
|
147
|
|
- .placeholder(R.mipmap.wx_sf_220908) // Optional: Add a placeholder image
|
|
148
|
|
- .error(R.mipmap.wx_sf_220908) // Optional: Add an error image
|
|
149
|
|
- .into(mViewBinding.llWechatProfile);
|
|
150
|
|
- mViewBinding.llWechatName.setText(wechatBean.getNickname());
|
|
|
143
|
+ mBindingStateBViewModel.mBindingStateBean.observe(this, bindingStateBeans -> {
|
|
|
144
|
+
|
|
|
145
|
+ for (int i = 0; i < bindingStateBeans.size(); i++) {
|
|
|
146
|
+ if (bindingStateBeans.get(i).getType().equals("1")) {
|
|
|
147
|
+ wechatBean = bindingStateBeans.get(i);
|
|
|
148
|
+ mViewBinding.tvWxBeAuthorized.setVisibility(View.VISIBLE);
|
|
|
149
|
+ mViewBinding.tvWxUnauthorized.setVisibility(View.GONE);
|
|
|
150
|
+ mViewBinding.llWechatInfo.setVisibility(View.VISIBLE);
|
|
|
151
|
+ String imageUrl = wechatBean.getAvater(); // Replace with your actual IP address and image path
|
|
|
152
|
+ Glide.with(ThirdPartyBindingActivity.this)
|
|
|
153
|
+ .load(imageUrl)
|
|
|
154
|
+ .apply(RequestOptions.circleCropTransform()) // Apply circular crop
|
|
|
155
|
+ .placeholder(R.mipmap.wx_sf_220908) // Optional: Add a placeholder image
|
|
|
156
|
+ .error(R.mipmap.wx_sf_220908) // Optional: Add an error image
|
|
|
157
|
+ .into(mViewBinding.llWechatProfile);
|
|
|
158
|
+ mViewBinding.llWechatName.setText(wechatBean.getNickname());
|
|
151
|
159
|
|
|
152
|
160
|
// mViewBinding.llWechatAuthorization.setEnabled(false);
|
|
153
|
161
|
// mViewBinding.llWechatAuthorization.setClickable(false);
|
|
154
|
|
- flagWechatAuthorization = true ;
|
|
155
|
|
- wechatBtnClickFlag = false;
|
|
156
|
|
- }
|
|
157
|
|
- else if (bindingStateBeans.get(i).getType().equals("2")) {
|
|
158
|
|
- alipayBean = bindingStateBeans.get(i);
|
|
159
|
|
- mViewBinding.tvAlipayBeAuthorized.setVisibility(View.VISIBLE);
|
|
160
|
|
- mViewBinding.tvAlipayUnauthorized.setVisibility(View.GONE);
|
|
161
|
|
- mViewBinding.llAlipayInfo.setVisibility(View.VISIBLE);
|
|
162
|
|
- alipayBtnClickFlag = false;
|
|
163
|
|
-// mViewBinding.llAlipayAuthorization.setEnabled(false);
|
|
164
|
|
-// mViewBinding.llAlipayAuthorization.setClickable(false);
|
|
165
|
|
- String imageUrl = alipayBean.getAvater(); // Replace with your actual IP address and image path
|
|
166
|
|
- Glide.with(ThirdPartyBindingActivity.this)
|
|
167
|
|
- .load(imageUrl)
|
|
168
|
|
- .apply(RequestOptions.circleCropTransform()) // Apply circular crop
|
|
169
|
|
- .placeholder(R.mipmap.zfb_sf_220908) // Optional: Add a placeholder image
|
|
170
|
|
- .error(R.mipmap.zfb_sf_220908) // Optional: Add an error image
|
|
171
|
|
- .into(mViewBinding.llAlipayProfile);
|
|
172
|
|
-
|
|
173
|
|
- mViewBinding.llAlipayName.setText(alipayBean.getNickname());
|
|
174
|
|
- flagAlipayAuthorization = true;
|
|
175
|
|
- }
|
|
176
|
|
- }
|
|
177
|
|
-
|
|
178
|
|
- if(wechatBtnClickFlag || alipayBtnClickFlag){
|
|
179
|
|
- mBindingStateBViewModel.getBindingState();
|
|
|
162
|
+ flagWechatAuthorization = true;
|
|
|
163
|
+ wechatBtnClickFlag = false;
|
|
|
164
|
+ } else if (bindingStateBeans.get(i).getType().equals("2")) {
|
|
|
165
|
+ alipayBean = bindingStateBeans.get(i);
|
|
|
166
|
+ mViewBinding.tvAlipayBeAuthorized.setVisibility(View.VISIBLE);
|
|
|
167
|
+ mViewBinding.tvAlipayUnauthorized.setVisibility(View.GONE);
|
|
|
168
|
+ mViewBinding.llAlipayInfo.setVisibility(View.VISIBLE);
|
|
|
169
|
+ alipayBtnClickFlag = false;
|
|
|
170
|
+ String imageUrl = alipayBean.getAvater(); // Replace with your actual IP address and image path
|
|
|
171
|
+ Glide.with(ThirdPartyBindingActivity.this)
|
|
|
172
|
+ .load(imageUrl)
|
|
|
173
|
+ .apply(RequestOptions.circleCropTransform()) // Apply circular crop
|
|
|
174
|
+ .placeholder(R.mipmap.zfb_sf_220908) // Optional: Add a placeholder image
|
|
|
175
|
+ .error(R.mipmap.zfb_sf_220908) // Optional: Add an error image
|
|
|
176
|
+ .into(mViewBinding.llAlipayProfile);
|
|
|
177
|
+
|
|
|
178
|
+ mViewBinding.llAlipayName.setText(alipayBean.getNickname());
|
|
|
179
|
+ flagAlipayAuthorization = true;
|
|
180
|
180
|
}
|
|
181
|
181
|
}
|
|
|
182
|
+/*
|
|
|
183
|
+ if(wechatBtnClickFlag || alipayBtnClickFlag){
|
|
|
184
|
+ mBindingStateBViewModel.getBindingState();
|
|
|
185
|
+ }*/
|
|
|
186
|
+ });
|
|
|
187
|
+
|
|
|
188
|
+ mBindingStateBViewModel.mUpdateAccountData.observe(this, updateAccountBean -> {
|
|
|
189
|
+ mBindingStateBViewModel.getBindingState();
|
|
182
|
190
|
});
|
|
183
|
191
|
|
|
184
|
192
|
mBindingStateBViewModel.failed.observe(this, s -> {
|