Commit 42e10d1d2c104c2b54032865a93a063a52df0ff9
1 parent
55a3d330
1 增加运营绑定轨迹对当前网络的判断
Showing
2 changed files
with
27 additions
and
1 deletions
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/RaceNameListView.java
| ... | ... | @@ -41,6 +41,7 @@ import com.cnlive.moudle.pedometer.net.bean.BaseInfo; |
| 41 | 41 | import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; |
| 42 | 42 | import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; |
| 43 | 43 | import com.cnlive.moudle.pedometer.utils.GsonUtil; |
| 44 | +import com.cnlive.moudle.pedometer.utils.NetUtil; | |
| 44 | 45 | import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil; |
| 45 | 46 | import com.example.moudle_pedometer.R; |
| 46 | 47 | import com.hannesdorfmann.mosby3.mvp.MvpView; |
| ... | ... | @@ -137,6 +138,10 @@ public class RaceNameListView implements MvpView, OnFenceListener { |
| 137 | 138 | if (list.get(position).getIsEnable() == 0) { |
| 138 | 139 | return; |
| 139 | 140 | } |
| 141 | + if (!NetUtil.isNetworkConnected(fragment.getActivity())) { | |
| 142 | + AlertUtil.showDeftToast(fragment.getActivity(), "无法连接网络"); | |
| 143 | + return; | |
| 144 | + } | |
| 140 | 145 | importPoints = null; |
| 141 | 146 | currentSelBean = eventShoeLinesBean; |
| 142 | 147 | currentSelPos = position; |
| ... | ... | @@ -363,7 +368,6 @@ public class RaceNameListView implements MvpView, OnFenceListener { |
| 363 | 368 | if (null == fenceListResponse) { |
| 364 | 369 | return; |
| 365 | 370 | } |
| 366 | - Log.e(TAG, "onFenceListCallback:围栏数量 " + fenceListResponse.getFenceInfos().size() + ",fenceListResponse:" + fenceListResponse.getTotalSize()); | |
| 367 | 371 | List<Long> fenceIdList = null; |
| 368 | 372 | if (null != fenceListResponse.getFenceInfos()) { |
| 369 | 373 | fenceIdList = new ArrayList<>(); | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/NetUtil.java
0 → 100644
| 1 | +package com.cnlive.moudle.pedometer.utils; | |
| 2 | + | |
| 3 | +import android.content.Context; | |
| 4 | +import android.net.ConnectivityManager; | |
| 5 | +import android.net.NetworkInfo; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * 网络相关 | |
| 9 | + */ | |
| 10 | +public class NetUtil { | |
| 11 | + public static boolean isNetworkConnected(Context context) { | |
| 12 | + if (context != null) { | |
| 13 | + ConnectivityManager mConnectivityManager = (ConnectivityManager) context | |
| 14 | + .getSystemService(Context.CONNECTIVITY_SERVICE); | |
| 15 | + NetworkInfo mNetworkInfo = mConnectivityManager.getActiveNetworkInfo(); | |
| 16 | + if (mNetworkInfo != null) { | |
| 17 | + return mNetworkInfo.isAvailable(); | |
| 18 | + } | |
| 19 | + } | |
| 20 | + return false; | |
| 21 | + } | |
| 22 | +} | ... | ... |