|
@@ -18,13 +18,17 @@ import com.kuxuan.moneynote.base.BaseActivity;
|
18
|
18
|
import com.kuxuan.moneynote.common.Constant;
|
19
|
19
|
import com.kuxuan.moneynote.json.BaseJson;
|
20
|
20
|
import com.kuxuan.moneynote.json.netbody.CheckMobileBody;
|
|
21
|
+import com.kuxuan.moneynote.ui.activitys.eventbus.LoginOutEvent;
|
21
|
22
|
import com.kuxuan.moneynote.ui.weight.CustormDialog;
|
22
|
23
|
import com.kuxuan.moneynote.utils.AppManager;
|
|
24
|
+import com.kuxuan.moneynote.utils.LoginStatusUtil;
|
23
|
25
|
import com.kuxuan.moneynote.utils.SPUtil;
|
24
|
26
|
import com.kuxuan.moneynote.utils.ToastUtil;
|
25
|
27
|
import com.kuxuan.moneynote.utils.UIHelper;
|
26
|
28
|
import com.umeng.analytics.MobclickAgent;
|
27
|
29
|
|
|
30
|
+import org.greenrobot.eventbus.EventBus;
|
|
31
|
+
|
28
|
32
|
import butterknife.Bind;
|
29
|
33
|
import butterknife.OnClick;
|
30
|
34
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
|
@@ -70,7 +74,6 @@ public class BindActivity extends BaseActivity {
|
70
|
74
|
e.printStackTrace();
|
71
|
75
|
}
|
72
|
76
|
|
73
|
|
-
|
74
|
77
|
register_btn.setText(getResources().getString(R.string.next_step));
|
75
|
78
|
getTitleView(1).setTitle(getResources().getString(R.string.bind_phone));
|
76
|
79
|
|
|
@@ -78,14 +81,18 @@ public class BindActivity extends BaseActivity {
|
78
|
81
|
@Override
|
79
|
82
|
public void onClick(View view) {
|
80
|
83
|
|
81
|
|
-
|
82
|
|
- if(isFirstWechatLogin){
|
|
84
|
+ boolean iswechat_newUserFirstLogin = (boolean) SPUtil.get(getApplicationContext(),Constant.IsFirstWEiChatLogin.ISWECHATNEWUSERFIRSTLOGIN,true);
|
|
85
|
+ if(isFirstWechatLogin&&iswechat_newUserFirstLogin){
|
83
|
86
|
|
84
|
87
|
//老用户
|
85
|
|
- if(!newUser){
|
86
|
|
- oldUser();
|
|
88
|
+ if(newUser){
|
|
89
|
+ if(iswechat_newUserFirstLogin) {
|
|
90
|
+ newUser();
|
|
91
|
+ }else {
|
|
92
|
+ finish();
|
|
93
|
+ }
|
87
|
94
|
}else {
|
88
|
|
- newUser();
|
|
95
|
+ oldUser();
|
89
|
96
|
}
|
90
|
97
|
|
91
|
98
|
}else {
|
|
@@ -108,12 +115,12 @@ public class BindActivity extends BaseActivity {
|
108
|
115
|
|
109
|
116
|
builder.setMessage("为了保证您的数据安全与多账户数据同步,请您绑定手机号,以免导致数据丢失");
|
110
|
117
|
|
|
118
|
+ SPUtil.putAndApply(getApplicationContext(),Constant.IsFirstWEiChatLogin.ISWECHATNEWUSERFIRSTLOGIN,false);
|
|
119
|
+
|
111
|
120
|
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
|
112
|
121
|
@Override
|
113
|
122
|
public void onClick(DialogInterface dialog, int which) {
|
114
|
|
-
|
115
|
123
|
dialog.dismiss();
|
116
|
|
-
|
117
|
124
|
}
|
118
|
125
|
});
|
119
|
126
|
|
|
@@ -267,25 +274,32 @@ public class BindActivity extends BaseActivity {
|
267
|
274
|
@Override
|
268
|
275
|
public void onBackPressed() {
|
269
|
276
|
|
270
|
|
- if(isFirstWechatLogin){
|
|
277
|
+ boolean iswechat_newUserFirstLogin = (boolean) SPUtil.get(getApplicationContext(),Constant.IsFirstWEiChatLogin.ISWECHATNEWUSERFIRSTLOGIN,true);
|
271
|
278
|
|
|
279
|
+ if(isFirstWechatLogin){
|
272
|
280
|
//老用户
|
273
|
|
- if(!newUser){
|
274
|
|
-
|
275
|
|
- oldUser();
|
|
281
|
+ if(newUser){
|
|
282
|
+ if(iswechat_newUserFirstLogin) {
|
|
283
|
+ newUser();
|
|
284
|
+ }else {
|
|
285
|
+ finish();
|
|
286
|
+ }
|
276
|
287
|
|
277
|
288
|
}else {
|
278
|
|
-
|
279
|
|
- newUser();
|
280
|
|
-
|
|
289
|
+ oldUser();
|
281
|
290
|
}
|
282
|
|
-
|
283
|
291
|
}else {
|
284
|
292
|
finish();
|
285
|
293
|
}
|
286
|
294
|
|
287
|
295
|
}
|
288
|
296
|
|
|
297
|
+ private void finishLoginOut() {
|
|
298
|
+ SPUtil.remove(getApplicationContext(),Constant.IsFirstWEiChatLogin.ISWECHATNEWUSERFIRSTLOGIN);
|
|
299
|
+ LoginStatusUtil.loginOut();
|
|
300
|
+ EventBus.getDefault().post(new LoginOutEvent());
|
|
301
|
+ }
|
|
302
|
+
|
289
|
303
|
private void goToNext() {
|
290
|
304
|
Bundle bundle = new Bundle();
|
291
|
305
|
bundle.putString(BindPhoneActivity.PHONE, editText.getText().toString());
|
|
@@ -294,6 +308,15 @@ public class BindActivity extends BaseActivity {
|
294
|
308
|
}
|
295
|
309
|
@Override
|
296
|
310
|
protected void onDestroy() {
|
|
311
|
+ boolean iswechat_newUserFirstLogin = (boolean) SPUtil.get(getApplicationContext(),Constant.IsFirstWEiChatLogin.ISWECHATNEWUSERFIRSTLOGIN,true);
|
|
312
|
+ if(isFirstWechatLogin){
|
|
313
|
+ //老用户
|
|
314
|
+ if(newUser){
|
|
315
|
+ if(!iswechat_newUserFirstLogin) {
|
|
316
|
+ finishLoginOut();
|
|
317
|
+ }
|
|
318
|
+ }
|
|
319
|
+ }
|
297
|
320
|
super.onDestroy();
|
298
|
321
|
AppManager.getAppManager().finishActivity(this);
|
299
|
322
|
}
|