Ver Código Fonte

周重复修改

Xieshengqi 6 anos atrás
pai
commit
dc04eccf09

+ 14 - 1
app/src/main/java/com/kuxuan/moneynote/receiver/NetBroadcastReceiver.java

@@ -5,7 +5,10 @@ import android.content.Context;
5 5
 import android.content.Intent;
6 6
 import android.net.ConnectivityManager;
7 7
 
8
+import com.kuxuan.moneynote.servier.ServiceUtil;
8 9
 import com.kuxuan.moneynote.ui.activitys.eventbus.NetworkEvent;
10
+import com.kuxuan.moneynote.utils.LoginStatusUtil;
11
+import com.kuxuan.moneynote.utils.NetWorkUtil;
9 12
 
10 13
 import org.greenrobot.eventbus.EventBus;
11 14
 
@@ -21,11 +24,21 @@ public class NetBroadcastReceiver extends BroadcastReceiver {
21 24
         // TODO Auto-generated method stub
22 25
         // 如果相等的话就说明网络状态发生了变化
23 26
         if (intent.getAction().equals(ConnectivityManager.CONNECTIVITY_ACTION)) {
27
+            if (NetWorkUtil.isNetworkAvailable(context)) {
28
+                //有网的情况下
29
+                if (LoginStatusUtil.isLoginin()) {
30
+                    ServiceUtil.startUpData(context);
31
+                }
32
+            } else {
33
+                //没网的情况下
34
+                if (LoginStatusUtil.isLoginin()) {
35
+                    ServiceUtil.stopUpData(context);
36
+                }
37
+            }
24 38
             // 接口回调传过去状态的类型
25 39
             EventBus.getDefault().post(new NetworkEvent());
26 40
         }
27 41
     }
28 42
 
29
-
30 43
 }
31 44
 

+ 0 - 2
app/src/main/java/com/kuxuan/moneynote/ui/fragments/details/DetialPresent.java

@@ -227,9 +227,7 @@ public class DetialPresent extends DetialContract.DetialPresent implements View.
227 227
 
228 228
     @Override
229 229
     void getDataLists(String year, String month) {
230
-        if (db_maps == null) {
231 230
             db_maps = CategoryDaoOperator.newInstance().getMaxAndMinTimeForUserId(-1);
232
-        }
233 231
         currentYear = Integer.parseInt(year);
234 232
         currentMonth = Integer.parseInt(month);
235 233
 // TODO: 2018/4/3 需要做没有网络和有网络的处理

+ 6 - 6
app/src/main/java/com/kuxuan/moneynote/ui/fragments/reportsingle/ReportSingleFragment.java

@@ -38,7 +38,6 @@ import com.kuxuan.moneynote.ui.weight.ChartLayout;
38 38
 import com.kuxuan.moneynote.ui.weight.ChartPop;
39 39
 import com.kuxuan.moneynote.ui.weight.MoneyChoosePop;
40 40
 import com.kuxuan.moneynote.utils.DisplayUtil;
41
-import com.kuxuan.moneynote.utils.NetWorkUtil;
42 41
 import com.kuxuan.moneynote.utils.UIHelper;
43 42
 
44 43
 import org.greenrobot.eventbus.EventBus;
@@ -245,11 +244,12 @@ public class ReportSingleFragment extends MVPFragment<ReportSinglePresent, Repor
245 244
 
246 245
 
247 246
     private void checkNet() {
248
-        boolean networkAvailable = NetWorkUtil.isNetworkAvailable(getActivity());
249
-        if (networkAvailable)
250
-            mPresenter.loginCheck();
251
-        else
252
-            multipleStatusView.showNoNetwork();
247
+//        boolean networkAvailable = NetWorkUtil.isNetworkAvailable(getActivity());
248
+//        if (networkAvailable)
249
+//            mPresenter.loginCheck();
250
+//        else
251
+//            multipleStatusView.showNoNetwork();
252
+        mPresenter.loginCheck();
253 253
     }
254 254
 
255 255
     /**

+ 1 - 1
app/src/main/java/com/kuxuan/moneynote/utils/CalanderUtil.java

@@ -473,7 +473,7 @@ public class CalanderUtil {
473 473
     }
474 474
 
475 475
     private static String getData(int year, int month, int day, int index) {
476
-        for (int i = index; i > 0; i--) {
476
+        for (int i = index; i > 1; i--) {
477 477
             if (day == 1) {
478 478
                 if (month == 1) {
479 479
                     month = 12;

+ 2 - 0
app/src/main/res/layout/empty_view.xml

@@ -12,11 +12,13 @@
12 12
         android:layout_width="wrap_content"
13 13
         android:layout_height="wrap_content"
14 14
         android:layout_centerInParent="true"
15
+        android:layout_gravity="center_horizontal"
15 16
         android:src="@mipmap/no_data" />
16 17
 
17 18
     <TextView
18 19
         android:id="@+id/empty_view_tv"
19 20
         style="@style/MultipleStatusView.Content"
21
+        android:layout_gravity="center_horizontal"
20 22
         android:layout_below="@+id/empty_img"
21 23
         android:text="@string/empty_view_hint" />
22 24