Commit f2a8606fbb2ef1949085edd9615c6117bf065a06
1 parent
f4c87264
1 修改BUG
Showing
15 changed files
with
213 additions
and
153 deletions
.idea/codeStyles/Project.xml deleted
100644 → 0
| 1 | -<component name="ProjectCodeStyleConfiguration"> | ||
| 2 | - <code_scheme name="Project" version="173"> | ||
| 3 | - <Objective-C-extensions> | ||
| 4 | - <file> | ||
| 5 | - <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" /> | ||
| 6 | - <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" /> | ||
| 7 | - <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" /> | ||
| 8 | - <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" /> | ||
| 9 | - <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" /> | ||
| 10 | - <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" /> | ||
| 11 | - <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" /> | ||
| 12 | - <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" /> | ||
| 13 | - <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" /> | ||
| 14 | - </file> | ||
| 15 | - <class> | ||
| 16 | - <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" /> | ||
| 17 | - <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" /> | ||
| 18 | - <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" /> | ||
| 19 | - <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" /> | ||
| 20 | - <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" /> | ||
| 21 | - <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" /> | ||
| 22 | - </class> | ||
| 23 | - <extensions> | ||
| 24 | - <pair source="cpp" header="h" fileNamingConvention="NONE" /> | ||
| 25 | - <pair source="c" header="h" fileNamingConvention="NONE" /> | ||
| 26 | - </extensions> | ||
| 27 | - </Objective-C-extensions> | ||
| 28 | - </code_scheme> | ||
| 29 | -</component> | ||
| 30 | \ No newline at end of file | 0 | \ No newline at end of file |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/presenter/CollRunningFinishFragmetPresenter.java
| @@ -39,6 +39,9 @@ import io.reactivex.disposables.Disposable; | @@ -39,6 +39,9 @@ import io.reactivex.disposables.Disposable; | ||
| 39 | public class CollRunningFinishFragmetPresenter extends MvpBasePresenter<CollRunningFinishFragmentView> { | 39 | public class CollRunningFinishFragmetPresenter extends MvpBasePresenter<CollRunningFinishFragmentView> { |
| 40 | 40 | ||
| 41 | public void uploadTraceDateToServer(Activity context, CollUserStepEntity userStepEntity, String roadmap) { | 41 | public void uploadTraceDateToServer(Activity context, CollUserStepEntity userStepEntity, String roadmap) { |
| 42 | + if (null != getView()) { | ||
| 43 | + getView().limitUploadBtnTouch(); | ||
| 44 | + } | ||
| 42 | QMUITipDialogUtil.loadingDialog(context, "正在上传数据", false); | 45 | QMUITipDialogUtil.loadingDialog(context, "正在上传数据", false); |
| 43 | Map<String, String> paramsMap = new HashMap<>(); | 46 | Map<String, String> paramsMap = new HashMap<>(); |
| 44 | //赛事id | 47 | //赛事id |
| @@ -84,10 +87,10 @@ public class CollRunningFinishFragmetPresenter extends MvpBasePresenter<CollRunn | @@ -84,10 +87,10 @@ public class CollRunningFinishFragmetPresenter extends MvpBasePresenter<CollRunn | ||
| 84 | if (!TextUtils.isEmpty(userStepEntity.getStepCount())) { | 87 | if (!TextUtils.isEmpty(userStepEntity.getStepCount())) { |
| 85 | double mileage = CollStepUtil.getWalkDistanceKM(Long.parseLong(userStepEntity.getStepCount())); | 88 | double mileage = CollStepUtil.getWalkDistanceKM(Long.parseLong(userStepEntity.getStepCount())); |
| 86 | paramsMap.put("mileage", mileage + ""); | 89 | paramsMap.put("mileage", mileage + ""); |
| 87 | - if (0==mileage){ | 90 | + if (0 == mileage) { |
| 88 | paramsMap.put("mileage", "0"); | 91 | paramsMap.put("mileage", "0"); |
| 89 | } | 92 | } |
| 90 | - }else { | 93 | + } else { |
| 91 | paramsMap.put("mileage", "0"); | 94 | paramsMap.put("mileage", "0"); |
| 92 | } | 95 | } |
| 93 | //开始时间 | 96 | //开始时间 |
| @@ -113,6 +116,9 @@ public class CollRunningFinishFragmetPresenter extends MvpBasePresenter<CollRunn | @@ -113,6 +116,9 @@ public class CollRunningFinishFragmetPresenter extends MvpBasePresenter<CollRunn | ||
| 113 | if (getView() == null) { | 116 | if (getView() == null) { |
| 114 | return; | 117 | return; |
| 115 | } | 118 | } |
| 119 | + if (null != getView()) { | ||
| 120 | + getView().allowUploadBtnTouch(); | ||
| 121 | + } | ||
| 116 | QMUITipDialogUtil.dismessDialog(); | 122 | QMUITipDialogUtil.dismessDialog(); |
| 117 | SelectDialog selectDialog = new SelectDialog(context, "数据上传失败,是否重试?", "取消", new SelectDialog.DialogInterface() { | 123 | SelectDialog selectDialog = new SelectDialog(context, "数据上传失败,是否重试?", "取消", new SelectDialog.DialogInterface() { |
| 118 | @Override | 124 | @Override |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollRunningFinishFragmentView.java
| @@ -2,27 +2,20 @@ package com.cnlive.moudle.collectionTrace.frame.view; | @@ -2,27 +2,20 @@ package com.cnlive.moudle.collectionTrace.frame.view; | ||
| 2 | 2 | ||
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | import android.graphics.Bitmap; | 4 | import android.graphics.Bitmap; |
| 5 | -import android.graphics.BitmapFactory; | ||
| 6 | import android.os.Handler; | 5 | import android.os.Handler; |
| 7 | import android.support.v7.widget.LinearLayoutManager; | 6 | import android.support.v7.widget.LinearLayoutManager; |
| 8 | import android.text.TextUtils; | 7 | import android.text.TextUtils; |
| 9 | import android.util.Log; | 8 | import android.util.Log; |
| 10 | import android.view.MotionEvent; | 9 | import android.view.MotionEvent; |
| 11 | import android.view.View; | 10 | import android.view.View; |
| 12 | -import android.widget.Toast; | ||
| 13 | 11 | ||
| 14 | -import com.baidu.location.LocationClient; | ||
| 15 | -import com.baidu.location.LocationClientOption; | ||
| 16 | import com.baidu.mapapi.map.BaiduMap; | 12 | import com.baidu.mapapi.map.BaiduMap; |
| 17 | -import com.baidu.mapapi.map.BitmapDescriptorFactory; | ||
| 18 | import com.baidu.mapapi.map.MapView; | 13 | import com.baidu.mapapi.map.MapView; |
| 19 | -import com.baidu.mapapi.map.MyLocationConfiguration; | ||
| 20 | import com.baidu.mapapi.map.Overlay; | 14 | import com.baidu.mapapi.map.Overlay; |
| 21 | import com.baidu.mapapi.map.UiSettings; | 15 | import com.baidu.mapapi.map.UiSettings; |
| 22 | import com.baidu.mapapi.model.LatLng; | 16 | import com.baidu.mapapi.model.LatLng; |
| 23 | import com.baidu.trace.LBSTraceClient; | 17 | import com.baidu.trace.LBSTraceClient; |
| 24 | import com.baidu.trace.api.fence.AddMonitoredPersonResponse; | 18 | import com.baidu.trace.api.fence.AddMonitoredPersonResponse; |
| 25 | -import com.baidu.trace.api.fence.CreateFenceRequest; | ||
| 26 | import com.baidu.trace.api.fence.CreateFenceResponse; | 19 | import com.baidu.trace.api.fence.CreateFenceResponse; |
| 27 | import com.baidu.trace.api.fence.DeleteFenceResponse; | 20 | import com.baidu.trace.api.fence.DeleteFenceResponse; |
| 28 | import com.baidu.trace.api.fence.DeleteMonitoredPersonResponse; | 21 | import com.baidu.trace.api.fence.DeleteMonitoredPersonResponse; |
| @@ -33,7 +26,6 @@ import com.baidu.trace.api.fence.MonitoredStatusByLocationResponse; | @@ -33,7 +26,6 @@ import com.baidu.trace.api.fence.MonitoredStatusByLocationResponse; | ||
| 33 | import com.baidu.trace.api.fence.MonitoredStatusResponse; | 26 | import com.baidu.trace.api.fence.MonitoredStatusResponse; |
| 34 | import com.baidu.trace.api.fence.OnFenceListener; | 27 | import com.baidu.trace.api.fence.OnFenceListener; |
| 35 | import com.baidu.trace.api.fence.UpdateFenceResponse; | 28 | import com.baidu.trace.api.fence.UpdateFenceResponse; |
| 36 | -import com.baidu.trace.model.CoordType; | ||
| 37 | import com.baidu.trace.model.SortType; | 29 | import com.baidu.trace.model.SortType; |
| 38 | import com.cnlive.libs.base.logic.Event; | 30 | import com.cnlive.libs.base.logic.Event; |
| 39 | import com.cnlive.libs.base.logic.callback.FailureCallback; | 31 | import com.cnlive.libs.base.logic.callback.FailureCallback; |
| @@ -44,13 +36,9 @@ import com.cnlive.moudle.collectionTrace.ui.adapter.CollFinishDetaiAdapter; | @@ -44,13 +36,9 @@ import com.cnlive.moudle.collectionTrace.ui.adapter.CollFinishDetaiAdapter; | ||
| 44 | import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunningFinishFragment; | 36 | import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunningFinishFragment; |
| 45 | import com.cnlive.moudle.collectionTrace.utils.CollStepUtil; | 37 | import com.cnlive.moudle.collectionTrace.utils.CollStepUtil; |
| 46 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | 38 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| 47 | -import com.cnlive.moudle.pedometer.model.Constant; | ||
| 48 | -import com.cnlive.moudle.pedometer.model.RunningFinishBean; | ||
| 49 | import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity; | 39 | import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity; |
| 50 | -import com.cnlive.moudle.pedometer.ui.fragment.RunningFinishFragment; | ||
| 51 | import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; | 40 | import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; |
| 52 | import com.cnlive.moudle.pedometer.upload.UploadLogic; | 41 | import com.cnlive.moudle.pedometer.upload.UploadLogic; |
| 53 | -import com.cnlive.moudle.pedometer.utils.BitmapUtil; | ||
| 54 | import com.cnlive.moudle.pedometer.utils.GsonUtil; | 42 | import com.cnlive.moudle.pedometer.utils.GsonUtil; |
| 55 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; | 43 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; |
| 56 | import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil; | 44 | import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil; |
| @@ -59,7 +47,6 @@ import com.cnlive.moudle.pedometer.utils.TimeUtil; | @@ -59,7 +47,6 @@ import com.cnlive.moudle.pedometer.utils.TimeUtil; | ||
| 59 | import com.cnlive.strike.application.GlideApp; | 47 | import com.cnlive.strike.application.GlideApp; |
| 60 | import com.example.moudle_pedometer.R; | 48 | import com.example.moudle_pedometer.R; |
| 61 | import com.hannesdorfmann.mosby3.mvp.MvpView; | 49 | import com.hannesdorfmann.mosby3.mvp.MvpView; |
| 62 | -import com.qmuiteam.qmui.widget.dialog.QMUITipDialog; | ||
| 63 | import com.sothree.slidinguppanel.SlidingUpPanelLayout; | 50 | import com.sothree.slidinguppanel.SlidingUpPanelLayout; |
| 64 | 51 | ||
| 65 | import java.io.File; | 52 | import java.io.File; |
| @@ -198,10 +185,14 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | @@ -198,10 +185,14 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | ||
| 198 | @Override | 185 | @Override |
| 199 | public void onClick(SelectDialog dialog) { | 186 | public void onClick(SelectDialog dialog) { |
| 200 | dialog.dismiss(); | 187 | dialog.dismiss(); |
| 188 | + //允许点击 | ||
| 189 | + allowUploadBtnTouch(); | ||
| 201 | } | 190 | } |
| 202 | }, "是", new SelectDialog.DialogInterface() { | 191 | }, "是", new SelectDialog.DialogInterface() { |
| 203 | @Override | 192 | @Override |
| 204 | public void onClick(SelectDialog dialog) { | 193 | public void onClick(SelectDialog dialog) { |
| 194 | + //不让点击上传轨迹按钮 | ||
| 195 | + limitUploadBtnTouch(); | ||
| 205 | if (null != allMapOverlays) { | 196 | if (null != allMapOverlays) { |
| 206 | for (Overlay overlay : allMapOverlays) { | 197 | for (Overlay overlay : allMapOverlays) { |
| 207 | overlay.remove(); | 198 | overlay.remove(); |
| @@ -303,6 +294,24 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | @@ -303,6 +294,24 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | ||
| 303 | 294 | ||
| 304 | } | 295 | } |
| 305 | 296 | ||
| 297 | + /** | ||
| 298 | + * 屏蔽上传轨迹按钮 | ||
| 299 | + */ | ||
| 300 | + public void limitUploadBtnTouch() { | ||
| 301 | + fragment.binding.rlScrollViewStartBtn.setFocusable(false); | ||
| 302 | + fragment.binding.rlScrollViewStartBtn.setClickable(false); | ||
| 303 | + fragment.binding.rlScrollViewStartBtn.setFocusableInTouchMode(false); | ||
| 304 | + } | ||
| 305 | + | ||
| 306 | + /** | ||
| 307 | + * 允许上传轨迹按钮 | ||
| 308 | + */ | ||
| 309 | + public void allowUploadBtnTouch() { | ||
| 310 | + fragment.binding.rlScrollViewStartBtn.setFocusable(true); | ||
| 311 | + fragment.binding.rlScrollViewStartBtn.setClickable(true); | ||
| 312 | + fragment.binding.rlScrollViewStartBtn.setFocusableInTouchMode(true); | ||
| 313 | + } | ||
| 314 | + | ||
| 306 | private void queryWalkTrace(long startTime, long endTime) { | 315 | private void queryWalkTrace(long startTime, long endTime) { |
| 307 | MyMapUtil.queryHistoryTrace(getContext(), mClient, CommonInfo.getUserId(getContext()), startTime, endTime, new MyMapUtil.CallBack() { | 316 | MyMapUtil.queryHistoryTrace(getContext(), mClient, CommonInfo.getUserId(getContext()), startTime, endTime, new MyMapUtil.CallBack() { |
| 308 | @Override | 317 | @Override |
| @@ -362,6 +371,8 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | @@ -362,6 +371,8 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | ||
| 362 | } catch (Exception e) { | 371 | } catch (Exception e) { |
| 363 | QMUITipDialogUtil.dismessDialog(); | 372 | QMUITipDialogUtil.dismessDialog(); |
| 364 | QMUITipDialogUtil.failedDialog(getContext(), "赛事图片截取失败,请重试", 2); | 373 | QMUITipDialogUtil.failedDialog(getContext(), "赛事图片截取失败,请重试", 2); |
| 374 | + //允许点击 | ||
| 375 | + allowUploadBtnTouch(); | ||
| 365 | e.printStackTrace(); | 376 | e.printStackTrace(); |
| 366 | } | 377 | } |
| 367 | } | 378 | } |
| @@ -374,6 +385,8 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | @@ -374,6 +385,8 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | ||
| 374 | * @param roadMapPath | 385 | * @param roadMapPath |
| 375 | */ | 386 | */ |
| 376 | private void uploadRoadMapPic(String roadMapPath) { | 387 | private void uploadRoadMapPic(String roadMapPath) { |
| 388 | + //禁止点击 | ||
| 389 | + limitUploadBtnTouch(); | ||
| 377 | if (!TextUtils.isEmpty(roadMapPath)) { | 390 | if (!TextUtils.isEmpty(roadMapPath)) { |
| 378 | QMUITipDialogUtil.loadingDialog(getContext(), "正在上传赛事图片,请稍后", false); | 391 | QMUITipDialogUtil.loadingDialog(getContext(), "正在上传赛事图片,请稍后", false); |
| 379 | List<String> imagePaths = new ArrayList<>(); | 392 | List<String> imagePaths = new ArrayList<>(); |
| @@ -387,6 +400,8 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | @@ -387,6 +400,8 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | ||
| 387 | @Override | 400 | @Override |
| 388 | public void onClick(SelectDialog dialog) { | 401 | public void onClick(SelectDialog dialog) { |
| 389 | dialog.dismiss(); | 402 | dialog.dismiss(); |
| 403 | + //允许点击 | ||
| 404 | + allowUploadBtnTouch(); | ||
| 390 | } | 405 | } |
| 391 | }, "重试", new SelectDialog.DialogInterface() { | 406 | }, "重试", new SelectDialog.DialogInterface() { |
| 392 | @Override | 407 | @Override |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollRunningMapFragmentView.java
| @@ -631,7 +631,7 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | @@ -631,7 +631,7 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | ||
| 631 | if (isShowFollowAddress && !TextUtils.isEmpty(currentAddress)) { | 631 | if (isShowFollowAddress && !TextUtils.isEmpty(currentAddress)) { |
| 632 | if (isShowFollowAddress && selectDialog != null && !selectDialog.isShowing()) { | 632 | if (isShowFollowAddress && selectDialog != null && !selectDialog.isShowing()) { |
| 633 | if (!TextUtils.isEmpty(currentAddress)) { | 633 | if (!TextUtils.isEmpty(currentAddress)) { |
| 634 | - selectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设置开始地点?"); | 634 | + selectDialog.setTipMessage("确定在" + "\"" + currentAddress + "\"" + "打点?"); |
| 635 | if (!selectDialog.isShowing()) { | 635 | if (!selectDialog.isShowing()) { |
| 636 | selectDialog.show(); | 636 | selectDialog.show(); |
| 637 | } | 637 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollTraceListDetailFragmentView.java
| @@ -197,6 +197,34 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | @@ -197,6 +197,34 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | ||
| 197 | allCollectPoints = GsonUtil.jsonToList(eventShoeLinesBean.getLatLongitude(), CollectPoint.class); | 197 | allCollectPoints = GsonUtil.jsonToList(eventShoeLinesBean.getLatLongitude(), CollectPoint.class); |
| 198 | 198 | ||
| 199 | } | 199 | } |
| 200 | + //设置起点终点 | ||
| 201 | + CollectPoint startLocation = null; | ||
| 202 | + if (!TextUtils.isEmpty(eventShoeLinesBean.getStartLocation())) { | ||
| 203 | + startLocation = new CollectPoint(); | ||
| 204 | + startLocation.setPointName(eventShoeLinesBean.getStartLocation()); | ||
| 205 | + startLocation.setLatitude(0); | ||
| 206 | + startLocation.setLongitude(0); | ||
| 207 | + } | ||
| 208 | + //设置终点 | ||
| 209 | + CollectPoint endLocation = null; | ||
| 210 | + if (!TextUtils.isEmpty(eventShoeLinesBean.getEndLocation())) { | ||
| 211 | + endLocation = new CollectPoint(); | ||
| 212 | + endLocation.setPointName(eventShoeLinesBean.getEndLocation()); | ||
| 213 | + endLocation.setLatitude(0); | ||
| 214 | + endLocation.setLongitude(0); | ||
| 215 | + } | ||
| 216 | + if (null != startLocation) { | ||
| 217 | + if (null == allCollectPoints) { | ||
| 218 | + allCollectPoints = new ArrayList<>(); | ||
| 219 | + } | ||
| 220 | + allCollectPoints.add(0, startLocation); | ||
| 221 | + } | ||
| 222 | + if (null != endLocation) { | ||
| 223 | + if (null == allCollectPoints) { | ||
| 224 | + allCollectPoints = new ArrayList<>(); | ||
| 225 | + } | ||
| 226 | + allCollectPoints.add(endLocation); | ||
| 227 | + } | ||
| 200 | //设置打点liebiao | 228 | //设置打点liebiao |
| 201 | if (null != allCollectPoints && allCollectPoints.size() > 1) { | 229 | if (null != allCollectPoints && allCollectPoints.size() > 1) { |
| 202 | //设置适配器 | 230 | //设置适配器 |
| @@ -251,10 +279,6 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | @@ -251,10 +279,6 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | ||
| 251 | 279 | ||
| 252 | //获取打点不为空 | 280 | //获取打点不为空 |
| 253 | if (null != finalResultCollectPoints && finalResultCollectPoints.size() > 1) { | 281 | if (null != finalResultCollectPoints && finalResultCollectPoints.size() > 1) { |
| 254 | - //移除起点 | ||
| 255 | - finalResultCollectPoints.remove(0); | ||
| 256 | - //移除终点 | ||
| 257 | - finalResultCollectPoints.remove(finalResultCollectPoints.size() - 1); | ||
| 258 | //开始在地图上绘制打点信息 | 282 | //开始在地图上绘制打点信息 |
| 259 | for (int i = 0; i < finalResultCollectPoints.size(); i++) { | 283 | for (int i = 0; i < finalResultCollectPoints.size(); i++) { |
| 260 | LatLng latLng = new LatLng(finalResultCollectPoints.get(i).getLatitude(), finalResultCollectPoints.get(i).getLongitude()); | 284 | LatLng latLng = new LatLng(finalResultCollectPoints.get(i).getLatitude(), finalResultCollectPoints.get(i).getLongitude()); |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/service/CollKeepLiveService.java
| @@ -48,6 +48,7 @@ public class CollKeepLiveService extends Service implements MediaPlayer.OnComple | @@ -48,6 +48,7 @@ public class CollKeepLiveService extends Service implements MediaPlayer.OnComple | ||
| 48 | private Handler handler; | 48 | private Handler handler; |
| 49 | private Runnable runnable; | 49 | private Runnable runnable; |
| 50 | private boolean isRegisterReceiver = false; | 50 | private boolean isRegisterReceiver = false; |
| 51 | + private boolean isStartForegroundService = false; | ||
| 51 | 52 | ||
| 52 | public CollKeepLiveService() { | 53 | public CollKeepLiveService() { |
| 53 | } | 54 | } |
| @@ -69,14 +70,16 @@ public class CollKeepLiveService extends Service implements MediaPlayer.OnComple | @@ -69,14 +70,16 @@ public class CollKeepLiveService extends Service implements MediaPlayer.OnComple | ||
| 69 | handler.postDelayed(this, 5000); | 70 | handler.postDelayed(this, 5000); |
| 70 | } else { | 71 | } else { |
| 71 | try { | 72 | try { |
| 72 | - if (myReceiver != null) { | 73 | + if (myReceiver != null&&isRegisterReceiver) { |
| 73 | unregisterReceiver(myReceiver); | 74 | unregisterReceiver(myReceiver); |
| 74 | } | 75 | } |
| 75 | } catch (Exception e) { | 76 | } catch (Exception e) { |
| 76 | Log.e(TAG, "run: "); | 77 | Log.e(TAG, "run: "); |
| 77 | } | 78 | } |
| 78 | stopPlaySong(); | 79 | stopPlaySong(); |
| 79 | - stopForeground(true); | 80 | + if (isStartForegroundService) { |
| 81 | + stopForeground(true); | ||
| 82 | + } | ||
| 80 | } | 83 | } |
| 81 | 84 | ||
| 82 | } | 85 | } |
| @@ -210,6 +213,7 @@ public class CollKeepLiveService extends Service implements MediaPlayer.OnComple | @@ -210,6 +213,7 @@ public class CollKeepLiveService extends Service implements MediaPlayer.OnComple | ||
| 210 | .build(); | 213 | .build(); |
| 211 | // 0 隐藏前台服务通知 | 214 | // 0 隐藏前台服务通知 |
| 212 | startForeground(100, notification); | 215 | startForeground(100, notification); |
| 216 | + isStartForegroundService = true; | ||
| 213 | // stopForeground(true); | 217 | // stopForeground(true); |
| 214 | } | 218 | } |
| 215 | 219 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/RegistrationInfoPresenter.java
| @@ -33,6 +33,9 @@ import io.reactivex.disposables.Disposable; | @@ -33,6 +33,9 @@ import io.reactivex.disposables.Disposable; | ||
| 33 | public class RegistrationInfoPresenter extends MvpBasePresenter<RegistrationInfoView> { | 33 | public class RegistrationInfoPresenter extends MvpBasePresenter<RegistrationInfoView> { |
| 34 | 34 | ||
| 35 | public void commitInfo(Context context, String eventId, String sid, String mobile, String sex, String birthday) { | 35 | public void commitInfo(Context context, String eventId, String sid, String mobile, String sex, String birthday) { |
| 36 | + if (null!=getView()){ | ||
| 37 | + getView().limitClickRegistBtn(); | ||
| 38 | + } | ||
| 36 | HashMap<String, String> map = new HashMap<>(); | 39 | HashMap<String, String> map = new HashMap<>(); |
| 37 | map.put("eventId", eventId); | 40 | map.put("eventId", eventId); |
| 38 | map.put("sid", sid); | 41 | map.put("sid", sid); |
| @@ -55,6 +58,9 @@ public class RegistrationInfoPresenter extends MvpBasePresenter<RegistrationInfo | @@ -55,6 +58,9 @@ public class RegistrationInfoPresenter extends MvpBasePresenter<RegistrationInfo | ||
| 55 | }).<BaseInfo>event().setFailureCallback(new FailureCallback() { | 58 | }).<BaseInfo>event().setFailureCallback(new FailureCallback() { |
| 56 | @Override | 59 | @Override |
| 57 | public void onFailure(int code, String message) { | 60 | public void onFailure(int code, String message) { |
| 61 | + if (null!=getView()){ | ||
| 62 | + getView().allowClickRegistBtn(); | ||
| 63 | + } | ||
| 58 | // if (408 == code) { | 64 | // if (408 == code) { |
| 59 | // if (getView() != null) { | 65 | // if (getView() != null) { |
| 60 | // getView().toResult(); | 66 | // getView().toResult(); |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RegistrationInfoView.java
| @@ -44,17 +44,17 @@ public class RegistrationInfoView implements MvpView, OnDateSetListener { | @@ -44,17 +44,17 @@ public class RegistrationInfoView implements MvpView, OnDateSetListener { | ||
| 44 | fragment.getActivity().finish(); | 44 | fragment.getActivity().finish(); |
| 45 | }); | 45 | }); |
| 46 | fragment.binding.topbar.setTitle("填写报名信息"); | 46 | fragment.binding.topbar.setTitle("填写报名信息"); |
| 47 | - if(CommonInfo.getUserNickName(fragment.getActivity()) != null && CommonInfo.getUserNickName(fragment.getActivity()).trim().length() > 0){ | 47 | + if (CommonInfo.getUserNickName(fragment.getActivity()) != null && CommonInfo.getUserNickName(fragment.getActivity()).trim().length() > 0) { |
| 48 | fragment.binding.userName.setText(CommonInfo.getUserNickName(fragment.getActivity())); | 48 | fragment.binding.userName.setText(CommonInfo.getUserNickName(fragment.getActivity())); |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | - if(CommonInfo.getUserPhone(fragment.getActivity()) != null && CommonInfo.getUserPhone(fragment.getActivity()).trim().length() > 0){ | 51 | + if (CommonInfo.getUserPhone(fragment.getActivity()) != null && CommonInfo.getUserPhone(fragment.getActivity()).trim().length() > 0) { |
| 52 | fragment.binding.phoneNum.setText(CommonInfo.getUserPhone(fragment.getActivity())); | 52 | fragment.binding.phoneNum.setText(CommonInfo.getUserPhone(fragment.getActivity())); |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | - if(CommonInfo.getUserIcon(fragment.getActivity()) != null && CommonInfo.getUserIcon(fragment.getActivity()).trim().length() > 0){ | 55 | + if (CommonInfo.getUserIcon(fragment.getActivity()) != null && CommonInfo.getUserIcon(fragment.getActivity()).trim().length() > 0) { |
| 56 | Glide.with(fragment.getActivity()).load(CommonInfo.getUserIcon(fragment.getActivity())) | 56 | Glide.with(fragment.getActivity()).load(CommonInfo.getUserIcon(fragment.getActivity())) |
| 57 | - .apply(RequestOptions.bitmapTransform(new CircleCrop()).placeholder(R.drawable.ic_icon)).into( fragment.binding.userIcon); | 57 | + .apply(RequestOptions.bitmapTransform(new CircleCrop()).placeholder(R.drawable.ic_icon)).into(fragment.binding.userIcon); |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | fragment.binding.commitInfo.setOnClickListener(v -> fragment.commitInfo()); | 60 | fragment.binding.commitInfo.setOnClickListener(v -> fragment.commitInfo()); |
| @@ -111,7 +111,7 @@ public class RegistrationInfoView implements MvpView, OnDateSetListener { | @@ -111,7 +111,7 @@ public class RegistrationInfoView implements MvpView, OnDateSetListener { | ||
| 111 | 111 | ||
| 112 | public void toResult() { | 112 | public void toResult() { |
| 113 | EventBus.getDefault().post(new MessageEvent(Constant.REGISTRATION_SUCCESS, "")); | 113 | EventBus.getDefault().post(new MessageEvent(Constant.REGISTRATION_SUCCESS, "")); |
| 114 | - AlertUtil.showLongToast(fragment.getActivity(),"恭喜你报名成功",3000); | 114 | + AlertUtil.showLongToast(fragment.getActivity(), "恭喜你报名成功", 3000); |
| 115 | fragment.getActivity().finish(); | 115 | fragment.getActivity().finish(); |
| 116 | } | 116 | } |
| 117 | 117 | ||
| @@ -121,4 +121,22 @@ public class RegistrationInfoView implements MvpView, OnDateSetListener { | @@ -121,4 +121,22 @@ public class RegistrationInfoView implements MvpView, OnDateSetListener { | ||
| 121 | // 生日(非必填) 未选择 | 121 | // 生日(非必填) 未选择 |
| 122 | fragment.binding.birthday.setText(DateTimeUtil.formatDateTime(millseconds, "yyyy年MM月dd日")); | 122 | fragment.binding.birthday.setText(DateTimeUtil.formatDateTime(millseconds, "yyyy年MM月dd日")); |
| 123 | } | 123 | } |
| 124 | + | ||
| 125 | + /** | ||
| 126 | + * 不允许点击 | ||
| 127 | + */ | ||
| 128 | + public void limitClickRegistBtn() { | ||
| 129 | + fragment.binding.commitInfo.setClickable(false); | ||
| 130 | + fragment.binding.commitInfo.setFocusableInTouchMode(false); | ||
| 131 | + fragment.binding.commitInfo.setFocusable(false); | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + /** | ||
| 135 | + * 允许点击 | ||
| 136 | + */ | ||
| 137 | + public void allowClickRegistBtn() { | ||
| 138 | + fragment.binding.commitInfo.setClickable(true); | ||
| 139 | + fragment.binding.commitInfo.setFocusableInTouchMode(true); | ||
| 140 | + fragment.binding.commitInfo.setFocusable(true); | ||
| 141 | + } | ||
| 124 | } | 142 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunRaceDetailFragmentView.java
| @@ -39,6 +39,7 @@ import com.baidu.mapapi.utils.DistanceUtil; | @@ -39,6 +39,7 @@ import com.baidu.mapapi.utils.DistanceUtil; | ||
| 39 | import com.baidu.trace.LBSTraceClient; | 39 | import com.baidu.trace.LBSTraceClient; |
| 40 | import com.baidu.trace.model.SortType; | 40 | import com.baidu.trace.model.SortType; |
| 41 | import com.cnlive.libs.base.application.AppConfig; | 41 | import com.cnlive.libs.base.application.AppConfig; |
| 42 | +import com.cnlive.libs.base.util.AlertUtil; | ||
| 42 | import com.cnlive.libs.base.util.StatusBarUtil2; | 43 | import com.cnlive.libs.base.util.StatusBarUtil2; |
| 43 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | 44 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| 44 | import com.cnlive.moudle.pedometer.model.Constant; | 45 | import com.cnlive.moudle.pedometer.model.Constant; |
| @@ -112,6 +113,10 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -112,6 +113,10 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 112 | private final float DEFAULT_MAP_AUTO_ZOOM = -0.8f;//根据点位,自动缩放的比例 | 113 | private final float DEFAULT_MAP_AUTO_ZOOM = -0.8f;//根据点位,自动缩放的比例 |
| 113 | private List<LatLng> queryResultPoints;//查询到的历史轨迹 | 114 | private List<LatLng> queryResultPoints;//查询到的历史轨迹 |
| 114 | private List<String> joinFaceIcon;//参与活动人数 | 115 | private List<String> joinFaceIcon;//参与活动人数 |
| 116 | + private final String REGIST_RACE = "0";//立即报名 | ||
| 117 | + private final String START_RACE = "1";//立即开始 | ||
| 118 | + private final String CONTINUE_RACE = "2";//继续运动 | ||
| 119 | + private final String END_RACE = "3";//运动已结束 | ||
| 115 | 120 | ||
| 116 | public RunRaceDetailFragmentView(RunRaceDetailFragment fragment) { | 121 | public RunRaceDetailFragmentView(RunRaceDetailFragment fragment) { |
| 117 | this.fragment = fragment; | 122 | this.fragment = fragment; |
| @@ -184,7 +189,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -184,7 +189,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 184 | StatusBarUtil2.setColor(fragment.getActivity(), getContext().getResources().getColor(R.color.run_main_bg), 0); | 189 | StatusBarUtil2.setColor(fragment.getActivity(), getContext().getResources().getColor(R.color.run_main_bg), 0); |
| 185 | 190 | ||
| 186 | } | 191 | } |
| 187 | - } else if (slideOffset!=0){ | 192 | + } else if (slideOffset != 0) { |
| 188 | if (fragment.binding.flTop.getVisibility() == View.VISIBLE) { | 193 | if (fragment.binding.flTop.getVisibility() == View.VISIBLE) { |
| 189 | QMUIStatusBarHelper.setStatusBarLightMode(fragment.getActivity()); | 194 | QMUIStatusBarHelper.setStatusBarLightMode(fragment.getActivity()); |
| 190 | StatusBarUtil2.setColor(fragment.getActivity(), getContext().getResources().getColor(R.color.white), 0); | 195 | StatusBarUtil2.setColor(fragment.getActivity(), getContext().getResources().getColor(R.color.white), 0); |
| @@ -452,12 +457,12 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -452,12 +457,12 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 452 | } | 457 | } |
| 453 | //判断用户是否报名 | 458 | //判断用户是否报名 |
| 454 | if (runRaceDetailInfo.isSignResult()) { | 459 | if (runRaceDetailInfo.isSignResult()) { |
| 455 | - fragment.binding.rlScrollViewStartBtn.setTag("1"); | 460 | + fragment.binding.rlScrollViewStartBtn.setTag(START_RACE); |
| 456 | fragment.binding.tvRunNow.setText("现在开始"); | 461 | fragment.binding.tvRunNow.setText("现在开始"); |
| 457 | fragment.binding.tvGoTip.setVisibility(View.VISIBLE); | 462 | fragment.binding.tvGoTip.setVisibility(View.VISIBLE); |
| 458 | checkStartBtnState(); | 463 | checkStartBtnState(); |
| 459 | } else { | 464 | } else { |
| 460 | - fragment.binding.rlScrollViewStartBtn.setTag("0"); | 465 | + fragment.binding.rlScrollViewStartBtn.setTag(REGIST_RACE); |
| 461 | fragment.binding.tvRunNow.setText("立即报名"); | 466 | fragment.binding.tvRunNow.setText("立即报名"); |
| 462 | fragment.binding.tvGoTip.setVisibility(View.GONE); | 467 | fragment.binding.tvGoTip.setVisibility(View.GONE); |
| 463 | } | 468 | } |
| @@ -514,13 +519,13 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -514,13 +519,13 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 514 | @Override | 519 | @Override |
| 515 | public void onClick(View view) { | 520 | public void onClick(View view) { |
| 516 | //立即报名 | 521 | //立即报名 |
| 517 | - if ("0".equals(fragment.binding.rlScrollViewStartBtn.getTag())) { | 522 | + if (REGIST_RACE.equals(fragment.binding.rlScrollViewStartBtn.getTag())) { |
| 518 | if (null != runRaceDetailInfo) { | 523 | if (null != runRaceDetailInfo) { |
| 519 | RegistrationInfoActivity.newInstance(fragment.getActivity(), runRaceDetailInfo.getFenceId()); | 524 | RegistrationInfoActivity.newInstance(fragment.getActivity(), runRaceDetailInfo.getFenceId()); |
| 520 | } | 525 | } |
| 521 | } | 526 | } |
| 522 | //现在开始 | 527 | //现在开始 |
| 523 | - else if ("1".equals(fragment.binding.rlScrollViewStartBtn.getTag())) { | 528 | + else if (START_RACE.equals(fragment.binding.rlScrollViewStartBtn.getTag())) { |
| 524 | //先判断是否从百度查询到赛事轨迹 | 529 | //先判断是否从百度查询到赛事轨迹 |
| 525 | if (null != endLatLng && null != startLatLng) { | 530 | if (null != endLatLng && null != startLatLng) { |
| 526 | //开始比较距离 | 531 | //开始比较距离 |
| @@ -549,7 +554,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -549,7 +554,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 549 | } | 554 | } |
| 550 | } | 555 | } |
| 551 | //继续运动 | 556 | //继续运动 |
| 552 | - else if ("2".equals(fragment.binding.rlScrollViewStartBtn.getTag())) { | 557 | + else if (CONTINUE_RACE.equals(fragment.binding.rlScrollViewStartBtn.getTag())) { |
| 553 | if (!isDifferentStreet) { | 558 | if (!isDifferentStreet) { |
| 554 | SelectDialog continueTipDialog = new SelectDialog(getContext(), "是否继续运动", "否", new SelectDialog.DialogInterface() { | 559 | SelectDialog continueTipDialog = new SelectDialog(getContext(), "是否继续运动", "否", new SelectDialog.DialogInterface() { |
| 555 | @Override | 560 | @Override |
| @@ -563,7 +568,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -563,7 +568,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 563 | dialog.dismiss(); | 568 | dialog.dismiss(); |
| 564 | //重置按钮 | 569 | //重置按钮 |
| 565 | fragment.binding.tvRunNow.setText("立即开始"); | 570 | fragment.binding.tvRunNow.setText("立即开始"); |
| 566 | - fragment.binding.rlScrollViewStartBtn.setTag("1"); | 571 | + fragment.binding.rlScrollViewStartBtn.setTag(START_RACE); |
| 567 | } | 572 | } |
| 568 | }, "是", new SelectDialog.DialogInterface() { | 573 | }, "是", new SelectDialog.DialogInterface() { |
| 569 | @Override | 574 | @Override |
| @@ -592,7 +597,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -592,7 +597,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 592 | CommonInfo.resetRace(getContext()); | 597 | CommonInfo.resetRace(getContext()); |
| 593 | //更改当前按钮 | 598 | //更改当前按钮 |
| 594 | fragment.binding.tvRunNow.setText("立即开始"); | 599 | fragment.binding.tvRunNow.setText("立即开始"); |
| 595 | - fragment.binding.rlScrollViewStartBtn.setTag("1"); | 600 | + fragment.binding.rlScrollViewStartBtn.setTag(START_RACE); |
| 596 | 601 | ||
| 597 | } | 602 | } |
| 598 | }, "是", new SelectDialog.DialogInterface() { | 603 | }, "是", new SelectDialog.DialogInterface() { |
| @@ -606,6 +611,9 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -606,6 +611,9 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 606 | selectDialog.setCancelable(false); | 611 | selectDialog.setCancelable(false); |
| 607 | selectDialog.show(); | 612 | selectDialog.show(); |
| 608 | } | 613 | } |
| 614 | + } else if (END_RACE.equals(fragment.binding.rlScrollViewStartBtn.getTag())) { | ||
| 615 | + AlertUtil.showDeftToast(getContext(), "赛事已结束"); | ||
| 616 | + return; | ||
| 609 | } | 617 | } |
| 610 | } | 618 | } |
| 611 | }); | 619 | }); |
| @@ -1019,7 +1027,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -1019,7 +1027,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 1019 | if ((currnetTime - userPauseTime) <= (9 * 60 * 60 * 1000)) { | 1027 | if ((currnetTime - userPauseTime) <= (9 * 60 * 60 * 1000)) { |
| 1020 | Log.e(TAG, "小于9小时"); | 1028 | Log.e(TAG, "小于9小时"); |
| 1021 | fragment.binding.tvRunNow.setText("继续运动"); | 1029 | fragment.binding.tvRunNow.setText("继续运动"); |
| 1022 | - fragment.binding.rlScrollViewStartBtn.setTag("2"); | 1030 | + fragment.binding.rlScrollViewStartBtn.setTag(CONTINUE_RACE); |
| 1023 | } else { | 1031 | } else { |
| 1024 | Log.e(TAG, "大于9小时"); | 1032 | Log.e(TAG, "大于9小时"); |
| 1025 | //重置数据 | 1033 | //重置数据 |
| @@ -1027,7 +1035,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -1027,7 +1035,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 1027 | //清空数据库 | 1035 | //清空数据库 |
| 1028 | StepUtil.clearRunData(getContext(), CommonInfo.getUserId(getContext())); | 1036 | StepUtil.clearRunData(getContext(), CommonInfo.getUserId(getContext())); |
| 1029 | fragment.binding.tvRunNow.setText("立即开始"); | 1037 | fragment.binding.tvRunNow.setText("立即开始"); |
| 1030 | - fragment.binding.rlScrollViewStartBtn.setTag("1"); | 1038 | + fragment.binding.rlScrollViewStartBtn.setTag(START_RACE); |
| 1031 | 1039 | ||
| 1032 | } | 1040 | } |
| 1033 | 1041 | ||
| @@ -1045,11 +1053,11 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -1045,11 +1053,11 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 1045 | return; | 1053 | return; |
| 1046 | } | 1054 | } |
| 1047 | if (runRaceDetailInfo.isSignResult()) { | 1055 | if (runRaceDetailInfo.isSignResult()) { |
| 1048 | - fragment.binding.rlScrollViewStartBtn.setTag("1"); | 1056 | + fragment.binding.rlScrollViewStartBtn.setTag(START_RACE); |
| 1049 | fragment.binding.tvRunNow.setText("现在开始"); | 1057 | fragment.binding.tvRunNow.setText("现在开始"); |
| 1050 | fragment.binding.tvGoTip.setVisibility(View.VISIBLE); | 1058 | fragment.binding.tvGoTip.setVisibility(View.VISIBLE); |
| 1051 | } else { | 1059 | } else { |
| 1052 | - fragment.binding.rlScrollViewStartBtn.setTag("0"); | 1060 | + fragment.binding.rlScrollViewStartBtn.setTag(REGIST_RACE); |
| 1053 | fragment.binding.tvRunNow.setText("立即报名"); | 1061 | fragment.binding.tvRunNow.setText("立即报名"); |
| 1054 | fragment.binding.tvGoTip.setVisibility(View.GONE); | 1062 | fragment.binding.tvGoTip.setVisibility(View.GONE); |
| 1055 | } | 1063 | } |
| @@ -1078,7 +1086,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -1078,7 +1086,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 1078 | //清除数据 | 1086 | //清除数据 |
| 1079 | CommonInfo.resetRace(getContext()); | 1087 | CommonInfo.resetRace(getContext()); |
| 1080 | //设置按钮状态 | 1088 | //设置按钮状态 |
| 1081 | - fragment.binding.rlScrollViewStartBtn.setTag("3"); | 1089 | + fragment.binding.rlScrollViewStartBtn.setTag(END_RACE); |
| 1082 | fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.red_round)); | 1090 | fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.red_round)); |
| 1083 | fragment.binding.tvRunNow.setText("赛事已结束"); | 1091 | fragment.binding.tvRunNow.setText("赛事已结束"); |
| 1084 | fragment.binding.tvGoTip.setVisibility(View.GONE); | 1092 | fragment.binding.tvGoTip.setVisibility(View.GONE); |
| @@ -1091,7 +1099,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -1091,7 +1099,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 1091 | if (null != runRaceDetailInfo) { | 1099 | if (null != runRaceDetailInfo) { |
| 1092 | if (runRaceDetailInfo.isEndState()) { | 1100 | if (runRaceDetailInfo.isEndState()) { |
| 1093 | //设置按钮状态 | 1101 | //设置按钮状态 |
| 1094 | - fragment.binding.rlScrollViewStartBtn.setTag("3"); | 1102 | + fragment.binding.rlScrollViewStartBtn.setTag(END_RACE); |
| 1095 | fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.red_round)); | 1103 | fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.red_round)); |
| 1096 | fragment.binding.tvRunNow.setText("赛事已结束"); | 1104 | fragment.binding.tvRunNow.setText("赛事已结束"); |
| 1097 | fragment.binding.tvGoTip.setVisibility(View.GONE); | 1105 | fragment.binding.tvGoTip.setVisibility(View.GONE); |
| @@ -1306,7 +1314,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -1306,7 +1314,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 1306 | } else { | 1314 | } else { |
| 1307 | fragment.binding.includeStreet.tvSignPerson.setText("1"); | 1315 | fragment.binding.includeStreet.tvSignPerson.setText("1"); |
| 1308 | } | 1316 | } |
| 1309 | - fragment.binding.rlScrollViewStartBtn.setTag("1"); | 1317 | + fragment.binding.rlScrollViewStartBtn.setTag(START_RACE); |
| 1310 | fragment.binding.tvRunNow.setText("现在开始"); | 1318 | fragment.binding.tvRunNow.setText("现在开始"); |
| 1311 | fragment.binding.tvGoTip.setVisibility(View.VISIBLE); | 1319 | fragment.binding.tvGoTip.setVisibility(View.VISIBLE); |
| 1312 | if (null != runRaceDetailInfo) { | 1320 | if (null != runRaceDetailInfo) { |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/service/KeepLiveService.java
| @@ -79,7 +79,7 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion | @@ -79,7 +79,7 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion | ||
| 79 | handler.postDelayed(this, 5000); | 79 | handler.postDelayed(this, 5000); |
| 80 | } else { | 80 | } else { |
| 81 | try { | 81 | try { |
| 82 | - if (myReceiver != null) { | 82 | + if (myReceiver != null && isRegisterReceiver) { |
| 83 | unregisterReceiver(myReceiver); | 83 | unregisterReceiver(myReceiver); |
| 84 | } | 84 | } |
| 85 | } catch (Exception e) { | 85 | } catch (Exception e) { |
| @@ -116,7 +116,7 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion | @@ -116,7 +116,7 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion | ||
| 116 | intentFilter.addAction("com.cnlive.strike.receiver.ServiceReceiver"); | 116 | intentFilter.addAction("com.cnlive.strike.receiver.ServiceReceiver"); |
| 117 | intentFilter.addAction("close.KeepService"); | 117 | intentFilter.addAction("close.KeepService"); |
| 118 | registerReceiver(myReceiver, intentFilter); | 118 | registerReceiver(myReceiver, intentFilter); |
| 119 | - isRegisterReceiver=true; | 119 | + isRegisterReceiver = true; |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | /** | 122 | /** |
| @@ -240,7 +240,7 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion | @@ -240,7 +240,7 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion | ||
| 240 | public void onDestroy() { | 240 | public void onDestroy() { |
| 241 | super.onDestroy(); | 241 | super.onDestroy(); |
| 242 | try { | 242 | try { |
| 243 | - if (myReceiver != null&&isRegisterReceiver) { | 243 | + if (myReceiver != null && isRegisterReceiver) { |
| 244 | unregisterReceiver(myReceiver); | 244 | unregisterReceiver(myReceiver); |
| 245 | } | 245 | } |
| 246 | } catch (Exception e) { | 246 | } catch (Exception e) { |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/PedometerMainActivity.java
| @@ -35,9 +35,6 @@ import static android.provider.Settings.EXTRA_APP_PACKAGE; | @@ -35,9 +35,6 @@ import static android.provider.Settings.EXTRA_APP_PACKAGE; | ||
| 35 | @Route(path = "/moudle_pedometer/InterestActivity") | 35 | @Route(path = "/moudle_pedometer/InterestActivity") |
| 36 | public class PedometerMainActivity extends QMUIFragmentActivity { | 36 | public class PedometerMainActivity extends QMUIFragmentActivity { |
| 37 | private static final String TAG = "PedometerMainActivity"; | 37 | private static final String TAG = "PedometerMainActivity"; |
| 38 | - | ||
| 39 | - | ||
| 40 | - private PermissionsUtils mPermissionsUtils = new PermissionsUtils();//权限申请 | ||
| 41 | private RunMainFragment fragment; | 38 | private RunMainFragment fragment; |
| 42 | private List<LatLng> importStreetPoints; | 39 | private List<LatLng> importStreetPoints; |
| 43 | private RunRaceDetailInfo runRaceDetailInfo; | 40 | private RunRaceDetailInfo runRaceDetailInfo; |
| @@ -50,7 +47,14 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | @@ -50,7 +47,14 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | ||
| 50 | @Override | 47 | @Override |
| 51 | protected void onCreate(Bundle savedInstanceState) { | 48 | protected void onCreate(Bundle savedInstanceState) { |
| 52 | super.onCreate(savedInstanceState); | 49 | super.onCreate(savedInstanceState); |
| 53 | - runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().get("runRaceDetailInfo"); | 50 | + if (null != getIntent().getExtras().get("runRaceDetailInfo")) { |
| 51 | + runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().get("runRaceDetailInfo"); | ||
| 52 | + if (getCurrentFragment() == null) { | ||
| 53 | + if (runRaceDetailInfo != null) { | ||
| 54 | + addFragment(runRaceDetailInfo); | ||
| 55 | + } | ||
| 56 | + } | ||
| 57 | + } | ||
| 54 | } | 58 | } |
| 55 | 59 | ||
| 56 | 60 | ||
| @@ -59,10 +63,6 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | @@ -59,10 +63,6 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | ||
| 59 | super.onDestroy(); | 63 | super.onDestroy(); |
| 60 | } | 64 | } |
| 61 | 65 | ||
| 62 | - private void checkIsOpenNotifiction() { | ||
| 63 | - getPermissionsWithTip(); | ||
| 64 | - } | ||
| 65 | - | ||
| 66 | 66 | ||
| 67 | @Override | 67 | @Override |
| 68 | protected void onRestart() { | 68 | protected void onRestart() { |
| @@ -73,7 +73,6 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | @@ -73,7 +73,6 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | ||
| 73 | @Override | 73 | @Override |
| 74 | protected void onResume() { | 74 | protected void onResume() { |
| 75 | super.onResume(); | 75 | super.onResume(); |
| 76 | - checkIsOpenNotifiction(); | ||
| 77 | } | 76 | } |
| 78 | 77 | ||
| 79 | private void addFragment(RunRaceDetailInfo runRaceDetailInfo) { | 78 | private void addFragment(RunRaceDetailInfo runRaceDetailInfo) { |
| @@ -85,72 +84,6 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | @@ -85,72 +84,6 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | ||
| 85 | } | 84 | } |
| 86 | 85 | ||
| 87 | 86 | ||
| 88 | - /** | ||
| 89 | - * 一次申请一组权限(使用拒绝弹框)点击事件 | ||
| 90 | - */ | ||
| 91 | - public void getPermissionsWithTip() { | ||
| 92 | - mPermissionsUtils | ||
| 93 | - .setPermissionsListener(new PermissionsListener() { | ||
| 94 | - @Override | ||
| 95 | - public void onDenied(String[] deniedPermissions) { | ||
| 96 | - getPermissionsWithTip(); | ||
| 97 | - Log.e(TAG, "onDenied: "); | ||
| 98 | - } | ||
| 99 | - | ||
| 100 | - @Override | ||
| 101 | - public void onGranted() { | ||
| 102 | - | ||
| 103 | - //判断GPS是否开启 | ||
| 104 | - if (!MyMapUtil.isOPenGps(getApplicationContext())) { | ||
| 105 | - //开启GPS | ||
| 106 | - Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); | ||
| 107 | - startActivityForResult(intent, 10); | ||
| 108 | - Toast.makeText(getApplicationContext(), getString(R.string.open_gps_tip), Toast.LENGTH_LONG).show(); | ||
| 109 | - } else { | ||
| 110 | - if (getCurrentFragment() == null) { | ||
| 111 | - if (runRaceDetailInfo != null) { | ||
| 112 | - addFragment(runRaceDetailInfo); | ||
| 113 | - } | ||
| 114 | - } | ||
| 115 | - } | ||
| 116 | - } | ||
| 117 | - }) | ||
| 118 | - .withActivity(PedometerMainActivity.this) | ||
| 119 | - .getPermissions(PedometerMainActivity.this | ||
| 120 | - , 100 | ||
| 121 | - , Manifest.permission.INTERNET | ||
| 122 | - , Manifest.permission.READ_EXTERNAL_STORAGE | ||
| 123 | - , Manifest.permission.WRITE_EXTERNAL_STORAGE | ||
| 124 | - , Manifest.permission.ACCESS_FINE_LOCATION | ||
| 125 | - , Manifest.permission.ACCESS_COARSE_LOCATION | ||
| 126 | - ); | ||
| 127 | -// .getPermissionsWithTips(MainActivity.this | ||
| 128 | -// ,100 | ||
| 129 | -// , new String[]{"人家要录音","我们需要读取你的信息,磨磨唧唧的","我要上网","我要读内存卡","我要看日历","我要定位"} | ||
| 130 | -// , Manifest.permission.RECORD_AUDIO | ||
| 131 | -// , Manifest.permission.READ_SMS | ||
| 132 | -// , Manifest.permission.INTERNET | ||
| 133 | -// , Manifest.permission.READ_EXTERNAL_STORAGE | ||
| 134 | -// , Manifest.permission.READ_CALENDAR | ||
| 135 | -// , Manifest.permission.ACCESS_FINE_LOCATION); | ||
| 136 | - } | ||
| 137 | - | ||
| 138 | - | ||
| 139 | - /** | ||
| 140 | - * 权限回调 | ||
| 141 | - * | ||
| 142 | - * @param requestCode | ||
| 143 | - * @param permissions | ||
| 144 | - * @param grantResults | ||
| 145 | - */ | ||
| 146 | - @Override | ||
| 147 | - public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, | ||
| 148 | - @NonNull int[] grantResults) { | ||
| 149 | - super.onRequestPermissionsResult(requestCode, permissions, grantResults); | ||
| 150 | - mPermissionsUtils.dealResult(requestCode, permissions, grantResults); | ||
| 151 | - } | ||
| 152 | - | ||
| 153 | - | ||
| 154 | @Override | 87 | @Override |
| 155 | public void onBackPressed() { | 88 | public void onBackPressed() { |
| 156 | return; | 89 | return; |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/RunRaceDetailActivity.java
| @@ -4,11 +4,14 @@ import android.Manifest; | @@ -4,11 +4,14 @@ import android.Manifest; | ||
| 4 | import android.app.Activity; | 4 | import android.app.Activity; |
| 5 | import android.content.Context; | 5 | import android.content.Context; |
| 6 | import android.content.Intent; | 6 | import android.content.Intent; |
| 7 | +import android.content.pm.PackageManager; | ||
| 8 | +import android.net.Uri; | ||
| 7 | import android.os.Bundle; | 9 | import android.os.Bundle; |
| 8 | import android.provider.Settings; | 10 | import android.provider.Settings; |
| 9 | import android.support.annotation.NonNull; | 11 | import android.support.annotation.NonNull; |
| 10 | import android.support.annotation.Nullable; | 12 | import android.support.annotation.Nullable; |
| 11 | import android.support.design.widget.BottomSheetDialog; | 13 | import android.support.design.widget.BottomSheetDialog; |
| 14 | +import android.support.v4.app.ActivityCompat; | ||
| 12 | import android.text.TextUtils; | 15 | import android.text.TextUtils; |
| 13 | import android.util.Log; | 16 | import android.util.Log; |
| 14 | import android.view.View; | 17 | import android.view.View; |
| @@ -29,6 +32,7 @@ import com.cnlive.moudle.pedometer.ui.fragment.RunMainFragment; | @@ -29,6 +32,7 @@ import com.cnlive.moudle.pedometer.ui.fragment.RunMainFragment; | ||
| 29 | import com.cnlive.moudle.pedometer.ui.fragment.RunRaceDetailFragment; | 32 | import com.cnlive.moudle.pedometer.ui.fragment.RunRaceDetailFragment; |
| 30 | import com.cnlive.moudle.pedometer.ui.fragment.RunningMapFragment; | 33 | import com.cnlive.moudle.pedometer.ui.fragment.RunningMapFragment; |
| 31 | import com.cnlive.moudle.pedometer.ui.widget.FivePersonIconView; | 34 | import com.cnlive.moudle.pedometer.ui.widget.FivePersonIconView; |
| 35 | +import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; | ||
| 32 | import com.cnlive.moudle.pedometer.utils.CheckUtil; | 36 | import com.cnlive.moudle.pedometer.utils.CheckUtil; |
| 33 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; | 37 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; |
| 34 | import com.cnlive.moudle.pedometer.utils.NotificationUtil; | 38 | import com.cnlive.moudle.pedometer.utils.NotificationUtil; |
| @@ -50,6 +54,8 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | @@ -50,6 +54,8 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | ||
| 50 | private QMUIFragment fragment; | 54 | private QMUIFragment fragment; |
| 51 | private PermissionsUtils mPermissionsUtils = new PermissionsUtils();//权限申请 | 55 | private PermissionsUtils mPermissionsUtils = new PermissionsUtils();//权限申请 |
| 52 | private String eventId;//赛道id | 56 | private String eventId;//赛道id |
| 57 | + private int permissionRequestCount = 0;//权限请求次数 | ||
| 58 | + private SelectDialog selectDialog; | ||
| 53 | 59 | ||
| 54 | public static void startActivity(Activity activity, String eventId, String userId, String userIcon, String userName, String userPhone) { | 60 | public static void startActivity(Activity activity, String eventId, String userId, String userIcon, String userName, String userPhone) { |
| 55 | Intent intent = new Intent(activity, RunRaceDetailActivity.class); | 61 | Intent intent = new Intent(activity, RunRaceDetailActivity.class); |
| @@ -77,8 +83,8 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | @@ -77,8 +83,8 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | ||
| 77 | CommonInfo.setUserNickName(this, getIntent().getStringExtra("userName")); | 83 | CommonInfo.setUserNickName(this, getIntent().getStringExtra("userName")); |
| 78 | CommonInfo.setUserIcon(this, getIntent().getStringExtra("userIcon")); | 84 | CommonInfo.setUserIcon(this, getIntent().getStringExtra("userIcon")); |
| 79 | CommonInfo.setUserPhone(this, getIntent().getStringExtra("userPhone")); | 85 | CommonInfo.setUserPhone(this, getIntent().getStringExtra("userPhone")); |
| 80 | - | ||
| 81 | } | 86 | } |
| 87 | + initPermissionDefineTip(); | ||
| 82 | //判断用户是否结束运动 | 88 | //判断用户是否结束运动 |
| 83 | // boolean isRunStep = CommonInfo.getIsRunStepService(this); | 89 | // boolean isRunStep = CommonInfo.getIsRunStepService(this); |
| 84 | // //没有找到相关记录 | 90 | // //没有找到相关记录 |
| @@ -92,6 +98,30 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | @@ -92,6 +98,30 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | ||
| 92 | 98 | ||
| 93 | } | 99 | } |
| 94 | 100 | ||
| 101 | + private void initPermissionDefineTip() { | ||
| 102 | + selectDialog = new SelectDialog(RunRaceDetailActivity.this, "您尚未授予程序运行所需权限\n是否设置?", | ||
| 103 | + "返回", new SelectDialog.DialogInterface() { | ||
| 104 | + @Override | ||
| 105 | + public void onClick(SelectDialog dialog) { | ||
| 106 | + dialog.dismiss(); | ||
| 107 | + finish(); | ||
| 108 | + } | ||
| 109 | + }, "设置", new SelectDialog.DialogInterface() { | ||
| 110 | + @Override | ||
| 111 | + public void onClick(SelectDialog dialog) { | ||
| 112 | + dialog.dismiss(); | ||
| 113 | +// if (!ActivityCompat.shouldShowRequestPermissionRationale(this, permissions[i])) { | ||
| 114 | +// showToast("点击权限,并打开全部权限"); | ||
| 115 | + Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); | ||
| 116 | + Uri uri = Uri.fromParts("package", getPackageName(), null); | ||
| 117 | + intent.setData(uri); | ||
| 118 | + startActivityForResult(intent, 0); | ||
| 119 | + permissionRequestCount = 0; | ||
| 120 | +// } | ||
| 121 | + } | ||
| 122 | + }); | ||
| 123 | + } | ||
| 124 | + | ||
| 95 | @Override | 125 | @Override |
| 96 | protected void onResume() { | 126 | protected void onResume() { |
| 97 | super.onResume(); | 127 | super.onResume(); |
| @@ -140,6 +170,9 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | @@ -140,6 +170,9 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | ||
| 140 | * 一次申请一组权限(使用拒绝弹框)点击事件 | 170 | * 一次申请一组权限(使用拒绝弹框)点击事件 |
| 141 | */ | 171 | */ |
| 142 | public void getPermissionsWithTip() { | 172 | public void getPermissionsWithTip() { |
| 173 | + if (1 == permissionRequestCount) { | ||
| 174 | + return; | ||
| 175 | + } | ||
| 143 | mPermissionsUtils | 176 | mPermissionsUtils |
| 144 | .setPermissionsListener(new PermissionsListener() { | 177 | .setPermissionsListener(new PermissionsListener() { |
| 145 | @Override | 178 | @Override |
| @@ -187,6 +220,36 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | @@ -187,6 +220,36 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | ||
| 187 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, | 220 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, |
| 188 | @NonNull int[] grantResults) { | 221 | @NonNull int[] grantResults) { |
| 189 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); | 222 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); |
| 190 | - mPermissionsUtils.dealResult(requestCode, permissions, grantResults); | 223 | + if (1 == permissionRequestCount) { |
| 224 | + return; | ||
| 225 | + } | ||
| 226 | + boolean isShowPermissionTip = true; | ||
| 227 | + for (int i = 0; i < grantResults.length; i++) {//判断权限的结果,如果有被拒绝,就return | ||
| 228 | + if (grantResults[i] == PackageManager.PERMISSION_DENIED) { | ||
| 229 | + if (!ActivityCompat.shouldShowRequestPermissionRationale(this, permissions[i])) { | ||
| 230 | + isShowPermissionTip = false; | ||
| 231 | + break; | ||
| 232 | +//// showToast("点击权限,并打开全部权限"); | ||
| 233 | +// Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); | ||
| 234 | +// Uri uri = Uri.fromParts("package", getPackageName(), null); | ||
| 235 | +// intent.setData(uri); | ||
| 236 | +// startActivityForResult(intent, 0); | ||
| 237 | + } | ||
| 238 | + } | ||
| 239 | + } | ||
| 240 | + if (isShowPermissionTip) { | ||
| 241 | + mPermissionsUtils.dealResult(requestCode, permissions, grantResults); | ||
| 242 | + } else { | ||
| 243 | + if (0 == permissionRequestCount) { | ||
| 244 | + selectDialog.setCancelable(false); | ||
| 245 | + selectDialog.setCanceledOnTouchOutside(false); | ||
| 246 | + if (!selectDialog.isShowing()) { | ||
| 247 | + selectDialog.show(); | ||
| 248 | + permissionRequestCount = 1; | ||
| 249 | + } | ||
| 250 | + } else { | ||
| 251 | + return; | ||
| 252 | + } | ||
| 253 | + } | ||
| 191 | } | 254 | } |
| 192 | -} | 255 | -} |
| 256 | +} | ||
| 193 | \ No newline at end of file | 257 | \ No newline at end of file |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/adapter/RunLineAdapter.java
| @@ -65,7 +65,12 @@ public class RunLineAdapter extends RecyclerView.Adapter<RunLineAdapter.MyViewHo | @@ -65,7 +65,12 @@ public class RunLineAdapter extends RecyclerView.Adapter<RunLineAdapter.MyViewHo | ||
| 65 | myViewHolder.line_address.setText(list.get(i).getAddress()); | 65 | myViewHolder.line_address.setText(list.get(i).getAddress()); |
| 66 | } | 66 | } |
| 67 | myViewHolder.people_part.setText(list.get(i).getSignupNum() + ""); | 67 | myViewHolder.people_part.setText(list.get(i).getSignupNum() + ""); |
| 68 | - myViewHolder.join_person.initIconData(list.get(i).getFaceUrl()); | 68 | + if (null != list.get(i).getFaceUrl() && list.get(i).getFaceUrl().size() > 0) { |
| 69 | + myViewHolder.join_person.initIconData(list.get(i).getFaceUrl()); | ||
| 70 | + myViewHolder.join_person.setVisibility(View.VISIBLE); | ||
| 71 | + } else { | ||
| 72 | + myViewHolder.join_person.setVisibility(View.GONE); | ||
| 73 | + } | ||
| 69 | } | 74 | } |
| 70 | 75 | ||
| 71 | 76 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RegistrationInfoFragment.java
| @@ -79,6 +79,9 @@ public class RegistrationInfoFragment extends MvpBindingFragment<RegistrationInf | @@ -79,6 +79,9 @@ public class RegistrationInfoFragment extends MvpBindingFragment<RegistrationInf | ||
| 79 | * @param fenceId | 79 | * @param fenceId |
| 80 | */ | 80 | */ |
| 81 | public void addMonitorToFence(int fenceId) { | 81 | public void addMonitorToFence(int fenceId) { |
| 82 | + if (null!=getMvpView()){ | ||
| 83 | + getMvpView().limitClickRegistBtn(); | ||
| 84 | + } | ||
| 82 | if (null == getPresenter()) { | 85 | if (null == getPresenter()) { |
| 83 | return; | 86 | return; |
| 84 | } | 87 | } |
| @@ -145,6 +148,9 @@ public class RegistrationInfoFragment extends MvpBindingFragment<RegistrationInf | @@ -145,6 +148,9 @@ public class RegistrationInfoFragment extends MvpBindingFragment<RegistrationInf | ||
| 145 | binding.sexText.getText().toString().trim().equals("未选择") ? "" : binding.sexText.getText().toString().trim(), | 148 | binding.sexText.getText().toString().trim().equals("未选择") ? "" : binding.sexText.getText().toString().trim(), |
| 146 | binding.birthday.getText().toString().trim().equals("未选择") ? "" : binding.birthday.getText().toString().trim()); | 149 | binding.birthday.getText().toString().trim().equals("未选择") ? "" : binding.birthday.getText().toString().trim()); |
| 147 | } else { | 150 | } else { |
| 151 | + if (null!=getMvpView()){ | ||
| 152 | + getMvpView().allowClickRegistBtn(); | ||
| 153 | + } | ||
| 148 | QMUITipDialogUtil.dismessDialog(); | 154 | QMUITipDialogUtil.dismessDialog(); |
| 149 | QMUITipDialogUtil.messageDialog(getContext(), addMonitoredPersonResponse.getMessage(), 2); | 155 | QMUITipDialogUtil.messageDialog(getContext(), addMonitoredPersonResponse.getMessage(), 2); |
| 150 | } | 156 | } |
moudle_pedometer/src/main/res/layout/item_my_record.xml
| @@ -80,7 +80,7 @@ | @@ -80,7 +80,7 @@ | ||
| 80 | 80 | ||
| 81 | <com.cnlive.moudle.pedometer.ui.widget.FivePersonIconView | 81 | <com.cnlive.moudle.pedometer.ui.widget.FivePersonIconView |
| 82 | android:id="@+id/join_person" | 82 | android:id="@+id/join_person" |
| 83 | - android:layout_width="wrap_content" | 83 | + android:layout_width="150dp" |
| 84 | android:layout_height="40dp" | 84 | android:layout_height="40dp" |
| 85 | android:layout_marginRight="10dp" | 85 | android:layout_marginRight="10dp" |
| 86 | FivePersonIconView:showRightFlag="false" /> | 86 | FivePersonIconView:showRightFlag="false" /> |