Commit b36c7ea5aa9ad7334fe674e1a0dcdb7f7159be67
1 parent
daab7e09
1 优化绑定功能逻辑
Showing
13 changed files
with
342 additions
and
197 deletions
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/presenter/CollTraceListDetailFragmentPresenter.java
| @@ -9,6 +9,7 @@ import com.cnlive.libs.base.logic.callback.FailureCallback; | @@ -9,6 +9,7 @@ import com.cnlive.libs.base.logic.callback.FailureCallback; | ||
| 9 | import com.cnlive.libs.base.logic.callback.SuccessCallback; | 9 | import com.cnlive.libs.base.logic.callback.SuccessCallback; |
| 10 | import com.cnlive.moudle.collectionTrace.frame.view.CollTraceListDetailFragmentView; | 10 | import com.cnlive.moudle.collectionTrace.frame.view.CollTraceListDetailFragmentView; |
| 11 | import com.cnlive.moudle.collectionTrace.model.BindingShoeInfo; | 11 | import com.cnlive.moudle.collectionTrace.model.BindingShoeInfo; |
| 12 | +import com.cnlive.moudle.collectionTrace.model.CheckShoeLineBean; | ||
| 12 | import com.cnlive.moudle.pedometer.model.Constant; | 13 | import com.cnlive.moudle.pedometer.model.Constant; |
| 13 | import com.cnlive.moudle.pedometer.model.MessageEvent; | 14 | import com.cnlive.moudle.pedometer.model.MessageEvent; |
| 14 | import com.cnlive.moudle.pedometer.net.ApiServiceRunLin; | 15 | import com.cnlive.moudle.pedometer.net.ApiServiceRunLin; |
| @@ -67,4 +68,45 @@ public class CollTraceListDetailFragmentPresenter extends MvpBasePresenter<CollT | @@ -67,4 +68,45 @@ public class CollTraceListDetailFragmentPresenter extends MvpBasePresenter<CollT | ||
| 67 | } | 68 | } |
| 68 | }).start(); | 69 | }).start(); |
| 69 | } | 70 | } |
| 71 | + | ||
| 72 | + /** | ||
| 73 | + * 校验轨迹绑定 | ||
| 74 | + * | ||
| 75 | + * @param context | ||
| 76 | + * @param id 轨迹id | ||
| 77 | + * @param eventId 赛事id | ||
| 78 | + */ | ||
| 79 | + public void checkShoeLine(Context context, int id, String eventId, RaceNameListPresenter.CallBack callBack) { | ||
| 80 | + QMUITipDialogUtil.loadingDialog(context, "正在校验...", false); | ||
| 81 | + Map<String, String> map = new HashMap<>(); | ||
| 82 | + map.put("id", id + ""); | ||
| 83 | + map.put("eventId", eventId); | ||
| 84 | + | ||
| 85 | + Logic.create(map).action(new Logic.Action<Map<String, String>, BaseInfo<CheckShoeLineBean>>() { | ||
| 86 | + @Override | ||
| 87 | + public Disposable action(Map<String, String> stringStringMap, DataCallback<BaseInfo<CheckShoeLineBean>> dataCallback) { | ||
| 88 | + return SubscriptionRequest.service(ApiServiceRunLin.class, api -> api.checkShoeLine(stringStringMap)).subscribe(context, dataCallback); | ||
| 89 | + } | ||
| 90 | + }).<BaseInfo<CheckShoeLineBean>>event().setFailureCallback(new FailureCallback() { | ||
| 91 | + @Override | ||
| 92 | + public void onFailure(int code, String message) { | ||
| 93 | + if (getView() != null) { | ||
| 94 | + QMUITipDialogUtil.dismessDialog(); | ||
| 95 | + if (null != callBack) { | ||
| 96 | + callBack.onFailed(); | ||
| 97 | + } | ||
| 98 | + } | ||
| 99 | + } | ||
| 100 | + }).setSuccessCallback(new SuccessCallback<BaseInfo<CheckShoeLineBean>>() { | ||
| 101 | + @Override | ||
| 102 | + public void onSuccess(BaseInfo<CheckShoeLineBean> baseInfo) { | ||
| 103 | + if (getView() != null) { | ||
| 104 | + QMUITipDialogUtil.dismessDialog(); | ||
| 105 | + if (null != callBack) { | ||
| 106 | + callBack.onSuccess(baseInfo.getData().getFenceId(), baseInfo.getData().getEntityName()); | ||
| 107 | + } | ||
| 108 | + } | ||
| 109 | + } | ||
| 110 | + }).start(); | ||
| 111 | + } | ||
| 70 | } | 112 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/presenter/RaceNameListPresenter.java
| @@ -8,6 +8,7 @@ import com.cnlive.libs.base.logic.callback.FailureCallback; | @@ -8,6 +8,7 @@ import com.cnlive.libs.base.logic.callback.FailureCallback; | ||
| 8 | import com.cnlive.libs.base.logic.callback.SuccessCallback; | 8 | import com.cnlive.libs.base.logic.callback.SuccessCallback; |
| 9 | import com.cnlive.moudle.collectionTrace.frame.view.RaceNameListView; | 9 | import com.cnlive.moudle.collectionTrace.frame.view.RaceNameListView; |
| 10 | import com.cnlive.moudle.collectionTrace.model.BindingShoeInfo; | 10 | import com.cnlive.moudle.collectionTrace.model.BindingShoeInfo; |
| 11 | +import com.cnlive.moudle.collectionTrace.model.CheckShoeLineBean; | ||
| 11 | import com.cnlive.moudle.collectionTrace.model.RaceNameListInfo; | 12 | import com.cnlive.moudle.collectionTrace.model.RaceNameListInfo; |
| 12 | import com.cnlive.moudle.pedometer.net.ApiServiceRunLin; | 13 | import com.cnlive.moudle.pedometer.net.ApiServiceRunLin; |
| 13 | import com.cnlive.moudle.pedometer.net.SubscriptionRequest; | 14 | import com.cnlive.moudle.pedometer.net.SubscriptionRequest; |
| @@ -126,4 +127,51 @@ public class RaceNameListPresenter extends MvpBasePresenter<RaceNameListView> { | @@ -126,4 +127,51 @@ public class RaceNameListPresenter extends MvpBasePresenter<RaceNameListView> { | ||
| 126 | } | 127 | } |
| 127 | }).start(); | 128 | }).start(); |
| 128 | } | 129 | } |
| 130 | + | ||
| 131 | + /** | ||
| 132 | + * 校验轨迹绑定 | ||
| 133 | + * | ||
| 134 | + * @param context | ||
| 135 | + * @param id 轨迹id | ||
| 136 | + * @param eventId 赛事id | ||
| 137 | + */ | ||
| 138 | + public void checkShoeLine(Context context, int id, String eventId, CallBack callBack) { | ||
| 139 | + QMUITipDialogUtil.loadingDialog(context, "正在校验...", false); | ||
| 140 | + Map<String, String> map = new HashMap<>(); | ||
| 141 | + map.put("id", id + ""); | ||
| 142 | + map.put("eventId", eventId); | ||
| 143 | + | ||
| 144 | + Logic.create(map).action(new Logic.Action<Map<String, String>, BaseInfo<CheckShoeLineBean>>() { | ||
| 145 | + @Override | ||
| 146 | + public Disposable action(Map<String, String> stringStringMap, DataCallback<BaseInfo<CheckShoeLineBean>> dataCallback) { | ||
| 147 | + return SubscriptionRequest.service(ApiServiceRunLin.class, api -> api.checkShoeLine(stringStringMap)).subscribe(context, dataCallback); | ||
| 148 | + } | ||
| 149 | + }).<BaseInfo<CheckShoeLineBean>>event().setFailureCallback(new FailureCallback() { | ||
| 150 | + @Override | ||
| 151 | + public void onFailure(int code, String message) { | ||
| 152 | + if (getView() != null) { | ||
| 153 | + QMUITipDialogUtil.dismessDialog(); | ||
| 154 | + if (null != callBack) { | ||
| 155 | + callBack.onFailed(); | ||
| 156 | + } | ||
| 157 | + } | ||
| 158 | + } | ||
| 159 | + }).setSuccessCallback(new SuccessCallback<BaseInfo<CheckShoeLineBean>>() { | ||
| 160 | + @Override | ||
| 161 | + public void onSuccess(BaseInfo<CheckShoeLineBean> baseInfo) { | ||
| 162 | + if (getView() != null) { | ||
| 163 | + QMUITipDialogUtil.dismessDialog(); | ||
| 164 | + if (null != callBack) { | ||
| 165 | + callBack.onSuccess(baseInfo.getData().getFenceId(), baseInfo.getData().getEntityName()); | ||
| 166 | + } | ||
| 167 | + } | ||
| 168 | + } | ||
| 169 | + }).start(); | ||
| 170 | + } | ||
| 171 | + | ||
| 172 | + public interface CallBack { | ||
| 173 | + void onSuccess(String fenceId, String entityName); | ||
| 174 | + | ||
| 175 | + void onFailed(); | ||
| 176 | + } | ||
| 129 | } | 177 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollRunningFinishFragmentView.java
| @@ -114,7 +114,6 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | @@ -114,7 +114,6 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | ||
| 114 | //绘制运营打的点 | 114 | //绘制运营打的点 |
| 115 | if (null != collectPoints) { | 115 | if (null != collectPoints) { |
| 116 | //根据打点集合,自适应缩放 | 116 | //根据打点集合,自适应缩放 |
| 117 | - MyMapUtil.setCollMapAutoZoom(baiduMap, collectPoints, -1.5f); | ||
| 118 | for (CollectPoint point : collectPoints) { | 117 | for (CollectPoint point : collectPoints) { |
| 119 | LatLng markLatLng = new LatLng(point.getLatitude(), point.getLongitude()); | 118 | LatLng markLatLng = new LatLng(point.getLatitude(), point.getLongitude()); |
| 120 | if (null != markLatLng) { | 119 | if (null != markLatLng) { |
| @@ -310,9 +309,11 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | @@ -310,9 +309,11 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | ||
| 310 | public void success(List<LatLng> resultPoints) { | 309 | public void success(List<LatLng> resultPoints) { |
| 311 | queryResultPoints = resultPoints; | 310 | queryResultPoints = resultPoints; |
| 312 | if (null != resultPoints) { | 311 | if (null != resultPoints) { |
| 313 | - //绘制轨迹 | ||
| 314 | - MyMapUtil.drawHistoryTrack(getContext(), baiduMap, resultPoints, SortType.asc, R.color.green_round, R.drawable.icon_start, R.drawable.icon_end); | ||
| 315 | - MyMapUtil.setMapAutoZoom(baiduMap, resultPoints,-1.5f); | 312 | + if (resultPoints.size() > 1) { |
| 313 | + //绘制轨迹 | ||
| 314 | + MyMapUtil.drawHistoryTrack(getContext(), baiduMap, resultPoints, SortType.asc, R.color.green_round, R.drawable.icon_start, R.drawable.icon_end); | ||
| 315 | + MyMapUtil.setMapAutoZoom(baiduMap, resultPoints, -1.5f); | ||
| 316 | + } | ||
| 316 | 317 | ||
| 317 | } else { | 318 | } else { |
| 318 | SelectDialog selectDialog = new SelectDialog(getContext(), "轨迹获取失败,是否重试?", "取消", new SelectDialog.DialogInterface() { | 319 | SelectDialog selectDialog = new SelectDialog(getContext(), "轨迹获取失败,是否重试?", "取消", new SelectDialog.DialogInterface() { |
| @@ -418,45 +419,7 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | @@ -418,45 +419,7 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | ||
| 418 | } | 419 | } |
| 419 | } | 420 | } |
| 420 | 421 | ||
| 421 | - private void addFence() { | ||
| 422 | - QMUITipDialogUtil.dismessDialog(); | ||
| 423 | - QMUITipDialogUtil.loadingDialog(getContext(), "正在创建地理围栏", false); | ||
| 424 | - CreateFenceRequest createFenceRequest = null; | ||
| 425 | - int offset = Constant.FENCE_OFFSET;// 偏离距离 | ||
| 426 | - int denoise = Constant.FENCE_DENOISE; //围栏去噪精度 | ||
| 427 | - if (null != collUserStepEntity) { | ||
| 428 | - //赛事标题作为围栏名称 | ||
| 429 | - String eventId = collUserStepEntity.getStreetId(); | ||
| 430 | - if (mClient != null && !TextUtils.isEmpty(eventId) && null != collectLatLngs) { | ||
| 431 | - createFenceRequest = CreateFenceRequest.buildServerPolylineRequest(Constant.TAG, Constant.SERVICE_ID, eventId, "cc", collectLatLngs, offset, denoise, CoordType.gcj02); | ||
| 432 | - mClient.createFence(createFenceRequest, CollRunningFinishFragmentView.this); | ||
| 433 | - } | ||
| 434 | - } | ||
| 435 | - } | ||
| 436 | 422 | ||
| 437 | - // //判断地理围栏是否创建成功 | ||
| 438 | -// if (null != collUserStepEntity) { | ||
| 439 | -// if (TextUtils.isEmpty(collUserStepEntity.getFenceId())) { | ||
| 440 | -// //开始创建地理围栏 | ||
| 441 | -// QMUITipDialogUtil.loadingDialog(getContext(), "正在创建地理围栏", false); | ||
| 442 | -// CreateFenceRequest createFenceRequest = null; | ||
| 443 | -// int offset = Constant.FENCE_OFFSET;// 偏离距离 | ||
| 444 | -// int denoise = Constant.FENCE_DENOISE; //围栏去噪精度 | ||
| 445 | -// if (null != collUserStepEntity) { | ||
| 446 | -// //赛事标题作为围栏名称 | ||
| 447 | -// String fenceName = collUserStepEntity.getStreetTitle(); | ||
| 448 | -// if (mClient != null && !TextUtils.isEmpty(fenceName) && null != collectLatLngs) { | ||
| 449 | -// if (createFenceRequest == null) { | ||
| 450 | -// createFenceRequest = CreateFenceRequest.buildServerPolylineRequest(Constant.TAG, Constant.SERVICE_ID, fenceName, "", collectLatLngs, offset, denoise, CoordType.gcj02); | ||
| 451 | -// mClient.createFence(createFenceRequest, CollRunningFinishFragmentView.this); | ||
| 452 | -// } | ||
| 453 | -// } | ||
| 454 | -// } | ||
| 455 | -// } else { | ||
| 456 | -// //已经存在地理围栏(直接将数据传给服务器) | ||
| 457 | -// | ||
| 458 | -// } | ||
| 459 | -// } | ||
| 460 | public void initMap() { | 423 | public void initMap() { |
| 461 | this.mMapView = fragment.binding.mapView; | 424 | this.mMapView = fragment.binding.mapView; |
| 462 | if (baiduMap == null) { | 425 | if (baiduMap == null) { |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollTraceListDetailFragmentView.java
| @@ -11,12 +11,8 @@ import android.util.Log; | @@ -11,12 +11,8 @@ import android.util.Log; | ||
| 11 | import android.view.MotionEvent; | 11 | import android.view.MotionEvent; |
| 12 | import android.view.View; | 12 | import android.view.View; |
| 13 | 13 | ||
| 14 | -import com.baidu.location.LocationClient; | ||
| 15 | -import com.baidu.location.LocationClientOption; | ||
| 16 | import com.baidu.mapapi.map.BaiduMap; | 14 | import com.baidu.mapapi.map.BaiduMap; |
| 17 | -import com.baidu.mapapi.map.BitmapDescriptorFactory; | ||
| 18 | import com.baidu.mapapi.map.MapView; | 15 | import com.baidu.mapapi.map.MapView; |
| 19 | -import com.baidu.mapapi.map.MyLocationConfiguration; | ||
| 20 | import com.baidu.mapapi.map.Overlay; | 16 | import com.baidu.mapapi.map.Overlay; |
| 21 | import com.baidu.mapapi.map.UiSettings; | 17 | import com.baidu.mapapi.map.UiSettings; |
| 22 | import com.baidu.mapapi.model.LatLng; | 18 | import com.baidu.mapapi.model.LatLng; |
| @@ -41,6 +37,7 @@ import com.baidu.trace.model.CoordType; | @@ -41,6 +37,7 @@ import com.baidu.trace.model.CoordType; | ||
| 41 | import com.baidu.trace.model.SortType; | 37 | import com.baidu.trace.model.SortType; |
| 42 | import com.bumptech.glide.Glide; | 38 | import com.bumptech.glide.Glide; |
| 43 | import com.cnlive.libs.base.util.AlertUtil; | 39 | import com.cnlive.libs.base.util.AlertUtil; |
| 40 | +import com.cnlive.moudle.collectionTrace.frame.presenter.RaceNameListPresenter; | ||
| 44 | import com.cnlive.moudle.collectionTrace.model.CollectPoint; | 41 | import com.cnlive.moudle.collectionTrace.model.CollectPoint; |
| 45 | import com.cnlive.moudle.collectionTrace.model.RaceNameListInfo; | 42 | import com.cnlive.moudle.collectionTrace.model.RaceNameListInfo; |
| 46 | import com.cnlive.moudle.collectionTrace.ui.adapter.CollFinishDetaiAdapter; | 43 | import com.cnlive.moudle.collectionTrace.ui.adapter.CollFinishDetaiAdapter; |
| @@ -76,7 +73,6 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | @@ -76,7 +73,6 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | ||
| 76 | private LBSTraceClient mClient = null; | 73 | private LBSTraceClient mClient = null; |
| 77 | private List<Overlay> allMapOverlays; | 74 | private List<Overlay> allMapOverlays; |
| 78 | private List<com.baidu.trace.model.LatLng> importPoints; | 75 | private List<com.baidu.trace.model.LatLng> importPoints; |
| 79 | - private String fenceEntityName; | ||
| 80 | private String position; | 76 | private String position; |
| 81 | 77 | ||
| 82 | public CollTraceListDetailFragmentView(CollTraceListDetailFragment fragment) { | 78 | public CollTraceListDetailFragmentView(CollTraceListDetailFragment fragment) { |
| @@ -88,12 +84,11 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | @@ -88,12 +84,11 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | ||
| 88 | return fragment == null ? null : fragment.getActivity(); | 84 | return fragment == null ? null : fragment.getActivity(); |
| 89 | } | 85 | } |
| 90 | 86 | ||
| 91 | - public void initView(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean, String fenceEntityName, String position) { | 87 | + public void initView(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean, String position) { |
| 92 | if (mClient == null) { | 88 | if (mClient == null) { |
| 93 | mClient = new LBSTraceClient(fragment.getActivity()); | 89 | mClient = new LBSTraceClient(fragment.getActivity()); |
| 94 | } | 90 | } |
| 95 | this.position = position; | 91 | this.position = position; |
| 96 | - this.fenceEntityName = fenceEntityName; | ||
| 97 | this.eventShoeLinesBean = eventShoeLinesBean; | 92 | this.eventShoeLinesBean = eventShoeLinesBean; |
| 98 | allMapOverlays = new ArrayList<>(); | 93 | allMapOverlays = new ArrayList<>(); |
| 99 | //设置滑动卡片 | 94 | //设置滑动卡片 |
| @@ -147,19 +142,38 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | @@ -147,19 +142,38 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | ||
| 147 | @Override | 142 | @Override |
| 148 | public void onClick(SelectDialog dialog) { | 143 | public void onClick(SelectDialog dialog) { |
| 149 | dialog.cancel(); | 144 | dialog.cancel(); |
| 150 | - //先判断当前是否已经绑定轨迹 | ||
| 151 | - if (TextUtils.isEmpty(fenceEntityName)) { | ||
| 152 | - Log.e(TAG, "onClick: 未绑定轨迹"); | ||
| 153 | - //开始绑定轨迹 | ||
| 154 | - //判断是否有打的点 | ||
| 155 | - if (null != importPoints && !TextUtils.isEmpty(eventShoeLinesBean.getDarenId()) && !TextUtils.isEmpty(eventShoeLinesBean.getEventName())) { | ||
| 156 | - addFence(eventShoeLinesBean.getDarenId(), eventShoeLinesBean.getEventName(), importPoints); | 145 | + //先校验 |
| 146 | + fragment.getPresenter().checkShoeLine(fragment.getActivity(), eventShoeLinesBean.getId(), eventShoeLinesBean.getEventId(), new RaceNameListPresenter.CallBack() { | ||
| 147 | + @Override | ||
| 148 | + public void onSuccess(String fenceId, String entityName) { | ||
| 149 | + if (null == fragment.getActivity()) { | ||
| 150 | + return; | ||
| 151 | + } | ||
| 152 | + //判断是否为空 | ||
| 153 | + if (!TextUtils.isEmpty(fenceId) && !TextUtils.isEmpty(entityName)) { | ||
| 154 | + List<Long> fenceIdList = new ArrayList<>(); | ||
| 155 | + fenceIdList.add(Long.parseLong(fenceId)); | ||
| 156 | + //开始删除围栏 | ||
| 157 | + DeleteFenceRequest deleteFenceRequest = DeleteFenceRequest.buildServerRequest(Constant.TAG, Constant.SERVICE_ID, entityName, fenceIdList); | ||
| 158 | + if (null != mClient) { | ||
| 159 | + QMUITipDialogUtil.loadingDialog(fragment.getActivity(), "正在删除围栏", false); | ||
| 160 | + mClient.deleteFence(deleteFenceRequest, CollTraceListDetailFragmentView.this); | ||
| 161 | + } | ||
| 162 | + } | ||
| 163 | + //没有绑定,则直接添加 | ||
| 164 | + else { | ||
| 165 | + if (null != importPoints && !TextUtils.isEmpty(eventShoeLinesBean.getDarenId()) && !TextUtils.isEmpty(eventShoeLinesBean.getEventName())) { | ||
| 166 | + addFence(eventShoeLinesBean.getDarenId(), eventShoeLinesBean.getEventName(), importPoints); | ||
| 167 | + } | ||
| 168 | + } | ||
| 157 | } | 169 | } |
| 158 | - } else { | ||
| 159 | - Log.e(TAG, "onClick: 已绑定轨迹"); | ||
| 160 | - //开始查询 | ||
| 161 | - queryFenceList(fenceEntityName); | ||
| 162 | - } | 170 | + |
| 171 | + @Override | ||
| 172 | + public void onFailed() { | ||
| 173 | + | ||
| 174 | + } | ||
| 175 | + }); | ||
| 176 | + | ||
| 163 | 177 | ||
| 164 | } | 178 | } |
| 165 | }); | 179 | }); |
| @@ -235,7 +249,7 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | @@ -235,7 +249,7 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | ||
| 235 | return; | 249 | return; |
| 236 | } | 250 | } |
| 237 | MyMapUtil.drawHistoryTrack(getContext(), baiduMap, resultPoints, SortType.asc, R.color.green_round, R.drawable.icon_start, R.drawable.icon_end); | 251 | MyMapUtil.drawHistoryTrack(getContext(), baiduMap, resultPoints, SortType.asc, R.color.green_round, R.drawable.icon_start, R.drawable.icon_end); |
| 238 | - MyMapUtil.setMapAutoZoom(baiduMap, resultPoints,-1.5f); | 252 | + MyMapUtil.setMapAutoZoom(baiduMap, resultPoints, -1.5f); |
| 239 | } | 253 | } |
| 240 | } | 254 | } |
| 241 | }); | 255 | }); |
| @@ -277,7 +291,7 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | @@ -277,7 +291,7 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | ||
| 277 | } | 291 | } |
| 278 | } | 292 | } |
| 279 | 293 | ||
| 280 | - public void initMap() { | 294 | + public void initMap(CallBack callBack) { |
| 281 | this.mMapView = fragment.binding.mapView; | 295 | this.mMapView = fragment.binding.mapView; |
| 282 | if (baiduMap == null) { | 296 | if (baiduMap == null) { |
| 283 | baiduMap = mMapView.getMap(); | 297 | baiduMap = mMapView.getMap(); |
| @@ -294,21 +308,28 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | @@ -294,21 +308,28 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | ||
| 294 | mUiSettings.setCompassEnabled(false); | 308 | mUiSettings.setCompassEnabled(false); |
| 295 | //显示定位图层 | 309 | //显示定位图层 |
| 296 | baiduMap.setMyLocationEnabled(false); | 310 | baiduMap.setMyLocationEnabled(false); |
| 297 | - | 311 | + baiduMap.setOnMapLoadedCallback(new BaiduMap.OnMapLoadedCallback() { |
| 312 | + @Override | ||
| 313 | + public void onMapLoaded() { | ||
| 314 | + if (null != callBack) { | ||
| 315 | + callBack.onMapLoadSuccess(); | ||
| 316 | + } | ||
| 317 | + } | ||
| 318 | + }); | ||
| 298 | } | 319 | } |
| 299 | 320 | ||
| 300 | - /** | ||
| 301 | - * 查询地理围栏 | ||
| 302 | - */ | ||
| 303 | - private void queryFenceList(String entityName) { | ||
| 304 | - QMUITipDialogUtil.loadingDialog(fragment.getActivity(), "正在查询围栏信息...", false); | ||
| 305 | - List<Long> fenceId = new ArrayList<>(); | ||
| 306 | - fenceId.add(0L); | ||
| 307 | - FenceListRequest fenceListRequest = FenceListRequest.buildServerRequest(Constant.TAG, Constant.SERVICE_ID, entityName, null, CoordType.gcj02, 1, 5000); | ||
| 308 | - if (null != mClient || null != fenceListRequest) { | ||
| 309 | - mClient.queryFenceList(fenceListRequest, CollTraceListDetailFragmentView.this); | ||
| 310 | - } | ||
| 311 | - } | 321 | +// /** |
| 322 | +// * 查询地理围栏 | ||
| 323 | +// */ | ||
| 324 | +// private void queryFenceList(String entityName) { | ||
| 325 | +// QMUITipDialogUtil.loadingDialog(fragment.getActivity(), "正在查询围栏信息...", false); | ||
| 326 | +// List<Long> fenceId = new ArrayList<>(); | ||
| 327 | +// fenceId.add(0L); | ||
| 328 | +// FenceListRequest fenceListRequest = FenceListRequest.buildServerRequest(Constant.TAG, Constant.SERVICE_ID, entityName, null, CoordType.gcj02, 1, 5000); | ||
| 329 | +// if (null != mClient || null != fenceListRequest) { | ||
| 330 | +// mClient.queryFenceList(fenceListRequest, CollTraceListDetailFragmentView.this); | ||
| 331 | +// } | ||
| 332 | +// } | ||
| 312 | 333 | ||
| 313 | 334 | ||
| 314 | public void updataBindBtnState(boolean isBind) { | 335 | public void updataBindBtnState(boolean isBind) { |
| @@ -378,52 +399,52 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | @@ -378,52 +399,52 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | ||
| 378 | */ | 399 | */ |
| 379 | @Override | 400 | @Override |
| 380 | public void onFenceListCallback(FenceListResponse fenceListResponse) { | 401 | public void onFenceListCallback(FenceListResponse fenceListResponse) { |
| 381 | - if (null == fenceListResponse) { | ||
| 382 | - return; | ||
| 383 | - } | ||
| 384 | - List<Long> fenceIdList = null; | ||
| 385 | - if (null != fenceListResponse.getFenceInfos()) { | ||
| 386 | - fenceIdList = new ArrayList<>(); | ||
| 387 | - for (FenceInfo fenceInfo : fenceListResponse.getFenceInfos()) { | ||
| 388 | - //如果是线性围栏 | ||
| 389 | - if (fenceInfo.getFenceShape() == FenceShape.polyline) { | ||
| 390 | - //判断是否是当前围栏名称 | ||
| 391 | - if (null != eventShoeLinesBean) { | ||
| 392 | - if (!TextUtils.isEmpty(eventShoeLinesBean.getEventName())) { | ||
| 393 | - String serverFenceName = fenceInfo.getPolylineFence().getFenceName(); | ||
| 394 | - String currentFenceName = eventShoeLinesBean.getEventName(); | ||
| 395 | - if (serverFenceName.equals(currentFenceName)) { | ||
| 396 | - //添加围栏id | ||
| 397 | - fenceIdList.add(fenceInfo.getPolylineFence().getFenceId()); | ||
| 398 | - } | ||
| 399 | - } | ||
| 400 | - } | ||
| 401 | - | ||
| 402 | - } | ||
| 403 | - } | ||
| 404 | - //判断围栏是否查询到 | ||
| 405 | - if (null != fenceIdList && fenceIdList.size() > 0) { | ||
| 406 | - Log.e(TAG, "onFenceListCallback: 获取到围栏数量" + fenceIdList.size()); | ||
| 407 | - List<Long> finalFenceIdList = fenceIdList; | ||
| 408 | - new Handler().postDelayed(new Runnable() { | ||
| 409 | - @Override | ||
| 410 | - public void run() { | ||
| 411 | - QMUITipDialogUtil.dismessDialog(); | ||
| 412 | - //开始删除围栏 | ||
| 413 | - DeleteFenceRequest deleteFenceRequest = DeleteFenceRequest.buildServerRequest(Constant.TAG, Constant.SERVICE_ID, fenceEntityName, finalFenceIdList); | ||
| 414 | - if (null != mClient) { | ||
| 415 | - QMUITipDialogUtil.loadingDialog(fragment.getActivity(), "正在删除围栏", false); | ||
| 416 | - mClient.deleteFence(deleteFenceRequest, CollTraceListDetailFragmentView.this); | ||
| 417 | - } | ||
| 418 | - } | ||
| 419 | - }, 1000); | ||
| 420 | - } else { | ||
| 421 | - //没有查询到围栏,直接添加 | ||
| 422 | - addFence(eventShoeLinesBean.getDarenId(), eventShoeLinesBean.getEventName(), importPoints); | ||
| 423 | - } | ||
| 424 | - } else { | ||
| 425 | - QMUITipDialogUtil.dismessDialog(); | ||
| 426 | - } | 402 | +// if (null == fenceListResponse) { |
| 403 | +// return; | ||
| 404 | +// } | ||
| 405 | +// List<Long> fenceIdList = null; | ||
| 406 | +// if (null != fenceListResponse.getFenceInfos()) { | ||
| 407 | +// fenceIdList = new ArrayList<>(); | ||
| 408 | +// for (FenceInfo fenceInfo : fenceListResponse.getFenceInfos()) { | ||
| 409 | +// //如果是线性围栏 | ||
| 410 | +// if (fenceInfo.getFenceShape() == FenceShape.polyline) { | ||
| 411 | +// //判断是否是当前围栏名称 | ||
| 412 | +// if (null != eventShoeLinesBean) { | ||
| 413 | +// if (!TextUtils.isEmpty(eventShoeLinesBean.getEventName())) { | ||
| 414 | +// String serverFenceName = fenceInfo.getPolylineFence().getFenceName(); | ||
| 415 | +// String currentFenceName = eventShoeLinesBean.getEventName(); | ||
| 416 | +// if (serverFenceName.equals(currentFenceName)) { | ||
| 417 | +// //添加围栏id | ||
| 418 | +// fenceIdList.add(fenceInfo.getPolylineFence().getFenceId()); | ||
| 419 | +// } | ||
| 420 | +// } | ||
| 421 | +// } | ||
| 422 | +// | ||
| 423 | +// } | ||
| 424 | +// } | ||
| 425 | +// //判断围栏是否查询到 | ||
| 426 | +// if (null != fenceIdList && fenceIdList.size() > 0) { | ||
| 427 | +// Log.e(TAG, "onFenceListCallback: 获取到围栏数量" + fenceIdList.size()); | ||
| 428 | +// List<Long> finalFenceIdList = fenceIdList; | ||
| 429 | +// new Handler().postDelayed(new Runnable() { | ||
| 430 | +// @Override | ||
| 431 | +// public void run() { | ||
| 432 | +// QMUITipDialogUtil.dismessDialog(); | ||
| 433 | +// //开始删除围栏 | ||
| 434 | +// DeleteFenceRequest deleteFenceRequest = DeleteFenceRequest.buildServerRequest(Constant.TAG, Constant.SERVICE_ID, fenceEntityName, finalFenceIdList); | ||
| 435 | +// if (null != mClient) { | ||
| 436 | +// QMUITipDialogUtil.loadingDialog(fragment.getActivity(), "正在删除围栏", false); | ||
| 437 | +// mClient.deleteFence(deleteFenceRequest, CollTraceListDetailFragmentView.this); | ||
| 438 | +// } | ||
| 439 | +// } | ||
| 440 | +// }, 1000); | ||
| 441 | +// } else { | ||
| 442 | +// //没有查询到围栏,直接添加 | ||
| 443 | +// addFence(eventShoeLinesBean.getDarenId(), eventShoeLinesBean.getEventName(), importPoints); | ||
| 444 | +// } | ||
| 445 | +// } else { | ||
| 446 | +// QMUITipDialogUtil.dismessDialog(); | ||
| 447 | +// } | ||
| 427 | } | 448 | } |
| 428 | 449 | ||
| 429 | @Override | 450 | @Override |
| @@ -455,4 +476,8 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | @@ -455,4 +476,8 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | ||
| 455 | public void onListMonitoredPersonCallback(ListMonitoredPersonResponse listMonitoredPersonResponse) { | 476 | public void onListMonitoredPersonCallback(ListMonitoredPersonResponse listMonitoredPersonResponse) { |
| 456 | 477 | ||
| 457 | } | 478 | } |
| 479 | + | ||
| 480 | + public interface CallBack { | ||
| 481 | + void onMapLoadSuccess(); | ||
| 482 | + } | ||
| 458 | } | 483 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/RaceNameListView.java
| @@ -28,6 +28,7 @@ import com.baidu.trace.model.CoordType; | @@ -28,6 +28,7 @@ import com.baidu.trace.model.CoordType; | ||
| 28 | import com.baidu.trace.model.LatLng; | 28 | import com.baidu.trace.model.LatLng; |
| 29 | import com.cnlive.libs.base.util.AlertUtil; | 29 | import com.cnlive.libs.base.util.AlertUtil; |
| 30 | import com.cnlive.moudle.collectionTrace.commonInfo.CollCommonInfo; | 30 | import com.cnlive.moudle.collectionTrace.commonInfo.CollCommonInfo; |
| 31 | +import com.cnlive.moudle.collectionTrace.frame.presenter.RaceNameListPresenter; | ||
| 31 | import com.cnlive.moudle.collectionTrace.model.BindingShoeInfo; | 32 | import com.cnlive.moudle.collectionTrace.model.BindingShoeInfo; |
| 32 | import com.cnlive.moudle.collectionTrace.model.CollectPoint; | 33 | import com.cnlive.moudle.collectionTrace.model.CollectPoint; |
| 33 | import com.cnlive.moudle.collectionTrace.model.RaceNameListInfo; | 34 | import com.cnlive.moudle.collectionTrace.model.RaceNameListInfo; |
| @@ -99,7 +100,6 @@ public class RaceNameListView implements MvpView, OnFenceListener { | @@ -99,7 +100,6 @@ public class RaceNameListView implements MvpView, OnFenceListener { | ||
| 99 | 100 | ||
| 100 | public void bindingShoeLine(int position, BaseInfo<BindingShoeInfo> baseInfo) { | 101 | public void bindingShoeLine(int position, BaseInfo<BindingShoeInfo> baseInfo) { |
| 101 | if (baseInfo.getData().getEntityName() != null) { | 102 | if (baseInfo.getData().getEntityName() != null) { |
| 102 | - fragment.entityName = baseInfo.getData().getEntityName(); | ||
| 103 | } | 103 | } |
| 104 | list.get(position).setIsEnable(0); | 104 | list.get(position).setIsEnable(0); |
| 105 | for (int i = 0; i < list.size(); i++) { | 105 | for (int i = 0; i < list.size(); i++) { |
| @@ -125,13 +125,12 @@ public class RaceNameListView implements MvpView, OnFenceListener { | @@ -125,13 +125,12 @@ public class RaceNameListView implements MvpView, OnFenceListener { | ||
| 125 | adapter = new RaceNameListAdapter(list, fragment.getActivity()); | 125 | adapter = new RaceNameListAdapter(list, fragment.getActivity()); |
| 126 | fragment.binding.raceRecy.setAdapter(adapter); | 126 | fragment.binding.raceRecy.setAdapter(adapter); |
| 127 | if (raceNameListInfoBaseInfo.getData().getEntityName() != null) | 127 | if (raceNameListInfoBaseInfo.getData().getEntityName() != null) |
| 128 | - fragment.entityName = raceNameListInfoBaseInfo.getData().getEntityName(); | ||
| 129 | - adapter.setOnItemClick(new RaceNameListAdapter.OnItemClick() { | ||
| 130 | - @Override | ||
| 131 | - public void onItemClickListener(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean, int position) { | ||
| 132 | - CollTraceListDetailActivity.startActivity(fragment.getActivity(), eventShoeLinesBean, fragment.entityName, position + ""); | ||
| 133 | - } | ||
| 134 | - }); | 128 | + adapter.setOnItemClick(new RaceNameListAdapter.OnItemClick() { |
| 129 | + @Override | ||
| 130 | + public void onItemClickListener(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean, int position) { | ||
| 131 | + CollTraceListDetailActivity.startActivity(fragment.getActivity(), eventShoeLinesBean, position + ""); | ||
| 132 | + } | ||
| 133 | + }); | ||
| 135 | adapter.setOnAddShoeLineClick(new RaceNameListAdapter.OnAddShoeLineClick() { | 134 | adapter.setOnAddShoeLineClick(new RaceNameListAdapter.OnAddShoeLineClick() { |
| 136 | @Override | 135 | @Override |
| 137 | public void onAddSholeLineClickListener(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean, int position) { | 136 | public void onAddSholeLineClickListener(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean, int position) { |
| @@ -166,19 +165,37 @@ public class RaceNameListView implements MvpView, OnFenceListener { | @@ -166,19 +165,37 @@ public class RaceNameListView implements MvpView, OnFenceListener { | ||
| 166 | @Override | 165 | @Override |
| 167 | public void onClick(SelectDialog dialog) { | 166 | public void onClick(SelectDialog dialog) { |
| 168 | dialog.cancel(); | 167 | dialog.cancel(); |
| 169 | - //先判断当前是否已经绑定轨迹 | ||
| 170 | - if (TextUtils.isEmpty(fragment.entityName)) { | ||
| 171 | - Log.e(TAG, "onClick: 未绑定轨迹"); | ||
| 172 | - //开始绑定轨迹 | ||
| 173 | - //判断是否有打的点 | ||
| 174 | - if (null != importPoints && !TextUtils.isEmpty(eventShoeLinesBean.getDarenId()) && !TextUtils.isEmpty(eventShoeLinesBean.getEventName())) { | ||
| 175 | - addFence(eventShoeLinesBean.getDarenId(), eventShoeLinesBean.getEventName(), importPoints); | 168 | + //先校验 |
| 169 | + fragment.getPresenter().checkShoeLine(fragment.getActivity(), eventShoeLinesBean.getId(), eventShoeLinesBean.getEventId(), new RaceNameListPresenter.CallBack() { | ||
| 170 | + @Override | ||
| 171 | + public void onSuccess(String fenceId, String entityName) { | ||
| 172 | + if (null == fragment.getActivity()) { | ||
| 173 | + return; | ||
| 174 | + } | ||
| 175 | + //判断是否为空 | ||
| 176 | + if (!TextUtils.isEmpty(fenceId) && !TextUtils.isEmpty(entityName)) { | ||
| 177 | + List<Long> fenceIdList = new ArrayList<>(); | ||
| 178 | + fenceIdList.add(Long.parseLong(fenceId)); | ||
| 179 | + //开始删除围栏 | ||
| 180 | + DeleteFenceRequest deleteFenceRequest = DeleteFenceRequest.buildServerRequest(Constant.TAG, Constant.SERVICE_ID, entityName, fenceIdList); | ||
| 181 | + if (null != mClient) { | ||
| 182 | + QMUITipDialogUtil.loadingDialog(fragment.getActivity(), "正在删除围栏", false); | ||
| 183 | + mClient.deleteFence(deleteFenceRequest, RaceNameListView.this); | ||
| 184 | + } | ||
| 185 | + } | ||
| 186 | + //没有绑定,则直接添加 | ||
| 187 | + else { | ||
| 188 | + if (null != importPoints && !TextUtils.isEmpty(eventShoeLinesBean.getDarenId()) && !TextUtils.isEmpty(eventShoeLinesBean.getEventName())) { | ||
| 189 | + addFence(eventShoeLinesBean.getDarenId(), eventShoeLinesBean.getEventName(), importPoints); | ||
| 190 | + } | ||
| 191 | + } | ||
| 176 | } | 192 | } |
| 177 | - } else { | ||
| 178 | - Log.e(TAG, "onClick: 已绑定轨迹"); | ||
| 179 | - //开始查询 | ||
| 180 | - queryFenceList(fragment.entityName); | ||
| 181 | - } | 193 | + |
| 194 | + @Override | ||
| 195 | + public void onFailed() { | ||
| 196 | + | ||
| 197 | + } | ||
| 198 | + }); | ||
| 182 | 199 | ||
| 183 | // queryFenceList(eventShoeLinesBean.getEventId()); | 200 | // queryFenceList(eventShoeLinesBean.getEventId()); |
| 184 | // fragment.addShoeLine(eventShoeLinesBean, position); | 201 | // fragment.addShoeLine(eventShoeLinesBean, position); |
| @@ -365,52 +382,52 @@ public class RaceNameListView implements MvpView, OnFenceListener { | @@ -365,52 +382,52 @@ public class RaceNameListView implements MvpView, OnFenceListener { | ||
| 365 | */ | 382 | */ |
| 366 | @Override | 383 | @Override |
| 367 | public void onFenceListCallback(FenceListResponse fenceListResponse) { | 384 | public void onFenceListCallback(FenceListResponse fenceListResponse) { |
| 368 | - if (null == fenceListResponse) { | ||
| 369 | - return; | ||
| 370 | - } | ||
| 371 | - List<Long> fenceIdList = null; | ||
| 372 | - if (null != fenceListResponse.getFenceInfos()) { | ||
| 373 | - fenceIdList = new ArrayList<>(); | ||
| 374 | - for (FenceInfo fenceInfo : fenceListResponse.getFenceInfos()) { | ||
| 375 | - //如果是线性围栏 | ||
| 376 | - if (fenceInfo.getFenceShape() == FenceShape.polyline) { | ||
| 377 | - //判断是否是当前围栏名称 | ||
| 378 | - if (null != currentSelBean) { | ||
| 379 | - if (!TextUtils.isEmpty(currentSelBean.getEventName())) { | ||
| 380 | - String serverFenceName = fenceInfo.getPolylineFence().getFenceName(); | ||
| 381 | - String currentFenceName = currentSelBean.getEventName(); | ||
| 382 | - if (serverFenceName.equals(currentFenceName)) { | ||
| 383 | - //添加围栏id | ||
| 384 | - fenceIdList.add(fenceInfo.getPolylineFence().getFenceId()); | ||
| 385 | - } | ||
| 386 | - } | ||
| 387 | - } | ||
| 388 | - | ||
| 389 | - } | ||
| 390 | - } | ||
| 391 | - //判断围栏是否查询到 | ||
| 392 | - if (null != fenceIdList && fenceIdList.size() > 0) { | ||
| 393 | - Log.e(TAG, "onFenceListCallback: 获取到围栏数量" + fenceIdList.size()); | ||
| 394 | - List<Long> finalFenceIdList = fenceIdList; | ||
| 395 | - new Handler().postDelayed(new Runnable() { | ||
| 396 | - @Override | ||
| 397 | - public void run() { | ||
| 398 | - QMUITipDialogUtil.dismessDialog(); | ||
| 399 | - //开始删除围栏 | ||
| 400 | - DeleteFenceRequest deleteFenceRequest = DeleteFenceRequest.buildServerRequest(Constant.TAG, Constant.SERVICE_ID, fragment.entityName, finalFenceIdList); | ||
| 401 | - if (null != mClient) { | ||
| 402 | - QMUITipDialogUtil.loadingDialog(fragment.getActivity(), "正在删除围栏", false); | ||
| 403 | - mClient.deleteFence(deleteFenceRequest, RaceNameListView.this); | ||
| 404 | - } | ||
| 405 | - } | ||
| 406 | - }, 1000); | ||
| 407 | - } else { | ||
| 408 | - //没有查询到围栏,直接添加 | ||
| 409 | - addFence(currentSelBean.getDarenId(), currentSelBean.getEventName(), importPoints); | ||
| 410 | - } | ||
| 411 | - } else { | ||
| 412 | - QMUITipDialogUtil.dismessDialog(); | ||
| 413 | - } | 385 | +// if (null == fenceListResponse) { |
| 386 | +// return; | ||
| 387 | +// } | ||
| 388 | +// List<Long> fenceIdList = null; | ||
| 389 | +// if (null != fenceListResponse.getFenceInfos()) { | ||
| 390 | +// fenceIdList = new ArrayList<>(); | ||
| 391 | +// for (FenceInfo fenceInfo : fenceListResponse.getFenceInfos()) { | ||
| 392 | +// //如果是线性围栏 | ||
| 393 | +// if (fenceInfo.getFenceShape() == FenceShape.polyline) { | ||
| 394 | +// //判断是否是当前围栏名称 | ||
| 395 | +// if (null != currentSelBean) { | ||
| 396 | +// if (!TextUtils.isEmpty(currentSelBean.getEventName())) { | ||
| 397 | +// String serverFenceName = fenceInfo.getPolylineFence().getFenceName(); | ||
| 398 | +// String currentFenceName = currentSelBean.getEventName(); | ||
| 399 | +// if (serverFenceName.equals(currentFenceName)) { | ||
| 400 | +// //添加围栏id | ||
| 401 | +// fenceIdList.add(fenceInfo.getPolylineFence().getFenceId()); | ||
| 402 | +// } | ||
| 403 | +// } | ||
| 404 | +// } | ||
| 405 | +// | ||
| 406 | +// } | ||
| 407 | +// } | ||
| 408 | +// //判断围栏是否查询到 | ||
| 409 | +// if (null != fenceIdList && fenceIdList.size() > 0) { | ||
| 410 | +// Log.e(TAG, "onFenceListCallback: 获取到围栏数量" + fenceIdList.size()); | ||
| 411 | +// List<Long> finalFenceIdList = fenceIdList; | ||
| 412 | +// new Handler().postDelayed(new Runnable() { | ||
| 413 | +// @Override | ||
| 414 | +// public void run() { | ||
| 415 | +// QMUITipDialogUtil.dismessDialog(); | ||
| 416 | +// //开始删除围栏 | ||
| 417 | +// DeleteFenceRequest deleteFenceRequest = DeleteFenceRequest.buildServerRequest(Constant.TAG, Constant.SERVICE_ID, fragment.entityName, finalFenceIdList); | ||
| 418 | +// if (null != mClient) { | ||
| 419 | +// QMUITipDialogUtil.loadingDialog(fragment.getActivity(), "正在删除围栏", false); | ||
| 420 | +// mClient.deleteFence(deleteFenceRequest, RaceNameListView.this); | ||
| 421 | +// } | ||
| 422 | +// } | ||
| 423 | +// }, 1000); | ||
| 424 | +// } else { | ||
| 425 | +// //没有查询到围栏,直接添加 | ||
| 426 | +// addFence(currentSelBean.getDarenId(), currentSelBean.getEventName(), importPoints); | ||
| 427 | +// } | ||
| 428 | +// } else { | ||
| 429 | +// QMUITipDialogUtil.dismessDialog(); | ||
| 430 | +// } | ||
| 414 | } | 431 | } |
| 415 | 432 | ||
| 416 | @Override | 433 | @Override |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/model/CheckShoeLineBean.java
0 → 100644
| 1 | +package com.cnlive.moudle.collectionTrace.model; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * 校验轨迹绑定 | ||
| 5 | + * | ||
| 6 | + * @author ShinnyYang | ||
| 7 | + */ | ||
| 8 | +public class CheckShoeLineBean { | ||
| 9 | + | ||
| 10 | + /** | ||
| 11 | + * fenceId : 174 | ||
| 12 | + * entityName : 10513196 | ||
| 13 | + */ | ||
| 14 | + | ||
| 15 | + private String fenceId; | ||
| 16 | + private String entityName; | ||
| 17 | + | ||
| 18 | + public String getFenceId() { | ||
| 19 | + return fenceId; | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + public void setFenceId(String fenceId) { | ||
| 23 | + this.fenceId = fenceId; | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + public String getEntityName() { | ||
| 27 | + return entityName; | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + public void setEntityName(String entityName) { | ||
| 31 | + this.entityName = entityName; | ||
| 32 | + } | ||
| 33 | +} |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/CollTraceListDetailActivity.java
| @@ -30,7 +30,7 @@ public class CollTraceListDetailActivity extends QMUIFragmentActivity { | @@ -30,7 +30,7 @@ public class CollTraceListDetailActivity extends QMUIFragmentActivity { | ||
| 30 | String fenceEntityName = getIntent().getExtras().getString("fenceEntityName"); | 30 | String fenceEntityName = getIntent().getExtras().getString("fenceEntityName"); |
| 31 | String position= getIntent().getExtras().getString("position"); | 31 | String position= getIntent().getExtras().getString("position"); |
| 32 | if (null != eventShoeLinesBean) { | 32 | if (null != eventShoeLinesBean) { |
| 33 | - addFragment(CollTraceListDetailFragment.newInstance(eventShoeLinesBean,fenceEntityName,position)); | 33 | + addFragment(CollTraceListDetailFragment.newInstance(eventShoeLinesBean,position)); |
| 34 | } | 34 | } |
| 35 | } | 35 | } |
| 36 | 36 | ||
| @@ -41,10 +41,9 @@ public class CollTraceListDetailActivity extends QMUIFragmentActivity { | @@ -41,10 +41,9 @@ public class CollTraceListDetailActivity extends QMUIFragmentActivity { | ||
| 41 | .commit(); | 41 | .commit(); |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | - public static void startActivity(Activity activity, RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean, String fenceEntityName,String position) { | 44 | + public static void startActivity(Activity activity, RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean, String position) { |
| 45 | Intent intent = new Intent(activity, CollTraceListDetailActivity.class); | 45 | Intent intent = new Intent(activity, CollTraceListDetailActivity.class); |
| 46 | intent.putExtra("eventShoeLinesBean", eventShoeLinesBean); | 46 | intent.putExtra("eventShoeLinesBean", eventShoeLinesBean); |
| 47 | - intent.putExtra("fenceEntityName", fenceEntityName); | ||
| 48 | intent.putExtra("position", position); | 47 | intent.putExtra("position", position); |
| 49 | activity.startActivity(intent); | 48 | activity.startActivity(intent); |
| 50 | } | 49 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/fragment/CollTraceListDetailFragment.java
| @@ -22,11 +22,10 @@ public class CollTraceListDetailFragment extends QMUIFragment<CollTraceListDetai | @@ -22,11 +22,10 @@ public class CollTraceListDetailFragment extends QMUIFragment<CollTraceListDetai | ||
| 22 | private RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean; | 22 | private RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean; |
| 23 | private String position; | 23 | private String position; |
| 24 | 24 | ||
| 25 | - public static CollTraceListDetailFragment newInstance(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean, String fenceEntityName, String position) { | 25 | + public static CollTraceListDetailFragment newInstance(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean, String position) { |
| 26 | CollTraceListDetailFragment fragment = new CollTraceListDetailFragment(); | 26 | CollTraceListDetailFragment fragment = new CollTraceListDetailFragment(); |
| 27 | Bundle bundle = new Bundle(); | 27 | Bundle bundle = new Bundle(); |
| 28 | bundle.putSerializable("eventShoeLinesBean", eventShoeLinesBean); | 28 | bundle.putSerializable("eventShoeLinesBean", eventShoeLinesBean); |
| 29 | - bundle.putString("fenceEntityName", fenceEntityName); | ||
| 30 | bundle.putString("position", position); | 29 | bundle.putString("position", position); |
| 31 | fragment.setArguments(bundle); | 30 | fragment.setArguments(bundle); |
| 32 | return fragment; | 31 | return fragment; |
| @@ -58,8 +57,13 @@ public class CollTraceListDetailFragment extends QMUIFragment<CollTraceListDetai | @@ -58,8 +57,13 @@ public class CollTraceListDetailFragment extends QMUIFragment<CollTraceListDetai | ||
| 58 | position = getArguments().getString("position"); | 57 | position = getArguments().getString("position"); |
| 59 | if (null != eventShoeLinesBean) { | 58 | if (null != eventShoeLinesBean) { |
| 60 | if (null != getMvpView()) { | 59 | if (null != getMvpView()) { |
| 61 | - getMvpView().initMap(); | ||
| 62 | - getMvpView().initView(eventShoeLinesBean, fenceEntityName, position); | 60 | + getMvpView().initMap(new CollTraceListDetailFragmentView.CallBack() { |
| 61 | + @Override | ||
| 62 | + public void onMapLoadSuccess() { | ||
| 63 | + getMvpView().initView(eventShoeLinesBean, position); | ||
| 64 | + } | ||
| 65 | + }); | ||
| 66 | + | ||
| 63 | } | 67 | } |
| 64 | } | 68 | } |
| 65 | } | 69 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/fragment/RaceNameListFragment.java
| @@ -22,7 +22,6 @@ public class RaceNameListFragment extends MvpBindingFragment<RaceNameListView, R | @@ -22,7 +22,6 @@ public class RaceNameListFragment extends MvpBindingFragment<RaceNameListView, R | ||
| 22 | public int pageSize = 10; | 22 | public int pageSize = 10; |
| 23 | public String eventId; | 23 | public String eventId; |
| 24 | private RunRaceDetailInfo runRaceDetailInfo; | 24 | private RunRaceDetailInfo runRaceDetailInfo; |
| 25 | - public String entityName = null; | ||
| 26 | 25 | ||
| 27 | public static RaceNameListFragment newInstance(String eventId, RunRaceDetailInfo runRaceDetailInfo) { | 26 | public static RaceNameListFragment newInstance(String eventId, RunRaceDetailInfo runRaceDetailInfo) { |
| 28 | RaceNameListFragment fragment = new RaceNameListFragment(); | 27 | RaceNameListFragment fragment = new RaceNameListFragment(); |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunRaceDetailFragmentView.java
| @@ -356,7 +356,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -356,7 +356,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 356 | fragment.binding.includeStreet.tvAddress.setText(runRaceDetailInfo.getAddress()); | 356 | fragment.binding.includeStreet.tvAddress.setText(runRaceDetailInfo.getAddress()); |
| 357 | //设置活动距离 | 357 | //设置活动距离 |
| 358 | if (!TextUtils.isEmpty(runRaceDetailInfo.getMileage())) { | 358 | if (!TextUtils.isEmpty(runRaceDetailInfo.getMileage())) { |
| 359 | - fragment.binding.includeStreet.tvAddress.append("\t\t" + runRaceDetailInfo.getMileage()); | 359 | + fragment.binding.includeStreet.tvAddress.append("\t\t全长" + runRaceDetailInfo.getMileage()+"公里"); |
| 360 | } | 360 | } |
| 361 | } | 361 | } |
| 362 | 362 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/net/ApiServiceRunLin.java
| @@ -2,6 +2,7 @@ package com.cnlive.moudle.pedometer.net; | @@ -2,6 +2,7 @@ package com.cnlive.moudle.pedometer.net; | ||
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | import com.cnlive.moudle.collectionTrace.model.BindingShoeInfo; | 4 | import com.cnlive.moudle.collectionTrace.model.BindingShoeInfo; |
| 5 | +import com.cnlive.moudle.collectionTrace.model.CheckShoeLineBean; | ||
| 5 | import com.cnlive.moudle.collectionTrace.model.RaceNameListInfo; | 6 | import com.cnlive.moudle.collectionTrace.model.RaceNameListInfo; |
| 6 | import com.cnlive.moudle.pedometer.net.bean.BaseInfo; | 7 | import com.cnlive.moudle.pedometer.net.bean.BaseInfo; |
| 7 | import com.cnlive.moudle.pedometer.net.bean.MyRecordInfo; | 8 | import com.cnlive.moudle.pedometer.net.bean.MyRecordInfo; |
| @@ -100,5 +101,15 @@ public interface ApiServiceRunLin { | @@ -100,5 +101,15 @@ public interface ApiServiceRunLin { | ||
| 100 | */ | 101 | */ |
| 101 | @POST("Daren/event/saveShoeLine.action") | 102 | @POST("Daren/event/saveShoeLine.action") |
| 102 | Observable<Result<BaseInfo>> collSaveShoeLine(@QueryMap() Map<String, String> maps); | 103 | Observable<Result<BaseInfo>> collSaveShoeLine(@QueryMap() Map<String, String> maps); |
| 104 | + | ||
| 105 | + /** | ||
| 106 | + * 校验轨迹绑定 | ||
| 107 | + * http://bj.gitlab.cnlive.com/cnlive/BOSS-Wiki/wikis/checkShoeLine | ||
| 108 | + * | ||
| 109 | + * @param maps | ||
| 110 | + * @return | ||
| 111 | + */ | ||
| 112 | + @POST("Daren/event/checkShoeLine.action") | ||
| 113 | + Observable<Result<BaseInfo<CheckShoeLineBean>>> checkShoeLine(@QueryMap() Map<String, String> maps); | ||
| 103 | } | 114 | } |
| 104 | 115 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/MyMapUtil.java
| @@ -177,6 +177,9 @@ public class MyMapUtil { | @@ -177,6 +177,9 @@ public class MyMapUtil { | ||
| 177 | LatLngBounds.Builder builder = new LatLngBounds.Builder(); | 177 | LatLngBounds.Builder builder = new LatLngBounds.Builder(); |
| 178 | List<LatLng> latLngs = new ArrayList<>(); | 178 | List<LatLng> latLngs = new ArrayList<>(); |
| 179 | for (int i = 0; i < trackPoints.size(); i++) { | 179 | for (int i = 0; i < trackPoints.size(); i++) { |
| 180 | + if (0 == trackPoints.get(i).getLatitude() && 0 == trackPoints.get(i).getLongitude()) { | ||
| 181 | + continue; | ||
| 182 | + } | ||
| 180 | latLngs.add(new LatLng(trackPoints.get(i).getLatitude(), trackPoints.get(i).getLongitude())); | 183 | latLngs.add(new LatLng(trackPoints.get(i).getLatitude(), trackPoints.get(i).getLongitude())); |
| 181 | } | 184 | } |
| 182 | for (LatLng latLng : latLngs) { | 185 | for (LatLng latLng : latLngs) { |
moudle_pedometer/src/main/res/layout/layout_run_detail_street.xml
| @@ -79,6 +79,7 @@ | @@ -79,6 +79,7 @@ | ||
| 79 | android:layout_width="wrap_content" | 79 | android:layout_width="wrap_content" |
| 80 | android:layout_height="wrap_content" | 80 | android:layout_height="wrap_content" |
| 81 | android:layout_marginLeft="25dp" | 81 | android:layout_marginLeft="25dp" |
| 82 | + android:layout_marginRight="25dp" | ||
| 82 | android:text="--" | 83 | android:text="--" |
| 83 | android:textColor="@color/text_black" | 84 | android:textColor="@color/text_black" |
| 84 | android:textSize="15sp" /> | 85 | android:textSize="15sp" /> |