2 Коммиты c66b77046e ... dcf354bd86

Автор SHA1 Сообщение Дата
  e dcf354bd86 Merge branch 'MoneyNote3.0' of http://git.quyaqu.com/xieshengqi/MoneyMoreMoreNote into MoneyNote3.0 лет назад: 6
  e 24e857524e 新用户强制绑定可以退出 лет назад: 6

+ 4 - 0
app/src/main/AndroidManifest.xml

@@ -15,6 +15,10 @@
15 15
     <uses-permission android:name="android.permission.GET_TASKS" />
16 16
     <uses-permission android:name="android.permission.VIBRATE" />
17 17
 
18
+    <!--Api 27-->
19
+    <!--<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>-->
20
+    <!--<uses-permission android:name="android.permission.WRITE_SETTINGS"/>-->
21
+
18 22
     <application
19 23
         android:name=".MyApplication"
20 24
         android:allowBackup="true"

+ 32 - 0
app/src/main/java/com/kuxuan/moneynote/MyApplication.java

@@ -1,7 +1,9 @@
1 1
 package com.kuxuan.moneynote;
2 2
 
3 3
 import android.app.Application;
4
+import android.os.Build;
4 5
 import android.os.SystemClock;
6
+import android.support.annotation.RequiresApi;
5 7
 
6 8
 import com.kuxuan.moneynote.utils.DisplayUtil;
7 9
 import com.umeng.analytics.MobclickAgent;
@@ -26,6 +28,7 @@ public class MyApplication extends Application {
26 28
 //    private static final String UMENT_SECRET="59b64bfa677baa34a00017ca";
27 29
     private static final String UMENG_APPKEY="59fc677e734be45f110001f6";
28 30
 
31
+    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
29 32
     @Override
30 33
     public void onCreate() {
31 34
         super.onCreate();
@@ -55,6 +58,35 @@ public class MyApplication extends Application {
55 58
             PlatformConfig.setQQZone("100424468", "c7394704798a158208a74ab60104f0ba");
56 59
         }
57 60
 
61
+
62
+
63
+
64
+        //api 27后监听网络变化
65
+/*        ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
66
+        NetworkRequest.Builder builder = new NetworkRequest.Builder();
67
+        NetworkRequest request = builder.addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
68
+                .addTransportType(NetworkCapabilities.TRANSPORT_WIFI)
69
+                .addTransportType(NetworkCapabilities.TRANSPORT_CELLULAR)
70
+                .build();
71
+
72
+        connectivityManager.requestNetwork(request,
73
+                new ConnectivityManager.NetworkCallback() {
74
+
75
+                    @Override
76
+                    public void onLost(Network network) {
77
+                        super.onLost(network);
78
+                        Toast.makeText(getApplicationContext(),"网络未连接",Toast.LENGTH_SHORT).show();
79
+                    }
80
+
81
+                    @Override public void onAvailable(Network network) {
82
+                        super.onAvailable(network);
83
+                        Toast.makeText(getApplicationContext(),"网络已连接",Toast.LENGTH_SHORT).show();
84
+                    }
85
+
86
+
87
+                });*/
88
+
89
+
58 90
     }
59 91
 
60 92
 //    private AppComponent mAppComponent;

+ 2 - 0
app/src/main/java/com/kuxuan/moneynote/common/Constant.java

@@ -51,6 +51,8 @@ public class Constant {
51 51
 
52 52
         public static final String IsLoginOut = "isloginout";
53 53
 
54
+        public static final String ISWECHATNEWUSERFIRSTLOGIN="iswechatnewuserfirstlogin";
55
+
54 56
     }
55 57
 
56 58
 

+ 0 - 1
app/src/main/java/com/kuxuan/moneynote/servier/ServiceUtil.java

@@ -38,6 +38,5 @@ public class ServiceUtil {
38 38
     public static void stopUpData(Context context) {
39 39
         Intent intent = new Intent(context, UpDataService.class);
40 40
         context.stopService(intent);
41
-
42 41
     }
43 42
 }

+ 1 - 1
app/src/main/java/com/kuxuan/moneynote/ui/activitys/LunchActivity.java

@@ -88,7 +88,7 @@ public class LunchActivity extends Activity {
88 88
 //            LoginStatusUtil.loginOut();
89 89
 //            EventBus.getDefault().post(new LoginOutEvent());
90 90
 //        }
91
-
91
+        SPUtil.remove(getApplicationContext(),Constant.IsFirstWEiChatLogin.ISWECHATNEWUSERFIRSTLOGIN);
92 92
         if((Boolean) SPUtil.get(this, Constant.IsFirstWEiChatLogin.ISWEICHATLOGIN,false)&&(Boolean) SPUtil.get(this,Constant.IsFirstWEiChatLogin.IsLoginOut,false)){
93 93
             LoginStatusUtil.loginOut();
94 94
             EventBus.getDefault().post(new LoginOutEvent());

+ 39 - 16
app/src/main/java/com/kuxuan/moneynote/ui/activitys/bindphone/BindActivity.java

@@ -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
     }

+ 0 - 1
app/src/main/java/com/kuxuan/moneynote/ui/fragments/details/DetialFragment.java

@@ -294,7 +294,6 @@ public class DetialFragment extends MVPFragment<DetialPresent, DetialModel> impl
294 294
     @Subscribe(threadMode = ThreadMode.MAIN)
295 295
     public void onMessageEvent(NetworkEvent networkEvent) {
296 296
         checkNet();
297
-
298 297
     }
299 298
 
300 299
     @Override