Commit ac37058e7749a3cb0ed4145fb1ca78aeae9b0730
我的记录接口更新w
Showing
44 changed files
with
1059 additions
and
487 deletions
.idea/gradle.xml
| ... | ... | @@ -3,6 +3,9 @@ |
| 3 | 3 | <component name="GradleSettings"> |
| 4 | 4 | <option name="linkedExternalProjectsSettings"> |
| 5 | 5 | <GradleProjectSettings> |
| 6 | + <compositeConfiguration> | |
| 7 | + <compositeBuild compositeDefinitionSource="SCRIPT" /> | |
| 8 | + </compositeConfiguration> | |
| 6 | 9 | <option name="distributionType" value="DEFAULT_WRAPPED" /> |
| 7 | 10 | <option name="externalProjectPath" value="$PROJECT_DIR$" /> |
| 8 | 11 | <option name="modules"> | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollRunRaceDetailFragmentView.java
| ... | ... | @@ -47,6 +47,7 @@ import com.cnlive.moudle.collectionTrace.service.CollKeepLiveService; |
| 47 | 47 | import com.cnlive.moudle.collectionTrace.ui.activity.StartCollectTraceActivity; |
| 48 | 48 | import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunRaceDetailFragment; |
| 49 | 49 | import com.cnlive.moudle.pedometer.commonInfo.CollCommonInfo; |
| 50 | +import com.cnlive.moudle.pedometer.model.Constant; | |
| 50 | 51 | import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; |
| 51 | 52 | import com.cnlive.moudle.pedometer.utils.BitmapUtil; |
| 52 | 53 | import com.cnlive.moudle.pedometer.utils.GsonUtil; |
| ... | ... | @@ -559,12 +560,12 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen |
| 559 | 560 | } |
| 560 | 561 | if (isFirstLoc) { |
| 561 | 562 | isFirstLoc = false; |
| 562 | - if (location.getRadius() > 20) { | |
| 563 | + if (location.getRadius() > Constant.LOCA_ACCURACY) { | |
| 563 | 564 | Toast.makeText(getContext(), "当前定位精度为:" + location.getRadius() + "米,请您移动至空旷地带!", Toast.LENGTH_SHORT).show(); |
| 564 | 565 | } |
| 565 | 566 | } else { |
| 566 | 567 | //过滤定位精度 |
| 567 | - if (location.getRadius() > 20) { | |
| 568 | + if (location.getRadius() > Constant.LOCA_ACCURACY) { | |
| 568 | 569 | return; |
| 569 | 570 | } |
| 570 | 571 | } | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollRunningMapFragmentView.java
| ... | ... | @@ -34,6 +34,7 @@ import com.baidu.mapapi.model.LatLng; |
| 34 | 34 | import com.baidu.mapapi.utils.DistanceUtil; |
| 35 | 35 | import com.baidu.trace.model.SortType; |
| 36 | 36 | import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunningMapFragment; |
| 37 | +import com.cnlive.moudle.pedometer.model.Constant; | |
| 37 | 38 | import com.cnlive.moudle.pedometer.model.RunningMapBean; |
| 38 | 39 | import com.cnlive.moudle.pedometer.ui.fragment.RunningMapFragment; |
| 39 | 40 | import com.cnlive.moudle.pedometer.utils.BitmapUtil; |
| ... | ... | @@ -298,14 +299,14 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener |
| 298 | 299 | |
| 299 | 300 | if (isFirstLoc) { |
| 300 | 301 | isFirstLoc = false; |
| 301 | - if (location.getRadius() > 20) { | |
| 302 | + if (location.getRadius() > Constant.LOCA_ACCURACY) { | |
| 302 | 303 | Toast.makeText(getContext(), "当前定位精度为:" + location.getRadius() + "米,请您移动至空旷地带!", Toast.LENGTH_SHORT).show(); |
| 303 | 304 | } |
| 304 | 305 | |
| 305 | 306 | |
| 306 | 307 | } else { |
| 307 | 308 | //过滤定位精度 |
| 308 | - if (location.getRadius() > 20) { | |
| 309 | + if (location.getRadius() > Constant.LOCA_ACCURACY) { | |
| 309 | 310 | return; |
| 310 | 311 | } |
| 311 | 312 | } | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/StartTraceFragmentView.java
| ... | ... | @@ -34,6 +34,7 @@ import com.cnlive.moudle.collectionTrace.ui.activity.CollRunRaceDetailActivity; |
| 34 | 34 | import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunRaceDetailFragment; |
| 35 | 35 | import com.cnlive.moudle.collectionTrace.ui.fragment.StartTraceFragment; |
| 36 | 36 | import com.cnlive.moudle.pedometer.commonInfo.CollCommonInfo; |
| 37 | +import com.cnlive.moudle.pedometer.model.Constant; | |
| 37 | 38 | import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; |
| 38 | 39 | import com.cnlive.moudle.pedometer.ui.widget.TipDialog; |
| 39 | 40 | import com.cnlive.moudle.pedometer.utils.BitmapUtil; |
| ... | ... | @@ -254,12 +255,12 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { |
| 254 | 255 | } |
| 255 | 256 | if (isFirstLoc) { |
| 256 | 257 | isFirstLoc = false; |
| 257 | - if (location.getRadius() > 20) { | |
| 258 | + if (location.getRadius() > Constant.LOCA_ACCURACY) { | |
| 258 | 259 | Toast.makeText(getContext(), "当前定位精度为:" + location.getRadius() + "米,请您移动至空旷地带!", Toast.LENGTH_SHORT).show(); |
| 259 | 260 | } |
| 260 | 261 | } else { |
| 261 | 262 | //过滤定位精度 |
| 262 | - if (location.getRadius() > 20) { | |
| 263 | + if (location.getRadius() > Constant.LOCA_ACCURACY) { | |
| 263 | 264 | return; |
| 264 | 265 | } |
| 265 | 266 | } | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/commonInfo/CommonInfo.java
| ... | ... | @@ -279,11 +279,27 @@ public class CommonInfo { |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | |
| 282 | - | |
| 283 | - | |
| 284 | - | |
| 285 | - | |
| 286 | - | |
| 282 | +// /** | |
| 283 | +// * 设置起点经纬度 | |
| 284 | +// * | |
| 285 | +// * @param context | |
| 286 | +// * @param startLatLng | |
| 287 | +// */ | |
| 288 | +// public static void setStartLatLng(Context context, String startLatLng) { | |
| 289 | +// MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).putString("runStartLatLng", startLatLng); | |
| 290 | +// | |
| 291 | +// } | |
| 292 | +// | |
| 293 | +// /** | |
| 294 | +// * 设置终点经纬度 | |
| 295 | +// * | |
| 296 | +// * @param context | |
| 297 | +// * @param endLatLng | |
| 298 | +// */ | |
| 299 | +// public static void setEndLatLng(Context context, String endLatLng) { | |
| 300 | +// MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).putString("runEndLatLng", endLatLng); | |
| 301 | +// | |
| 302 | +// } | |
| 287 | 303 | /*重置 |
| 288 | 304 | * @param context |
| 289 | 305 | */ | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/ALLScoreDetailFragmentPresenter.java
| ... | ... | @@ -38,8 +38,18 @@ public class ALLScoreDetailFragmentPresenter extends MvpBasePresenter<ALLScoreDe |
| 38 | 38 | } |
| 39 | 39 | //获取当前的时间戳(秒) |
| 40 | 40 | long endTime = 0; |
| 41 | - if (!TextUtils.isEmpty(runningFinishBean.getUserFinishTime())){ | |
| 42 | - endTime = Long.parseLong(runningFinishBean.getUserFinishTime()); | |
| 41 | + //判断当期那用户是否暂停 | |
| 42 | + if (runningFinishBean.isPause()) { | |
| 43 | + //用户暂停了 | |
| 44 | + if (!TextUtils.isEmpty(runningFinishBean.getUserPauseTime())) { | |
| 45 | + endTime = Long.parseLong(runningFinishBean.getUserPauseTime()); | |
| 46 | + } | |
| 47 | + } | |
| 48 | + //没有暂停 | |
| 49 | + else { | |
| 50 | + if (!TextUtils.isEmpty(runningFinishBean.getUserFinishTime())) { | |
| 51 | + endTime = Long.parseLong(runningFinishBean.getUserFinishTime()); | |
| 52 | + } | |
| 43 | 53 | } |
| 44 | 54 | //获取当前的实体名称 |
| 45 | 55 | String entityName = CommonInfo.getUserId(context); |
| ... | ... | @@ -53,9 +63,16 @@ public class ALLScoreDetailFragmentPresenter extends MvpBasePresenter<ALLScoreDe |
| 53 | 63 | if (getView() != null) { |
| 54 | 64 | QMUITipDialogUtil.dismessDialog(); |
| 55 | 65 | if (resultPoints.size() > 1) { |
| 56 | - MyMapUtil.drawHistoryTrack(context, getView().baiduMap, resultPoints, SortType.asc, R.color.red, R.drawable.icon_start, R.drawable.icon_end); | |
| 57 | - //设置地图自动缩放 | |
| 58 | - MyMapUtil.setMapAutoZoom(getView().baiduMap, resultPoints, -2f); | |
| 66 | + //用户暂停了 | |
| 67 | + if (runningFinishBean.isPause()) { | |
| 68 | + MyMapUtil.drawHistoryTrack(context, getView().baiduMap, resultPoints, SortType.asc, R.color.red, R.drawable.icon_start, 0); | |
| 69 | + } | |
| 70 | + //用户没有暂停 | |
| 71 | + else { | |
| 72 | + MyMapUtil.drawHistoryTrack(context, getView().baiduMap, resultPoints, SortType.asc, R.color.red, R.drawable.icon_start, R.drawable.icon_end); | |
| 73 | + //设置地图自动缩放 | |
| 74 | + MyMapUtil.setMapAutoZoom(getView().baiduMap, resultPoints, -2f); | |
| 75 | + } | |
| 59 | 76 | } |
| 60 | 77 | |
| 61 | 78 | } | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/LineUpAgainPresenter.java
| ... | ... | @@ -47,7 +47,7 @@ public class LineUpAgainPresenter extends MvpBasePresenter<LineUpAgainView> { |
| 47 | 47 | /** |
| 48 | 48 | * 查询当前用户历史轨迹(用于重新上传按钮) |
| 49 | 49 | */ |
| 50 | - public void queryHistoryTraceNoMap(Activity context, FailedEntity failedEntity,onResultListener onResultListener) { | |
| 50 | + public void queryHistoryTraceNoMap(Activity context, FailedEntity failedEntity, onResultListener onResultListener) { | |
| 51 | 51 | QMUITipDialogUtil.loadingDialog(context, "正在获取轨迹信息,请稍后", false); |
| 52 | 52 | //查询当前用户的历史轨迹 |
| 53 | 53 | long startTime = failedEntity.getUserStartTime(); |
| ... | ... | @@ -63,58 +63,67 @@ public class LineUpAgainPresenter extends MvpBasePresenter<LineUpAgainView> { |
| 63 | 63 | if (mClient == null) { |
| 64 | 64 | mClient = new LBSTraceClient(context); |
| 65 | 65 | } |
| 66 | - MyMapUtil.queryHistoryTrace(context, mClient, entityName, startTime, endTime, new MyMapUtil.CallBack() { | |
| 67 | - @Override | |
| 68 | - public void success(List<LatLng> resultPoints) { | |
| 69 | - if (resultPoints != null) { | |
| 70 | - if (getView() != null) { | |
| 71 | - QMUITipDialogUtil.dismessDialog(); | |
| 72 | - if (importPoints != null) { | |
| 73 | - //判断是否完成 | |
| 74 | - boolean isFinish = MyMapUtil.checkIsFinishTrace(importPoints, resultPoints, Constant.PASS_RATE); | |
| 75 | - if (isFinish) { | |
| 76 | - Toast.makeText(context, "完成", Toast.LENGTH_LONG).show(); | |
| 77 | - failedEntity.setIsFinish("1"); | |
| 78 | - } else { | |
| 79 | - Toast.makeText(context, "没有完成", Toast.LENGTH_LONG).show(); | |
| 80 | - failedEntity.setIsFinish("0"); | |
| 66 | + //先判断用户是否到达终点 | |
| 67 | + if (!failedEntity.getIsArriveEndPoint()) { | |
| 68 | + //没有到达终点,默认没有完成 | |
| 69 | + failedEntity.setIsFinish("0"); | |
| 70 | + //直接上传数据 | |
| 71 | + saveRouteData(context, failedEntity, onResultListener); | |
| 72 | + } | |
| 73 | + //达到终点,则与运营打的点进行比较 | |
| 74 | + else { | |
| 75 | + MyMapUtil.queryHistoryTrace(context, mClient, entityName, startTime, endTime, new MyMapUtil.CallBack() { | |
| 76 | + @Override | |
| 77 | + public void success(List<LatLng> resultPoints) { | |
| 78 | + if (resultPoints != null) { | |
| 79 | + if (getView() != null) { | |
| 80 | + QMUITipDialogUtil.dismessDialog(); | |
| 81 | + if (importPoints != null) { | |
| 82 | + //判断是否完成 | |
| 83 | + boolean isFinish = MyMapUtil.checkIsFinishTrace(importPoints, resultPoints, Constant.PASS_RATE); | |
| 84 | + if (isFinish) { | |
| 85 | + Toast.makeText(context, "完成", Toast.LENGTH_LONG).show(); | |
| 86 | + failedEntity.setIsFinish("1"); | |
| 87 | + } else { | |
| 88 | + Toast.makeText(context, "没有完成", Toast.LENGTH_LONG).show(); | |
| 89 | + failedEntity.setIsFinish("0"); | |
| 90 | + } | |
| 91 | + saveRouteData(context, failedEntity, onResultListener); | |
| 81 | 92 | } |
| 82 | - saveRouteData(context, failedEntity,onResultListener); | |
| 83 | 93 | } |
| 84 | 94 | } |
| 85 | - } | |
| 86 | - //查询失败 | |
| 87 | - else { | |
| 88 | - QMUITipDialogUtil.dismessDialog(); | |
| 89 | - if (failTraceDialog == null) { | |
| 90 | - failTraceDialog = new SelectDialog(context, "获取轨迹失败,是否重试?", "重试", new SelectDialog.DialogInterface() { | |
| 91 | - @Override | |
| 92 | - public void onClick(SelectDialog dialog) { | |
| 93 | - dialog.dismiss(); | |
| 94 | - queryHistoryTraceNoMap(context, failedEntity,onResultListener); | |
| 95 | - } | |
| 96 | - }, "取消", new SelectDialog.DialogInterface() { | |
| 97 | - @Override | |
| 98 | - public void onClick(SelectDialog dialog) { | |
| 99 | - dialog.dismiss(); | |
| 95 | + //查询失败 | |
| 96 | + else { | |
| 97 | + QMUITipDialogUtil.dismessDialog(); | |
| 98 | + if (failTraceDialog == null) { | |
| 99 | + failTraceDialog = new SelectDialog(context, "获取轨迹失败,是否重试?", "重试", new SelectDialog.DialogInterface() { | |
| 100 | + @Override | |
| 101 | + public void onClick(SelectDialog dialog) { | |
| 102 | + dialog.dismiss(); | |
| 103 | + queryHistoryTraceNoMap(context, failedEntity, onResultListener); | |
| 104 | + } | |
| 105 | + }, "取消", new SelectDialog.DialogInterface() { | |
| 106 | + @Override | |
| 107 | + public void onClick(SelectDialog dialog) { | |
| 108 | + dialog.dismiss(); | |
| 100 | 109 | |
| 110 | + } | |
| 111 | + }); | |
| 112 | + failTraceDialog.setCanceledOnTouchOutside(false); | |
| 113 | + failTraceDialog.setCancelable(false); | |
| 114 | + if (!failTraceDialog.isShowing()) { | |
| 115 | + failTraceDialog.show(); | |
| 101 | 116 | } |
| 102 | - }); | |
| 103 | - failTraceDialog.setCanceledOnTouchOutside(false); | |
| 104 | - failTraceDialog.setCancelable(false); | |
| 105 | - if (!failTraceDialog.isShowing()) { | |
| 106 | - failTraceDialog.show(); | |
| 107 | - } | |
| 108 | 117 | |
| 109 | - } else { | |
| 110 | - if (!failTraceDialog.isShowing()) { | |
| 111 | - failTraceDialog.show(); | |
| 118 | + } else { | |
| 119 | + if (!failTraceDialog.isShowing()) { | |
| 120 | + failTraceDialog.show(); | |
| 121 | + } | |
| 112 | 122 | } |
| 113 | 123 | } |
| 114 | 124 | } |
| 115 | - } | |
| 116 | - }); | |
| 117 | - | |
| 125 | + }); | |
| 126 | + } | |
| 118 | 127 | } |
| 119 | 128 | |
| 120 | 129 | /** |
| ... | ... | @@ -123,7 +132,7 @@ public class LineUpAgainPresenter extends MvpBasePresenter<LineUpAgainView> { |
| 123 | 132 | * @param context |
| 124 | 133 | * @param failedEntity |
| 125 | 134 | */ |
| 126 | - public void saveRouteData(Activity context, FailedEntity failedEntity,onResultListener onResultListener) { | |
| 135 | + public void saveRouteData(Activity context, FailedEntity failedEntity, onResultListener onResultListener) { | |
| 127 | 136 | QMUITipDialogUtil.loadingDialog(context, "正在上传数据", false); |
| 128 | 137 | // 赛事id |
| 129 | 138 | String eventId = failedEntity.getStreetId(); |
| ... | ... | @@ -194,7 +203,7 @@ public class LineUpAgainPresenter extends MvpBasePresenter<LineUpAgainView> { |
| 194 | 203 | if (getView() == null) { |
| 195 | 204 | return; |
| 196 | 205 | } |
| 197 | - if (onResultListener!=null){ | |
| 206 | + if (onResultListener != null) { | |
| 198 | 207 | onResultListener.onFailed(message); |
| 199 | 208 | } |
| 200 | 209 | Log.e("saveRouteData", "onFailure: " + message); |
| ... | ... | @@ -204,7 +213,7 @@ public class LineUpAgainPresenter extends MvpBasePresenter<LineUpAgainView> { |
| 204 | 213 | @Override |
| 205 | 214 | public void onClick(SelectDialog dialog) { |
| 206 | 215 | dialog.dismiss(); |
| 207 | - saveRouteData(context, failedEntity,onResultListener); | |
| 216 | + saveRouteData(context, failedEntity, onResultListener); | |
| 208 | 217 | } |
| 209 | 218 | }, "取消", new SelectDialog.DialogInterface() { |
| 210 | 219 | @Override |
| ... | ... | @@ -238,7 +247,7 @@ public class LineUpAgainPresenter extends MvpBasePresenter<LineUpAgainView> { |
| 238 | 247 | //删除 |
| 239 | 248 | StepUtil.deleteTempSaveFailData(context, entity); |
| 240 | 249 | } |
| 241 | - if (onResultListener!=null){ | |
| 250 | + if (onResultListener != null) { | |
| 242 | 251 | onResultListener.onSuccess(); |
| 243 | 252 | } |
| 244 | 253 | } | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/RunningFinishFragmetPresenter.java
| ... | ... | @@ -219,19 +219,25 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter<RunningFinis |
| 219 | 219 | if (resultPoints != null) { |
| 220 | 220 | if (getView() != null) { |
| 221 | 221 | QMUITipDialogUtil.dismessDialog(); |
| 222 | - if (importPoints != null) { | |
| 223 | - //判断是否完成 | |
| 224 | - boolean isFinish = MyMapUtil.checkIsFinishTrace(importPoints, resultPoints, Constant.PASS_RATE); | |
| 225 | - if (isFinish) { | |
| 226 | - Toast.makeText(context, "完成", Toast.LENGTH_LONG).show(); | |
| 227 | - runningFinishBean.setIsFinish("1"); | |
| 228 | - } else { | |
| 229 | - Toast.makeText(context, "没有完成", Toast.LENGTH_LONG).show(); | |
| 230 | - runningFinishBean.setIsFinish("0"); | |
| 222 | + MyMapUtil.drawHistoryTrack(context, getView().baiduMap, resultPoints, SortType.asc, R.color.red, R.drawable.icon_start, R.drawable.icon_end); | |
| 223 | + //先判断是否到达终点 | |
| 224 | + if (!userStepEntity.getIsArriveEndPoint()) { | |
| 225 | + runningFinishBean.setIsFinish("0"); | |
| 226 | + } else { | |
| 227 | + if (importPoints != null) { | |
| 228 | + //判断是否完成 | |
| 229 | + boolean isFinish = MyMapUtil.checkIsFinishTrace(importPoints, resultPoints, Constant.PASS_RATE); | |
| 230 | + if (isFinish) { | |
| 231 | + Toast.makeText(context, "完成", Toast.LENGTH_LONG).show(); | |
| 232 | + runningFinishBean.setIsFinish("1"); | |
| 233 | + } else { | |
| 234 | + Toast.makeText(context, "没有完成", Toast.LENGTH_LONG).show(); | |
| 235 | + runningFinishBean.setIsFinish("0"); | |
| 236 | + } | |
| 231 | 237 | } |
| 232 | - MyMapUtil.drawHistoryTrack(context, getView().baiduMap, resultPoints, SortType.asc, R.color.red, R.drawable.icon_start, R.drawable.icon_end); | |
| 233 | - saveRouteData(context, userStepEntity, runningFinishBean); | |
| 234 | 238 | } |
| 239 | + saveRouteData(context, userStepEntity, runningFinishBean); | |
| 240 | + | |
| 235 | 241 | } |
| 236 | 242 | } |
| 237 | 243 | //查询失败 | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/RunningMapFragmentPresenter.java
| ... | ... | @@ -342,11 +342,18 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag |
| 342 | 342 | /** |
| 343 | 343 | * 查询当前用户历史轨迹 |
| 344 | 344 | */ |
| 345 | - public void queryHistoryTrace(Context context, UserStepEntity userStepEntity) { | |
| 345 | + public void queryHistoryTrace(Context context, UserStepEntity userStepEntity, boolean isPause) { | |
| 346 | 346 | //查询当前用户的历史轨迹 |
| 347 | 347 | long startTime = userStepEntity.getStartTimeStamp(); |
| 348 | 348 | //获取当前的时间戳(秒) |
| 349 | - long endTime = TimeUtil.getNowTimeStamp(); | |
| 349 | + long endTime = 0; | |
| 350 | + //如果没有暂停 | |
| 351 | + if (!isPause) { | |
| 352 | + endTime = TimeUtil.getNowTimeStamp(); | |
| 353 | + } else { | |
| 354 | + endTime = userStepEntity.getUserPauseTimeStamp(); | |
| 355 | + } | |
| 356 | + Log.e(TAG, "startTime: " + startTime + ",endTime:" + endTime); | |
| 350 | 357 | //获取当前的实体名称 |
| 351 | 358 | String entityName = CommonInfo.getUserId(context); |
| 352 | 359 | //打的重要点 |
| ... | ... | @@ -356,10 +363,12 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag |
| 356 | 363 | public void success(List<LatLng> resultPoints) { |
| 357 | 364 | if (resultPoints != null && resultPoints.size() > 1) { |
| 358 | 365 | if (getView() != null && resultPoints != null) { |
| 359 | - if (resultPoints.size() == 1) { | |
| 360 | - getView().setHistoryLastPoint(resultPoints.get(0)); | |
| 361 | - } else if (resultPoints.size() > 1) { | |
| 362 | - getView().setHistoryLastPoint(resultPoints.get(resultPoints.size() - 1)); | |
| 366 | + if (!isPause) { | |
| 367 | + if (resultPoints.size() == 1) { | |
| 368 | + getView().setHistoryLastPoint(resultPoints.get(0)); | |
| 369 | + } else if (resultPoints.size() > 1) { | |
| 370 | + getView().setHistoryLastPoint(resultPoints.get(resultPoints.size() - 1)); | |
| 371 | + } | |
| 363 | 372 | } |
| 364 | 373 | if (importPoints != null && resultPoints != null) { |
| 365 | 374 | boolean isFinish = MyMapUtil.checkIsFinishTrace(importPoints, resultPoints, 0.6); |
| ... | ... | @@ -370,13 +379,44 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag |
| 370 | 379 | Toast.makeText(context, "没有完成", Toast.LENGTH_LONG).show(); |
| 371 | 380 | |
| 372 | 381 | } |
| 373 | - MyMapUtil.drawRealTimeTrack(context, getView().baiduMap, resultPoints, SortType.asc, R.color.red, R.drawable.icon_start); | |
| 382 | + if (isPause) { | |
| 383 | + MyMapUtil.drawRealTimeTrack(context, getView().baiduMap, resultPoints, SortType.asc, R.color.red, R.drawable.icon_start); | |
| 384 | + } else { | |
| 385 | + MyMapUtil.drawHistoryTrack(context, getView().baiduMap, resultPoints, SortType.asc, R.color.red, R.drawable.icon_start, R.drawable.icon_end); | |
| 386 | + } | |
| 374 | 387 | } |
| 375 | 388 | } |
| 376 | 389 | } |
| 377 | 390 | } |
| 378 | 391 | }); |
| 379 | 392 | |
| 393 | + //然后查询从暂停到现在的距离 | |
| 394 | + if (isPause) { | |
| 395 | + long continueTime = userStepEntity.getContinueTime(); | |
| 396 | + long continueEndTime = TimeUtil.getNowTimeStamp(); | |
| 397 | + Log.e(TAG, "continueTime: " + continueTime + ",continueEndTime:" + continueEndTime); | |
| 398 | + MyMapUtil.queryHistoryTrace(context, StepService.mClient, entityName, continueTime, continueEndTime, new MyMapUtil.CallBack() { | |
| 399 | + @Override | |
| 400 | + public void success(List<LatLng> resultPoints) { | |
| 401 | + if (resultPoints != null && resultPoints.size() > 1) { | |
| 402 | + if (resultPoints.size() == 1) { | |
| 403 | + if (null != resultPoints.get(0)) { | |
| 404 | + getView().setHistoryLastPoint(resultPoints.get(0)); | |
| 405 | + } | |
| 406 | + } else if (resultPoints.size() > 1) { | |
| 407 | + if (null != resultPoints.get(resultPoints.size() - 1)) { | |
| 408 | + getView().setHistoryLastPoint(resultPoints.get(resultPoints.size() - 1)); | |
| 409 | + } | |
| 410 | + } | |
| 411 | + //开始划线 | |
| 412 | + MyMapUtil.drawHistoryTrack(context, getView().baiduMap, resultPoints, SortType.asc, R.color.red, 0, R.drawable.icon_end); | |
| 413 | + | |
| 414 | + } | |
| 415 | + } | |
| 416 | + }); | |
| 417 | + | |
| 418 | + } | |
| 419 | + | |
| 380 | 420 | } |
| 381 | 421 | |
| 382 | 422 | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/UploadFailDetailFragmentPresenter.java
| ... | ... | @@ -42,16 +42,33 @@ public class UploadFailDetailFragmentPresenter extends MvpBasePresenter<UploadFa |
| 42 | 42 | private List<LatLng> importPoints; |
| 43 | 43 | private SelectDialog uploadFailDialog; |
| 44 | 44 | private SelectDialog failTraceDialog; |
| 45 | + private List<LatLng> allResultPoints; | |
| 46 | + | |
| 47 | +// //判断是否到达终点 | |
| 48 | +// if (!failedEntity.getIsArriveEndPoint()) { | |
| 49 | +// //没有完成 | |
| 50 | +// failedEntity.setIsFinish("0"); | |
| 51 | +// getView().updateIsFinish("0"); | |
| 52 | +// } | |
| 45 | 53 | |
| 46 | 54 | /** |
| 47 | 55 | * 查询当前用户历史轨迹 |
| 48 | 56 | */ |
| 49 | 57 | public void queryHistoryTrace(Activity context, FailedEntity failedEntity) { |
| 50 | 58 | QMUITipDialogUtil.loadingDialog(context, "正在获取轨迹信息,请稍后", false); |
| 59 | + | |
| 51 | 60 | //查询当前用户的历史轨迹 |
| 52 | 61 | long startTime = failedEntity.getUserStartTime(); |
| 53 | 62 | //获取当前的时间戳(秒) |
| 54 | - long endTime = failedEntity.getUserEndTime(); | |
| 63 | + long endTime = 0; | |
| 64 | + //没有暂停 | |
| 65 | + if (!failedEntity.getIsPause()) { | |
| 66 | + endTime = failedEntity.getUserEndTime(); | |
| 67 | + } | |
| 68 | + //用户暂停了 | |
| 69 | + else { | |
| 70 | + endTime = failedEntity.getUserPauseTime(); | |
| 71 | + } | |
| 55 | 72 | //获取当前的实体名称 |
| 56 | 73 | String entityName = CommonInfo.getUserId(context); |
| 57 | 74 | //打的重要点 |
| ... | ... | @@ -65,33 +82,101 @@ public class UploadFailDetailFragmentPresenter extends MvpBasePresenter<UploadFa |
| 65 | 82 | MyMapUtil.queryHistoryTrace(context, mClient, entityName, startTime, endTime, new MyMapUtil.CallBack() { |
| 66 | 83 | @Override |
| 67 | 84 | public void success(List<LatLng> resultPoints) { |
| 85 | + | |
| 68 | 86 | if (resultPoints != null) { |
| 87 | + allResultPoints = resultPoints; | |
| 88 | + //划线 | |
| 89 | + if (resultPoints.size() > 1) { | |
| 90 | + if (!failedEntity.getIsPause()) { | |
| 91 | + MyMapUtil.drawHistoryTrack(context, getView().baiduMap, resultPoints, SortType.asc, R.color.red, R.drawable.icon_start, R.drawable.icon_end); | |
| 92 | + //设置地图自动缩放 | |
| 93 | + MyMapUtil.setMapAutoZoom(getView().baiduMap, resultPoints, -2f); | |
| 94 | + } else { | |
| 95 | + MyMapUtil.drawHistoryTrack(context, getView().baiduMap, resultPoints, SortType.asc, R.color.red, R.drawable.icon_start, 0); | |
| 96 | + | |
| 97 | + } | |
| 98 | + } | |
| 99 | + | |
| 69 | 100 | if (getView() != null) { |
| 70 | 101 | QMUITipDialogUtil.dismessDialog(); |
| 71 | 102 | getView().updateStartBtnState(true); |
| 72 | - if (importPoints != null) { | |
| 73 | - //判断是否完成 | |
| 74 | - boolean isFinish = MyMapUtil.checkIsFinishTrace(importPoints, resultPoints, Constant.PASS_RATE); | |
| 75 | - if (isFinish) { | |
| 76 | - Toast.makeText(context, "完成", Toast.LENGTH_LONG).show(); | |
| 77 | - failedEntity.setIsFinish("1"); | |
| 78 | - if (getView() != null) { | |
| 79 | - getView().updateIsFinish("1"); | |
| 80 | - } | |
| 81 | - } else { | |
| 82 | - Toast.makeText(context, "没有完成", Toast.LENGTH_LONG).show(); | |
| 103 | + //如果用户没有暂停 | |
| 104 | + if (!failedEntity.getIsPause()) { | |
| 105 | + //判断用户是否完成 | |
| 106 | + if (!failedEntity.getIsArriveEndPoint()) { | |
| 107 | + //没有完成 | |
| 83 | 108 | failedEntity.setIsFinish("0"); |
| 84 | - if (getView() != null) { | |
| 85 | - getView().updateIsFinish("0"); | |
| 109 | + getView().updateIsFinish("0"); | |
| 110 | + } else { | |
| 111 | + if (importPoints != null) { | |
| 112 | + //判断是否完成 | |
| 113 | + boolean isFinish = MyMapUtil.checkIsFinishTrace(importPoints, resultPoints, Constant.PASS_RATE); | |
| 114 | + if (isFinish) { | |
| 115 | + Toast.makeText(context, "完成", Toast.LENGTH_LONG).show(); | |
| 116 | + failedEntity.setIsFinish("1"); | |
| 117 | + if (getView() != null) { | |
| 118 | + getView().updateIsFinish("1"); | |
| 119 | + } | |
| 120 | + } else { | |
| 121 | + Toast.makeText(context, "没有完成", Toast.LENGTH_LONG).show(); | |
| 122 | + failedEntity.setIsFinish("0"); | |
| 123 | + if (getView() != null) { | |
| 124 | + getView().updateIsFinish("0"); | |
| 125 | + } | |
| 126 | + } | |
| 86 | 127 | } |
| 87 | 128 | } |
| 88 | - if (resultPoints.size() > 1) { | |
| 89 | - MyMapUtil.drawHistoryTrack(context, getView().baiduMap, resultPoints, SortType.asc, R.color.red, R.drawable.icon_start, R.drawable.icon_end); | |
| 90 | - //设置地图自动缩放 | |
| 91 | - MyMapUtil.setMapAutoZoom(getView().baiduMap, resultPoints, -2f); | |
| 92 | - } | |
| 129 | + } | |
| 93 | 130 | |
| 131 | + //判断用户是否点击暂存 | |
| 132 | + if (!failedEntity.getIsPause()) { | |
| 133 | + //开始查询 | |
| 134 | + long continueTime = failedEntity.getUsrContinueTime(); | |
| 135 | + long finishTime = failedEntity.getUserEndTime(); | |
| 136 | + MyMapUtil.queryHistoryTrace(context, mClient, entityName, continueTime, finishTime, new MyMapUtil.CallBack() { | |
| 137 | + @Override | |
| 138 | + public void success(List<LatLng> resultPoints) { | |
| 139 | + if (resultPoints != null && resultPoints.size() > 1) { | |
| 140 | + //开始画暂停到结束的轨迹 | |
| 141 | + MyMapUtil.drawHistoryTrack(context, getView().baiduMap, resultPoints, SortType.asc, R.color.red, 0, R.drawable.icon_end); | |
| 142 | + //开始合并查出来的数据 | |
| 143 | + if (allResultPoints != null) { | |
| 144 | + allResultPoints.addAll(resultPoints); | |
| 145 | + } | |
| 146 | + //设置地图自动缩放 | |
| 147 | + MyMapUtil.setMapAutoZoom(getView().baiduMap, allResultPoints, -2f); | |
| 148 | + //判断用户是否完成 | |
| 149 | + if (!failedEntity.getIsArriveEndPoint()) { | |
| 150 | + //没有完成 | |
| 151 | + failedEntity.setIsFinish("0"); | |
| 152 | + getView().updateIsFinish("0"); | |
| 153 | + } else { | |
| 154 | + if (importPoints != null) { | |
| 155 | + //判断是否完成 | |
| 156 | + boolean isFinish = MyMapUtil.checkIsFinishTrace(importPoints, allResultPoints, Constant.PASS_RATE); | |
| 157 | + if (isFinish) { | |
| 158 | + Toast.makeText(context, "完成", Toast.LENGTH_LONG).show(); | |
| 159 | + failedEntity.setIsFinish("1"); | |
| 160 | + if (getView() != null) { | |
| 161 | + getView().updateIsFinish("1"); | |
| 162 | + } | |
| 163 | + } else { | |
| 164 | + Toast.makeText(context, "没有完成", Toast.LENGTH_LONG).show(); | |
| 165 | + failedEntity.setIsFinish("0"); | |
| 166 | + if (getView() != null) { | |
| 167 | + getView().updateIsFinish("0"); | |
| 168 | + } | |
| 169 | + } | |
| 170 | + // | |
| 171 | + } | |
| 172 | + } | |
| 173 | + } | |
| 174 | + } | |
| 175 | + | |
| 176 | + }); | |
| 177 | + // | |
| 94 | 178 | } |
| 179 | + | |
| 95 | 180 | } |
| 96 | 181 | } |
| 97 | 182 | //查询失败 | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/ALLScoreDetailFragmentView.java
| ... | ... | @@ -3,12 +3,15 @@ package com.cnlive.moudle.pedometer.frame.view; |
| 3 | 3 | import android.content.Context; |
| 4 | 4 | import android.text.TextUtils; |
| 5 | 5 | import android.view.View; |
| 6 | +import android.view.ViewGroup; | |
| 7 | +import android.widget.LinearLayout; | |
| 6 | 8 | |
| 7 | 9 | import com.baidu.mapapi.map.BaiduMap; |
| 8 | 10 | import com.baidu.mapapi.map.MapView; |
| 9 | 11 | import com.baidu.mapapi.map.UiSettings; |
| 10 | 12 | import com.cnlive.moudle.pedometer.model.RunningFinishBean; |
| 11 | 13 | import com.cnlive.moudle.pedometer.ui.fragment.ALLScoreDetailFragment; |
| 14 | +import com.cnlive.moudle.pedometer.utils.ScreenUtil; | |
| 12 | 15 | import com.cnlive.moudle.pedometer.utils.TimeUtil; |
| 13 | 16 | import com.example.moudle_pedometer.R; |
| 14 | 17 | import com.hannesdorfmann.mosby3.mvp.MvpView; |
| ... | ... | @@ -35,6 +38,10 @@ public class ALLScoreDetailFragmentView implements MvpView { |
| 35 | 38 | |
| 36 | 39 | public void initView(RunningFinishBean runningFinishBean) { |
| 37 | 40 | this.runningFinishBean = runningFinishBean; |
| 41 | + //设置滚动视图下边距 | |
| 42 | + ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) fragment.binding.scrollView.getLayoutParams(); | |
| 43 | + params.bottomMargin = ScreenUtil.dip2px(getContext(), 20); | |
| 44 | + fragment.binding.scrollView.setLayoutParams(params); | |
| 38 | 45 | //隐藏开始按钮 |
| 39 | 46 | fragment.binding.rlScrollViewStartBtn.setVisibility(View.GONE); |
| 40 | 47 | //设置标题 |
| ... | ... | @@ -53,7 +60,7 @@ public class ALLScoreDetailFragmentView implements MvpView { |
| 53 | 60 | } |
| 54 | 61 | //设置完成时间 |
| 55 | 62 | if (!TextUtils.isEmpty(runningFinishBean.getUserFinishTime())) { |
| 56 | - fragment.binding.includeFinishUserInfo.tvDate.setText(TimeUtil.getStampToTime(Long.parseLong(runningFinishBean.getUserFinishTime())*1000, "yyyy/MM/dd HH:mm")); | |
| 63 | + fragment.binding.includeFinishUserInfo.tvDate.setText(TimeUtil.getStampToTime(Long.parseLong(runningFinishBean.getUserFinishTime()) * 1000, "yyyy/MM/dd HH:mm")); | |
| 57 | 64 | } |
| 58 | 65 | //设置起点 |
| 59 | 66 | fragment.binding.includeFinishRunRoute.tvStartPoint.setText(runningFinishBean.getStartPoint()); |
| ... | ... | @@ -66,7 +73,7 @@ public class ALLScoreDetailFragmentView implements MvpView { |
| 66 | 73 | fragment.binding.includeFinishRunRoute.tvFinishState.setTextColor(getContext().getResources().getColor(R.color.green_round)); |
| 67 | 74 | } |
| 68 | 75 | //完成 |
| 69 | - else if ("0".equals(runningFinishBean.getIsFinish())){ | |
| 76 | + else if ("0".equals(runningFinishBean.getIsFinish())) { | |
| 70 | 77 | fragment.binding.includeFinishRunRoute.tvFinishState.setText("路线未完成"); |
| 71 | 78 | fragment.binding.includeFinishRunRoute.tvFinishState.setTextColor(getContext().getResources().getColor(R.color.red)); |
| 72 | 79 | } | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RaceRecorView.java
| 1 | 1 | package com.cnlive.moudle.pedometer.frame.view; |
| 2 | 2 | |
| 3 | 3 | import android.support.v7.widget.LinearLayoutManager; |
| 4 | +import android.text.TextUtils; | |
| 4 | 5 | import android.view.View; |
| 5 | 6 | |
| 6 | 7 | import com.cnlive.libs.base.util.AlertUtil; |
| ... | ... | @@ -98,7 +99,14 @@ public class RaceRecorView implements MvpView { |
| 98 | 99 | runningFinishBean.setUserFinishTime(bean.getEndTime()); |
| 99 | 100 | //设置用户是否完成 |
| 100 | 101 | runningFinishBean.setIsFinish(bean.getCompleteStatus() + ""); |
| 101 | - | |
| 102 | + //设置是否暂停 | |
| 103 | + if (!TextUtils.isEmpty(bean.getPauseTime())) { | |
| 104 | + runningFinishBean.setPause(true); | |
| 105 | + //设置暂停时间 | |
| 106 | + runningFinishBean.setUserPauseTime(bean.getPauseTime()); | |
| 107 | + //设置用户继续时间 | |
| 108 | + runningFinishBean.setUserContinueTime(bean.getContinueTime()); | |
| 109 | + } | |
| 102 | 110 | //设置起点 |
| 103 | 111 | ALLScoreDetailActivity.startActivity(fragment.getActivity(), runningFinishBean); |
| 104 | 112 | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunMainFragmentView.java
| ... | ... | @@ -39,6 +39,7 @@ import com.cnlive.moudle.pedometer.ui.fragment.RunMainFragment; |
| 39 | 39 | import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; |
| 40 | 40 | import com.cnlive.moudle.pedometer.ui.widget.TipDialog; |
| 41 | 41 | import com.cnlive.moudle.pedometer.utils.ButtonAnimUtil; |
| 42 | +import com.cnlive.moudle.pedometer.utils.GsonUtil; | |
| 42 | 43 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; |
| 43 | 44 | import com.cnlive.moudle.pedometer.utils.MySpHelper; |
| 44 | 45 | import com.cnlive.moudle.pedometer.utils.StepUtil; |
| ... | ... | @@ -69,6 +70,8 @@ public class RunMainFragmentView implements MvpView { |
| 69 | 70 | private LocationClient mLocClient; |
| 70 | 71 | public MyLocationListenner myListener = new MyLocationListenner(); |
| 71 | 72 | private String employTime = ""; |
| 73 | + private LatLng endLatLng;//终点坐标 | |
| 74 | + private TipDialog tipDialog; | |
| 72 | 75 | |
| 73 | 76 | public RunMainFragmentView(RunMainFragment fragment) { |
| 74 | 77 | this.fragment = fragment; |
| ... | ... | @@ -144,6 +147,27 @@ public class RunMainFragmentView implements MvpView { |
| 144 | 147 | if (TextUtils.isEmpty(userStepEntity.getStreetId())) { |
| 145 | 148 | StepUtil.setStepStartData(getContext(), uid, TimeUtil.getNowTimeStamp(), CommonInfo.getStreetId(getContext())); |
| 146 | 149 | } |
| 150 | + //设置终点经纬度 | |
| 151 | + if (TextUtils.isEmpty(userStepEntity.getEndLatLng())) { | |
| 152 | + if (null != runRaceDetailInfo.getEndLatLng()) { | |
| 153 | + //设置终点坐标 | |
| 154 | + userStepEntity.setEndLatLng(runRaceDetailInfo.getEndLatLng()); | |
| 155 | + //更新数据 | |
| 156 | + StepUtil.updateStepData(getContext(), userStepEntity); | |
| 157 | + } | |
| 158 | + } | |
| 159 | + //设置终点经纬度 | |
| 160 | + if (!TextUtils.isEmpty(userStepEntity.getEndLatLng())) { | |
| 161 | + endLatLng = GsonUtil.GsonToBean(userStepEntity.getEndLatLng(), LatLng.class); | |
| 162 | + } | |
| 163 | + //设置步数 | |
| 164 | + if (!TextUtils.isEmpty(userStepEntity.getStepCount())){ | |
| 165 | + //设置行走步数 | |
| 166 | + fragment.binding.tvStepCount.setText(userStepEntity.getStepCount()); | |
| 167 | + //设置行走公里 | |
| 168 | + fragment.binding.tvRunDistance.setText(StepUtil.getWalkDistanceKM(Long.parseLong(userStepEntity.getStepCount())) + ""); | |
| 169 | + } | |
| 170 | + | |
| 147 | 171 | |
| 148 | 172 | } |
| 149 | 173 | initLocationClient(); |
| ... | ... | @@ -231,8 +255,8 @@ public class RunMainFragmentView implements MvpView { |
| 231 | 255 | Log.e(TAG, "run: 是否暂停" + isPasue); |
| 232 | 256 | //如果暂停则从暂停那一刻开始 |
| 233 | 257 | if (isPasue) { |
| 234 | - if ((userStepEntity.getPauseTimeStamp() != 0) && (userStepEntity.getRecordTime() != 0)) { | |
| 235 | - fragment.binding.chronometer.setBase(userStepEntity.getPauseTimeStamp() + (SystemClock.elapsedRealtime() - userStepEntity.getRecordTime())); | |
| 258 | + if ((userStepEntity.getChronometerBase() != 0) && (userStepEntity.getRecordTime() != 0)) { | |
| 259 | + fragment.binding.chronometer.setBase(userStepEntity.getChronometerBase() + (SystemClock.elapsedRealtime() - userStepEntity.getRecordTime())); | |
| 236 | 260 | } else { |
| 237 | 261 | fragment.binding.chronometer.setFormat("00:00:01"); |
| 238 | 262 | fragment.binding.chronometer.setBase(SystemClock.elapsedRealtime()); |
| ... | ... | @@ -375,17 +399,18 @@ public class RunMainFragmentView implements MvpView { |
| 375 | 399 | runningFinishBean.setStartPoint(userStepEntity.getStartPoint()); |
| 376 | 400 | runningFinishBean.setEndPoint(userStepEntity.getEndPoint()); |
| 377 | 401 | runningFinishBean.setRunDistance(fragment.binding.tvRunDistance.getText().toString()); |
| 402 | + //必须先设置步数,然后设置配速 | |
| 403 | + if ("--".equals(fragment.binding.tvStepCount.getText().toString())) { | |
| 404 | + runningFinishBean.setStep("0"); | |
| 405 | + } else { | |
| 406 | + runningFinishBean.setStep(fragment.binding.tvStepCount.getText().toString()); | |
| 407 | + } | |
| 378 | 408 | if ("--".equals(fragment.binding.tvSpeed.getText().toString())) { |
| 379 | 409 | String speed = StepUtil.getPaceSpeed(Double.parseDouble(employTime), Double.parseDouble(fragment.binding.tvRunDistance.getText().toString())); |
| 380 | 410 | runningFinishBean.setSpeed(speed); |
| 381 | 411 | } else { |
| 382 | 412 | runningFinishBean.setSpeed(fragment.binding.tvSpeed.getText().toString()); |
| 383 | 413 | } |
| 384 | - if ("--".equals(fragment.binding.tvStepCount.getText().toString())) { | |
| 385 | - runningFinishBean.setStep("0"); | |
| 386 | - } else { | |
| 387 | - runningFinishBean.setStep(fragment.binding.tvStepCount.getText().toString()); | |
| 388 | - } | |
| 389 | 414 | runningFinishBean.setTime(fragment.binding.chronometer.getText().toString()); |
| 390 | 415 | runningFinishBean.setDate(TimeUtil.getStampToTime(userStepEntity.getFinishTimeStamp() * 1000, "yyyy/MM/dd HH:mm")); |
| 391 | 416 | runningFinishBean.setStreetTitle(userStepEntity.getStreetTitle()); |
| ... | ... | @@ -597,7 +622,7 @@ public class RunMainFragmentView implements MvpView { |
| 597 | 622 | if (!TextUtils.isEmpty(id)) { |
| 598 | 623 | UserStepEntity userStepEntity = StepUtil.getUserStepData(fragment.getActivity(), uid); |
| 599 | 624 | if (userStepEntity != null) { |
| 600 | - userStepEntity.setPauseTimeStamp(fragment.binding.chronometer.getBase()); | |
| 625 | + userStepEntity.setChronometerBase(fragment.binding.chronometer.getBase()); | |
| 601 | 626 | //设置当前暂停的时间戳 |
| 602 | 627 | userStepEntity.setRecordTime(SystemClock.elapsedRealtime()); |
| 603 | 628 | //设置当前用户暂停的时间戳 |
| ... | ... | @@ -661,7 +686,8 @@ public class RunMainFragmentView implements MvpView { |
| 661 | 686 | |
| 662 | 687 | @Override |
| 663 | 688 | public void onReceiveLocation(BDLocation location) { |
| 664 | - if (location == null) { | |
| 689 | + // map view 销毁后不在处理新接收的位置 | |
| 690 | + if (location == null || getContext() == null) { | |
| 665 | 691 | return; |
| 666 | 692 | } |
| 667 | 693 | //正在搜索GPS信号 |
| ... | ... | @@ -718,6 +744,52 @@ public class RunMainFragmentView implements MvpView { |
| 718 | 744 | fragment.binding.ivGps.setBackground(getContext().getResources().getDrawable(R.drawable.rt_training_gps_3)); |
| 719 | 745 | } |
| 720 | 746 | } |
| 747 | + | |
| 748 | + //进行精度过滤 | |
| 749 | + if (location.getRadius() > Constant.LOCA_ACCURACY) { | |
| 750 | + return; | |
| 751 | + } | |
| 752 | + //进行数据比较(先看看数据库是否有数据) | |
| 753 | + if (null == endLatLng) { | |
| 754 | + if (null == userStepEntity) { | |
| 755 | + userStepEntity = StepUtil.getUserStepData(getContext(), CommonInfo.getUserId(getContext())); | |
| 756 | + } | |
| 757 | + if (null != userStepEntity) { | |
| 758 | + if (!TextUtils.isEmpty(userStepEntity.getEndLatLng())) { | |
| 759 | + endLatLng = GsonUtil.GsonToBean(userStepEntity.getEndLatLng(), LatLng.class); | |
| 760 | + } | |
| 761 | + } | |
| 762 | + } | |
| 763 | + //开始比较 | |
| 764 | + if (null != endLatLng) { | |
| 765 | + LatLng current = new LatLng(location.getLatitude(), location.getLongitude()); | |
| 766 | + if (null != current) { | |
| 767 | + //开始比较数据 | |
| 768 | + double distance = DistanceUtil.getDistance(current, endLatLng); | |
| 769 | + if (distance < Constant.LOCA_END_POINT_ACCURACY) { | |
| 770 | + //设置数据 | |
| 771 | + if (userStepEntity != null) { | |
| 772 | + userStepEntity.setIsArriveEndPoint(true); | |
| 773 | + //更新数据 | |
| 774 | + StepUtil.updateStepData(getContext(), userStepEntity); | |
| 775 | + } | |
| 776 | + //进行提示 | |
| 777 | + if (null == tipDialog) { | |
| 778 | + tipDialog = new TipDialog(getContext(), getContext().getResources().getString(R.string.run_race_arrive_end_tip), "好的", R.color.green_round, new TipDialog.DialogInterface() { | |
| 779 | + @Override | |
| 780 | + public void onClick(TipDialog dialog) { | |
| 781 | + dialog.dismiss(); | |
| 782 | + } | |
| 783 | + }); | |
| 784 | + tipDialog.setCancelable(false); | |
| 785 | + tipDialog.setCanceledOnTouchOutside(false); | |
| 786 | + } | |
| 787 | + if (!tipDialog.isShowing()) { | |
| 788 | + tipDialog.show(); | |
| 789 | + } | |
| 790 | + } | |
| 791 | + } | |
| 792 | + } | |
| 721 | 793 | } |
| 722 | 794 | |
| 723 | 795 | } |
| ... | ... | @@ -761,7 +833,7 @@ public class RunMainFragmentView implements MvpView { |
| 761 | 833 | //设置当前数据创建时间戳 |
| 762 | 834 | failedEntity.setCreatTimeStamp(TimeUtil.getNowTimeStamp()); |
| 763 | 835 | //设置是否暂停 |
| 764 | - if (userStepEntity.getPauseCount() > 1) { | |
| 836 | + if (userStepEntity.getPauseCount() != 0) { | |
| 765 | 837 | failedEntity.setIsPause(true); |
| 766 | 838 | //设置暂停时间 |
| 767 | 839 | failedEntity.setUserPauseTime(userStepEntity.getUserPauseTimeStamp()); |
| ... | ... | @@ -810,6 +882,8 @@ public class RunMainFragmentView implements MvpView { |
| 810 | 882 | failedEntity.setStreetId(userStepEntity.getStreetId()); |
| 811 | 883 | //设置赛事标题 |
| 812 | 884 | failedEntity.setStreetTitle(userStepEntity.getStreetTitle()); |
| 885 | + //设置是否完成 | |
| 886 | + failedEntity.setIsArriveEndPoint(userStepEntity.getIsArriveEndPoint()); | |
| 813 | 887 | //设置数据 |
| 814 | 888 | StepUtil.setFailData(context, failedEntity); |
| 815 | 889 | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunRaceDetailFragmentView.java
| ... | ... | @@ -122,21 +122,14 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 122 | 122 | public MyLocationListenner myListener = new MyLocationListenner(); |
| 123 | 123 | private final int DEFULT_ZOOM = 17; |
| 124 | 124 | private RoutePlanSearch routePlanSearch = null; // 路线规划 |
| 125 | - private LatLng endLatLng; | |
| 126 | 125 | private final int START_MARK = 0;//起始点 |
| 127 | 126 | private final int END_MARK = 1;//终止点 |
| 128 | - | |
| 129 | - private String startPoint = "首都师范大学南门"; | |
| 130 | - private String endPoint = "首都师范大学篮球场"; | |
| 131 | - // private String test = "[{\"latitude\":39.933889208848,\"latitudeE6\":3.9933889208848E7,\"longitude\":116.30900265517,\"longitudeE6\":1.1630900265517001E8},{\"latitude\":39.933868507347,\"latitudeE6\":3.9933868507347E7,\"longitude\":116.30865416508,\"longitudeE6\":1.1630865416508E8},{\"latitude\":39.934756505077,\"latitudeE6\":3.9934756505077E7,\"longitude\":116.30860516469,\"longitudeE6\":1.1630860516468999E8},{\"latitude\":39.934781620502,\"latitudeE6\":3.9934781620502E7,\"longitude\":116.30961013007,\"longitudeE6\":1.1630961013007E8},{\"latitude\":39.934881620374,\"latitudeE6\":3.9934881620374E7,\"longitude\":116.30960513008,\"longitudeE6\":1.1630960513008E8},{\"latitude\":39.934077623132,\"latitudeE6\":3.9934077623132E7,\"longitude\":116.30965812942,\"longitudeE6\":1.1630965812942E8},{\"latitude\":39.933972618463,\"latitudeE6\":3.9933972618463E7,\"longitude\":116.30962113087,\"longitudeE6\":1.1630962113087E8},{\"latitude\":39.933932608856,\"latitudeE6\":3.9933932608856E7,\"longitude\":116.30953913383,\"longitudeE6\":1.1630953913383E8}]"; | |
| 132 | - private LinkedList<LatLng> importLatLngs;//关键点 | |
| 133 | - private LatLng startLatLng = new LatLng(39.934733, 116.308646);//起始点 | |
| 127 | + private LatLng startLatLng;//起始点 | |
| 134 | 128 | public RunRaceDetailInfo runRaceDetailInfo; |
| 135 | 129 | private UserStepEntity userStepEntity; |
| 136 | 130 | private boolean isDifferentStreet = false; |
| 137 | 131 | private LBSTraceClient mClient = null; |
| 138 | - private List<LatLng> resultStreetPoints; | |
| 139 | - public List<LatLng> importStreetPoints;//运营打的重要的点 | |
| 132 | + public LatLng endLatLng;//用于终点判断 | |
| 140 | 133 | |
| 141 | 134 | public RunRaceDetailFragmentView(RunRaceDetailFragment fragment) { |
| 142 | 135 | this.fragment = fragment; |
| ... | ... | @@ -200,10 +193,6 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 200 | 193 | return; |
| 201 | 194 | } |
| 202 | 195 | this.runRaceDetailInfo = runRaceDetailInfo; |
| 203 | -// //初始化地图点位 | |
| 204 | - if (runRaceDetailInfo.getLatLongitude() != null) { | |
| 205 | - importStreetPoints = GsonUtil.jsonToList(runRaceDetailInfo.getLatLongitude().trim(), LatLng.class); | |
| 206 | - } | |
| 207 | 196 | //轨迹开始时间 |
| 208 | 197 | long startTime = 0; |
| 209 | 198 | //轨迹结束时间 |
| ... | ... | @@ -220,8 +209,8 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 220 | 209 | @Override |
| 221 | 210 | public void success(List<LatLng> resultPoints) { |
| 222 | 211 | if (resultPoints != null && resultPoints.size() > 1) { |
| 223 | - resultStreetPoints = resultPoints; | |
| 224 | - Log.e(TAG, "resultPoints: " + resultPoints.size()); | |
| 212 | + startLatLng = resultPoints.get(0); | |
| 213 | + endLatLng = resultPoints.get(resultPoints.size() - 1); | |
| 225 | 214 | MyMapUtil.drawServerLineTrack(getContext(), baiduMap, resultPoints, SortType.asc, R.color.green_round, R.drawable.icon_start, R.drawable.icon_end); |
| 226 | 215 | // //自动计算地图缩放 |
| 227 | 216 | // MapStatus.Builder builder = new MapStatus.Builder(); |
| ... | ... | @@ -486,8 +475,28 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 486 | 475 | //现在开始 |
| 487 | 476 | else if ("1".equals(fragment.binding.rlScrollViewStartBtn.getTag())) { |
| 488 | 477 | //先判断是否从百度查询到赛事轨迹 |
| 489 | - if (resultStreetPoints != null) { | |
| 490 | - startStepService(getContext()); | |
| 478 | + if (null != endLatLng && null != startLatLng) { | |
| 479 | + //开始比较距离 | |
| 480 | + if (null != firstLatLng) { | |
| 481 | + double currentDiatance = DistanceUtil.getDistance(firstLatLng, startLatLng); | |
| 482 | + if (currentDiatance < Constant.LOCA_START_POINT_ACCURACY) { | |
| 483 | + //设置终点坐标 | |
| 484 | + runRaceDetailInfo.setEndLatLng(GsonUtil.GsonString(endLatLng)); | |
| 485 | + startStepService(getContext()); | |
| 486 | + } else { | |
| 487 | + //进行提示 | |
| 488 | + TipDialog tipDialog = new TipDialog(getContext(), getContext().getResources().getString(R.string.run_race_far_tip), "好的", R.color.green_round, new TipDialog.DialogInterface() { | |
| 489 | + @Override | |
| 490 | + public void onClick(TipDialog dialog) { | |
| 491 | + dialog.dismiss(); | |
| 492 | + } | |
| 493 | + }); | |
| 494 | + tipDialog.setCancelable(false); | |
| 495 | + tipDialog.setCanceledOnTouchOutside(false); | |
| 496 | + tipDialog.show(); | |
| 497 | + } | |
| 498 | + } | |
| 499 | + | |
| 491 | 500 | } else { |
| 492 | 501 | QMUITipDialogUtil.textDialog(getContext(), "正在获取轨迹请稍后...", 1); |
| 493 | 502 | } |
| ... | ... | @@ -495,12 +504,33 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 495 | 504 | //继续运动 |
| 496 | 505 | else if ("2".equals(fragment.binding.rlScrollViewStartBtn.getTag())) { |
| 497 | 506 | if (!isDifferentStreet) { |
| 498 | - checkBaiduServiceState(); | |
| 507 | + SelectDialog continueTipDialog = new SelectDialog(getContext(), "是否继续运动", "否", new SelectDialog.DialogInterface() { | |
| 508 | + @Override | |
| 509 | + public void onClick(SelectDialog dialog) { | |
| 510 | + //清空上次保存数据 | |
| 511 | + StepUtil.clearRunData(getContext(), CommonInfo.getUserId(getContext())); | |
| 512 | + //停止服务 | |
| 513 | + stopStepService(); | |
| 514 | + //清除数据 | |
| 515 | + CommonInfo.resetRace(getContext()); | |
| 516 | + dialog.dismiss(); | |
| 517 | + } | |
| 518 | + }, "是", new SelectDialog.DialogInterface() { | |
| 519 | + @Override | |
| 520 | + public void onClick(SelectDialog dialog) { | |
| 521 | + dialog.dismiss(); | |
| 522 | + checkBaiduServiceState(); | |
| 523 | + } | |
| 524 | + }); | |
| 525 | + continueTipDialog.setCanceledOnTouchOutside(false); | |
| 526 | + continueTipDialog.setCancelable(false); | |
| 527 | + continueTipDialog.show(); | |
| 528 | + | |
| 499 | 529 | } |
| 500 | 530 | |
| 501 | 531 | //赛事id不同 |
| 502 | 532 | else { |
| 503 | - SelectDialog selectDialog = new SelectDialog(getContext(), "您正在进行另一赛事,是否回到当前进行赛事?", "否", new SelectDialog.DialogInterface() { | |
| 533 | + SelectDialog selectDialog = new SelectDialog(getContext(), "您正在参与另一赛事\n是否继续?", "否", new SelectDialog.DialogInterface() { | |
| 504 | 534 | @Override |
| 505 | 535 | public void onClick(SelectDialog dialog) { |
| 506 | 536 | dialog.dismiss(); |
| ... | ... | @@ -653,188 +683,188 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 653 | 683 | }); |
| 654 | 684 | } |
| 655 | 685 | |
| 656 | - /** | |
| 657 | - * 开始路线规划 | |
| 658 | - */ | |
| 659 | - public void searchRouteResult(LatLng StartPoint, LatLng EndPoint, int index, int listSize) { | |
| 660 | -// Log.e(TAG, "searchRouteResult: "); | |
| 661 | - float currentZoom = baiduMap.getMapStatus().zoom; | |
| 662 | - // 设置起终点信息,对于tranist search 来说,城市名无意义 | |
| 663 | - PlanNode stNode = PlanNode.withLocation(StartPoint); | |
| 664 | - PlanNode enNode = PlanNode.withLocation(EndPoint); | |
| 665 | - routePlanSearch.setOnGetRoutePlanResultListener(new OnGetRoutePlanResultListener() { | |
| 666 | - @Override | |
| 667 | - public void onGetWalkingRouteResult(WalkingRouteResult walkingRouteResult) { | |
| 668 | - if (fragment.getActivity() == null) { | |
| 669 | - return; | |
| 670 | - } | |
| 671 | - if (walkingRouteResult == null || walkingRouteResult.error != SearchResult.ERRORNO.NO_ERROR) { | |
| 672 | - Toast.makeText(fragment.getActivity(), "抱歉,无法获取路线!", Toast.LENGTH_SHORT).show(); | |
| 673 | - } | |
| 674 | - if (walkingRouteResult.error == SearchResult.ERRORNO.AMBIGUOUS_ROURE_ADDR) { | |
| 675 | - // 起终点或途经点地址有岐义,通过以下接口获取建议查询信息 | |
| 676 | - return; | |
| 677 | - } | |
| 678 | - List<LatLng> points = new ArrayList<LatLng>(); | |
| 679 | - if (walkingRouteResult.getRouteLines() != null) { | |
| 680 | - if (walkingRouteResult.getRouteLines().get(0).getAllStep().get(0).getWayPoints().size() > 0) { | |
| 681 | - //添加起点坐标 | |
| 682 | - if (index == 0) { | |
| 683 | - points.add(StartPoint); | |
| 684 | - } | |
| 685 | - for (int i = 0; i < walkingRouteResult.getRouteLines().get(0).getAllStep().size(); i++) { | |
| 686 | - for (int j = 0; j < walkingRouteResult.getRouteLines().get(0).getAllStep().get(i).getWayPoints().size(); j++) { | |
| 687 | - points.add(walkingRouteResult.getRouteLines().get(0).getAllStep().get(i).getWayPoints().get(j)); | |
| 688 | - } | |
| 689 | - } | |
| 690 | - } | |
| 691 | - //添加终点坐标 | |
| 692 | - if (endLatLng != null) { | |
| 686 | +// /** | |
| 687 | +// * 开始路线规划 | |
| 688 | +// */ | |
| 689 | +// public void searchRouteResult(LatLng StartPoint, LatLng EndPoint, int index, int listSize) { | |
| 690 | +//// Log.e(TAG, "searchRouteResult: "); | |
| 691 | +// float currentZoom = baiduMap.getMapStatus().zoom; | |
| 692 | +// // 设置起终点信息,对于tranist search 来说,城市名无意义 | |
| 693 | +// PlanNode stNode = PlanNode.withLocation(StartPoint); | |
| 694 | +// PlanNode enNode = PlanNode.withLocation(EndPoint); | |
| 695 | +// routePlanSearch.setOnGetRoutePlanResultListener(new OnGetRoutePlanResultListener() { | |
| 696 | +// @Override | |
| 697 | +// public void onGetWalkingRouteResult(WalkingRouteResult walkingRouteResult) { | |
| 698 | +// if (fragment.getActivity() == null) { | |
| 699 | +// return; | |
| 700 | +// } | |
| 701 | +// if (walkingRouteResult == null || walkingRouteResult.error != SearchResult.ERRORNO.NO_ERROR) { | |
| 702 | +// Toast.makeText(fragment.getActivity(), "抱歉,无法获取路线!", Toast.LENGTH_SHORT).show(); | |
| 703 | +// } | |
| 704 | +// if (walkingRouteResult.error == SearchResult.ERRORNO.AMBIGUOUS_ROURE_ADDR) { | |
| 705 | +// // 起终点或途经点地址有岐义,通过以下接口获取建议查询信息 | |
| 706 | +// return; | |
| 707 | +// } | |
| 708 | +// List<LatLng> points = new ArrayList<LatLng>(); | |
| 709 | +// if (walkingRouteResult.getRouteLines() != null) { | |
| 710 | +// if (walkingRouteResult.getRouteLines().get(0).getAllStep().get(0).getWayPoints().size() > 0) { | |
| 711 | +// //添加起点坐标 | |
| 712 | +// if (index == 0) { | |
| 713 | +// points.add(StartPoint); | |
| 714 | +// } | |
| 715 | +// for (int i = 0; i < walkingRouteResult.getRouteLines().get(0).getAllStep().size(); i++) { | |
| 716 | +// for (int j = 0; j < walkingRouteResult.getRouteLines().get(0).getAllStep().get(i).getWayPoints().size(); j++) { | |
| 717 | +// points.add(walkingRouteResult.getRouteLines().get(0).getAllStep().get(i).getWayPoints().get(j)); | |
| 718 | +// } | |
| 719 | +// } | |
| 720 | +// } | |
| 721 | +// //添加终点坐标 | |
| 722 | +// if (endLatLng != null) { | |
| 723 | +//// points.add(endLatLng); | |
| 724 | +// } | |
| 725 | +// | |
| 726 | +// ArrayList<Integer> traffics = new ArrayList<Integer>(); | |
| 727 | +// for (int i = 0; i < points.size(); i++) { | |
| 728 | +// if (i % 2 == 0) { | |
| 729 | +// traffics.add(i); | |
| 730 | +// } | |
| 731 | +// } | |
| 732 | +// | |
| 733 | +// | |
| 734 | +// if (points.size() > 0) { | |
| 735 | +//// if (baiduMap != null) { | |
| 736 | +//// baiduMap.clear(); | |
| 737 | +//// if (endLatLng != null) { | |
| 738 | +//// markPoi(endLatLng.latitude, endLatLng.longitude); | |
| 739 | +//// } | |
| 740 | +//// } | |
| 741 | +// | |
| 742 | +// //设置折线的属性 | |
| 743 | +//// OverlayOptions mOverlayOptions = new PolylineOptions() | |
| 744 | +//// .width(10) | |
| 745 | +//// .color(0xAAFF0000) | |
| 746 | +//// .points(points); | |
| 747 | +// //设置折线的属性 | |
| 748 | +// OverlayOptions mOverlayOptions = new PolylineOptions() | |
| 749 | +// .width(10) | |
| 750 | +// .dottedLine(true) | |
| 751 | +// .points(points) | |
| 752 | +// .customTextureList(getCustomTextureList()) | |
| 753 | +// .textureIndex(traffics);//设置纹理列表 | |
| 754 | +// //在地图上绘制起点 | |
| 755 | +// if (index == 0) { | |
| 756 | +// //显示当前位置图标 | |
| 757 | +// Bitmap pointBitmap = BitmapUtil.getBitmapFromDp(getContext(), BitmapFactory.decodeResource(getContext().getResources(), R.drawable.icon_start), 30, 30); | |
| 758 | +// startMark = new MarkerOptions() | |
| 759 | +// .position(StartPoint) | |
| 760 | +// .icon(BitmapDescriptorFactory.fromBitmap(pointBitmap)); | |
| 761 | +//// startMark.anchor(0.5f, 0.55f); | |
| 762 | +// baiduMap.addOverlay(startMark); | |
| 763 | +// } else if (index == listSize - 1) { | |
| 764 | +// //显示当前位置图标 | |
| 765 | +// Bitmap pointBitmap = BitmapUtil.getBitmapFromDp(getContext(), BitmapFactory.decodeResource(getContext().getResources(), R.drawable.icon_end), 30, 30); | |
| 766 | +// endMark = new MarkerOptions() | |
| 767 | +// .position(points.get(points.size() - 1)) | |
| 768 | +// .icon(BitmapDescriptorFactory.fromBitmap(pointBitmap)) | |
| 769 | +// .perspective(true) | |
| 770 | +//// endMark.anchor(0.5f, 0.5f) | |
| 771 | +// .perspective(true); | |
| 772 | +// baiduMap.addOverlay(endMark); | |
| 773 | +// } | |
| 774 | +// //mPloyline 折线对象 | |
| 775 | +// Overlay mPolyline = baiduMap.addOverlay(mOverlayOptions); | |
| 776 | +// MapStatus.Builder builder = new MapStatus.Builder(); | |
| 777 | +// builder.zoom(currentZoom); | |
| 778 | +// baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build())); | |
| 779 | +// | |
| 780 | +// } | |
| 781 | +// } | |
| 782 | +// } | |
| 783 | +// | |
| 784 | +// @Override | |
| 785 | +// public void onGetTransitRouteResult(TransitRouteResult transitRouteResult) { | |
| 786 | +// | |
| 787 | +// } | |
| 788 | +// | |
| 789 | +// @Override | |
| 790 | +// public void onGetMassTransitRouteResult(MassTransitRouteResult massTransitRouteResult) { | |
| 791 | +// | |
| 792 | +// } | |
| 793 | +// | |
| 794 | +// @Override | |
| 795 | +// public void onGetDrivingRouteResult(DrivingRouteResult drivingRouteResult) { | |
| 796 | +// if (fragment.getActivity() == null) { | |
| 797 | +// return; | |
| 798 | +// } | |
| 799 | +// | |
| 800 | +// if (drivingRouteResult == null || drivingRouteResult.error != SearchResult.ERRORNO.NO_ERROR) { | |
| 801 | +// Toast.makeText(fragment.getActivity(), "抱歉,无法获取路线!", Toast.LENGTH_SHORT).show(); | |
| 802 | +// } | |
| 803 | +// if (drivingRouteResult.error == SearchResult.ERRORNO.AMBIGUOUS_ROURE_ADDR) { | |
| 804 | +// // 起终点或途经点地址有岐义,通过以下接口获取建议查询信息 | |
| 805 | +// return; | |
| 806 | +// } | |
| 807 | +// List<LatLng> points = new ArrayList<LatLng>(); | |
| 808 | +// if (drivingRouteResult.getRouteLines() != null) { | |
| 809 | +// if (drivingRouteResult.getRouteLines().get(0).getAllStep().get(0).getWayPoints().size() > 0) { | |
| 810 | +// //添加起点坐标 | |
| 811 | +// if (followMyLocation != null) { | |
| 812 | +// points.add(new LatLng(followMyLocation.latitude, followMyLocation.longitude)); | |
| 813 | +// } | |
| 814 | +// for (int i = 0; i < drivingRouteResult.getRouteLines().get(0).getAllStep().size(); i++) { | |
| 815 | +// for (int j = 0; j < drivingRouteResult.getRouteLines().get(0).getAllStep().get(i).getWayPoints().size(); j++) { | |
| 816 | +// points.add(drivingRouteResult.getRouteLines().get(0).getAllStep().get(i).getWayPoints().get(j)); | |
| 817 | +// } | |
| 818 | +// } | |
| 819 | +// } | |
| 820 | +// //添加终点坐标 | |
| 821 | +// if (endLatLng != null) { | |
| 693 | 822 | // points.add(endLatLng); |
| 694 | - } | |
| 695 | - | |
| 696 | - ArrayList<Integer> traffics = new ArrayList<Integer>(); | |
| 697 | - for (int i = 0; i < points.size(); i++) { | |
| 698 | - if (i % 2 == 0) { | |
| 699 | - traffics.add(i); | |
| 700 | - } | |
| 701 | - } | |
| 702 | - | |
| 703 | - | |
| 704 | - if (points.size() > 0) { | |
| 705 | -// if (baiduMap != null) { | |
| 706 | -// baiduMap.clear(); | |
| 707 | -// if (endLatLng != null) { | |
| 708 | -// markPoi(endLatLng.latitude, endLatLng.longitude); | |
| 709 | -// } | |
| 823 | +// } | |
| 824 | +// if (points.size() > 0) { | |
| 825 | +// if (baiduMap != null) { | |
| 826 | +// baiduMap.clear(); | |
| 827 | +// if (endLatLng != null) { | |
| 828 | +// markPoi(endLatLng.latitude, endLatLng.longitude); | |
| 710 | 829 | // } |
| 711 | - | |
| 712 | - //设置折线的属性 | |
| 830 | +// } | |
| 831 | +// | |
| 832 | +// //设置折线的属性 | |
| 713 | 833 | // OverlayOptions mOverlayOptions = new PolylineOptions() |
| 714 | 834 | // .width(10) |
| 715 | 835 | // .color(0xAAFF0000) |
| 716 | 836 | // .points(points); |
| 717 | - //设置折线的属性 | |
| 718 | - OverlayOptions mOverlayOptions = new PolylineOptions() | |
| 719 | - .width(10) | |
| 720 | - .dottedLine(true) | |
| 721 | - .points(points) | |
| 722 | - .customTextureList(getCustomTextureList()) | |
| 723 | - .textureIndex(traffics);//设置纹理列表 | |
| 724 | - //在地图上绘制起点 | |
| 725 | - if (index == 0) { | |
| 726 | - //显示当前位置图标 | |
| 727 | - Bitmap pointBitmap = BitmapUtil.getBitmapFromDp(getContext(), BitmapFactory.decodeResource(getContext().getResources(), R.drawable.icon_start), 30, 30); | |
| 728 | - startMark = new MarkerOptions() | |
| 729 | - .position(StartPoint) | |
| 730 | - .icon(BitmapDescriptorFactory.fromBitmap(pointBitmap)); | |
| 731 | -// startMark.anchor(0.5f, 0.55f); | |
| 732 | - baiduMap.addOverlay(startMark); | |
| 733 | - } else if (index == listSize - 1) { | |
| 734 | - //显示当前位置图标 | |
| 735 | - Bitmap pointBitmap = BitmapUtil.getBitmapFromDp(getContext(), BitmapFactory.decodeResource(getContext().getResources(), R.drawable.icon_end), 30, 30); | |
| 736 | - endMark = new MarkerOptions() | |
| 737 | - .position(points.get(points.size() - 1)) | |
| 738 | - .icon(BitmapDescriptorFactory.fromBitmap(pointBitmap)) | |
| 739 | - .perspective(true) | |
| 740 | -// endMark.anchor(0.5f, 0.5f) | |
| 741 | - .perspective(true); | |
| 742 | - baiduMap.addOverlay(endMark); | |
| 743 | - } | |
| 744 | - //mPloyline 折线对象 | |
| 745 | - Overlay mPolyline = baiduMap.addOverlay(mOverlayOptions); | |
| 746 | - MapStatus.Builder builder = new MapStatus.Builder(); | |
| 747 | - builder.zoom(currentZoom); | |
| 748 | - baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build())); | |
| 749 | - | |
| 750 | - } | |
| 751 | - } | |
| 752 | - } | |
| 753 | - | |
| 754 | - @Override | |
| 755 | - public void onGetTransitRouteResult(TransitRouteResult transitRouteResult) { | |
| 756 | - | |
| 757 | - } | |
| 758 | - | |
| 759 | - @Override | |
| 760 | - public void onGetMassTransitRouteResult(MassTransitRouteResult massTransitRouteResult) { | |
| 761 | - | |
| 762 | - } | |
| 763 | - | |
| 764 | - @Override | |
| 765 | - public void onGetDrivingRouteResult(DrivingRouteResult drivingRouteResult) { | |
| 766 | - if (fragment.getActivity() == null) { | |
| 767 | - return; | |
| 768 | - } | |
| 769 | - | |
| 770 | - if (drivingRouteResult == null || drivingRouteResult.error != SearchResult.ERRORNO.NO_ERROR) { | |
| 771 | - Toast.makeText(fragment.getActivity(), "抱歉,无法获取路线!", Toast.LENGTH_SHORT).show(); | |
| 772 | - } | |
| 773 | - if (drivingRouteResult.error == SearchResult.ERRORNO.AMBIGUOUS_ROURE_ADDR) { | |
| 774 | - // 起终点或途经点地址有岐义,通过以下接口获取建议查询信息 | |
| 775 | - return; | |
| 776 | - } | |
| 777 | - List<LatLng> points = new ArrayList<LatLng>(); | |
| 778 | - if (drivingRouteResult.getRouteLines() != null) { | |
| 779 | - if (drivingRouteResult.getRouteLines().get(0).getAllStep().get(0).getWayPoints().size() > 0) { | |
| 780 | - //添加起点坐标 | |
| 781 | - if (followMyLocation != null) { | |
| 782 | - points.add(new LatLng(followMyLocation.latitude, followMyLocation.longitude)); | |
| 783 | - } | |
| 784 | - for (int i = 0; i < drivingRouteResult.getRouteLines().get(0).getAllStep().size(); i++) { | |
| 785 | - for (int j = 0; j < drivingRouteResult.getRouteLines().get(0).getAllStep().get(i).getWayPoints().size(); j++) { | |
| 786 | - points.add(drivingRouteResult.getRouteLines().get(0).getAllStep().get(i).getWayPoints().get(j)); | |
| 787 | - } | |
| 788 | - } | |
| 789 | - } | |
| 790 | - //添加终点坐标 | |
| 791 | - if (endLatLng != null) { | |
| 792 | - points.add(endLatLng); | |
| 793 | - } | |
| 794 | - if (points.size() > 0) { | |
| 795 | - if (baiduMap != null) { | |
| 796 | - baiduMap.clear(); | |
| 797 | - if (endLatLng != null) { | |
| 798 | - markPoi(endLatLng.latitude, endLatLng.longitude); | |
| 799 | - } | |
| 800 | - } | |
| 801 | - | |
| 802 | - //设置折线的属性 | |
| 803 | - OverlayOptions mOverlayOptions = new PolylineOptions() | |
| 804 | - .width(10) | |
| 805 | - .color(0xAAFF0000) | |
| 806 | - .points(points); | |
| 807 | - //在地图上绘制折线 | |
| 808 | - //mPloyline 折线对象 | |
| 809 | - Overlay mPolyline = baiduMap.addOverlay(mOverlayOptions); | |
| 810 | - MapStatus.Builder builder = new MapStatus.Builder(); | |
| 811 | - builder.zoom(currentZoom); | |
| 812 | - baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build())); | |
| 813 | - | |
| 814 | - } | |
| 815 | - } | |
| 816 | - } | |
| 817 | - | |
| 818 | - @Override | |
| 819 | - public void onGetIndoorRouteResult(IndoorRouteResult indoorRouteResult) { | |
| 820 | - | |
| 821 | - } | |
| 822 | - | |
| 823 | - @Override | |
| 824 | - public void onGetBikingRouteResult(BikingRouteResult bikingRouteResult) { | |
| 825 | - | |
| 826 | - } | |
| 827 | - }); | |
| 828 | - //开始检索 | |
| 837 | +// //在地图上绘制折线 | |
| 838 | +// //mPloyline 折线对象 | |
| 839 | +// Overlay mPolyline = baiduMap.addOverlay(mOverlayOptions); | |
| 840 | +// MapStatus.Builder builder = new MapStatus.Builder(); | |
| 841 | +// builder.zoom(currentZoom); | |
| 842 | +// baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build())); | |
| 843 | +// | |
| 844 | +// } | |
| 845 | +// } | |
| 846 | +// } | |
| 847 | +// | |
| 848 | +// @Override | |
| 849 | +// public void onGetIndoorRouteResult(IndoorRouteResult indoorRouteResult) { | |
| 850 | +// | |
| 851 | +// } | |
| 852 | +// | |
| 853 | +// @Override | |
| 854 | +// public void onGetBikingRouteResult(BikingRouteResult bikingRouteResult) { | |
| 855 | +// | |
| 856 | +// } | |
| 857 | +// }); | |
| 858 | + //开始检索 | |
| 829 | 859 | // routePlanSearch.drivingSearch((new DrivingRoutePlanOption()) |
| 830 | 860 | // .from(stNode).to(enNode).policy(DrivingRoutePlanOption.DrivingPolicy.ECAR_DIS_FIRST) |
| 831 | 861 | // .trafficPolicy(DrivingRoutePlanOption.DrivingTrafficPolicy.ROUTE_PATH_AND_TRAFFIC)); |
| 832 | 862 | |
| 833 | - //开始步行检索 | |
| 834 | - routePlanSearch.walkingSearch((new WalkingRoutePlanOption()) | |
| 835 | - .from(stNode) | |
| 836 | - .to(enNode)); | |
| 837 | - } | |
| 863 | + //开始步行检索 | |
| 864 | +// routePlanSearch.walkingSearch((new WalkingRoutePlanOption()) | |
| 865 | +// .from(stNode) | |
| 866 | +// .to(enNode)); | |
| 867 | +// } | |
| 838 | 868 | // showProgressDialog(); |
| 839 | 869 | |
| 840 | 870 | /** |
| ... | ... | @@ -989,12 +1019,12 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 989 | 1019 | } |
| 990 | 1020 | if (isFirstLoc) { |
| 991 | 1021 | isFirstLoc = false; |
| 992 | - if (location.getRadius() > 20) { | |
| 1022 | + if (location.getRadius() > Constant.LOCA_ACCURACY) { | |
| 993 | 1023 | Toast.makeText(getContext(), "当前定位精度为:" + location.getRadius() + "米,请您移动至空旷地带!", Toast.LENGTH_SHORT).show(); |
| 994 | 1024 | } |
| 995 | 1025 | } else { |
| 996 | 1026 | //过滤定位精度 |
| 997 | - if (location.getRadius() > 20) { | |
| 1027 | + if (location.getRadius() > Constant.LOCA_ACCURACY) { | |
| 998 | 1028 | return; |
| 999 | 1029 | } |
| 1000 | 1030 | } | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunningMapFragmentView.java
| ... | ... | @@ -9,6 +9,7 @@ import android.hardware.SensorEventListener; |
| 9 | 9 | import android.hardware.SensorManager; |
| 10 | 10 | import android.os.Handler; |
| 11 | 11 | import android.os.SystemClock; |
| 12 | +import android.text.TextUtils; | |
| 12 | 13 | import android.util.Log; |
| 13 | 14 | import android.view.MotionEvent; |
| 14 | 15 | import android.view.View; |
| ... | ... | @@ -35,8 +36,12 @@ import com.baidu.mapapi.model.LatLng; |
| 35 | 36 | import com.baidu.mapapi.model.LatLngBounds; |
| 36 | 37 | import com.baidu.mapapi.utils.DistanceUtil; |
| 37 | 38 | import com.baidu.trace.model.SortType; |
| 39 | +import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | |
| 40 | +import com.cnlive.moudle.pedometer.model.Constant; | |
| 38 | 41 | import com.cnlive.moudle.pedometer.model.RunningMapBean; |
| 42 | +import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; | |
| 39 | 43 | import com.cnlive.moudle.pedometer.ui.fragment.RunningMapFragment; |
| 44 | +import com.cnlive.moudle.pedometer.ui.widget.TipDialog; | |
| 40 | 45 | import com.cnlive.moudle.pedometer.utils.BitmapUtil; |
| 41 | 46 | import com.cnlive.moudle.pedometer.utils.ButtonAnimUtil; |
| 42 | 47 | import com.cnlive.moudle.pedometer.utils.GsonUtil; |
| ... | ... | @@ -75,6 +80,9 @@ public class RunningMapFragmentView implements MvpView, SensorEventListener { |
| 75 | 80 | private boolean isFirstLoadMap = true; |
| 76 | 81 | private Overlay currentLine; |
| 77 | 82 | private List<LatLng> currentPoints; |
| 83 | + private LatLng endLatLng;//终点坐标 | |
| 84 | + private UserStepEntity userStepEntity; | |
| 85 | + private TipDialog tipDialog; | |
| 78 | 86 | |
| 79 | 87 | public RunningMapFragmentView(RunningMapFragment fragment) { |
| 80 | 88 | this.fragment = fragment; |
| ... | ... | @@ -85,6 +93,10 @@ public class RunningMapFragmentView implements MvpView, SensorEventListener { |
| 85 | 93 | } |
| 86 | 94 | |
| 87 | 95 | public void initView() { |
| 96 | + if (getContext() == null) { | |
| 97 | + return; | |
| 98 | + } | |
| 99 | + userStepEntity = StepUtil.getUserStepData(getContext(), CommonInfo.getUserId(getContext())); | |
| 88 | 100 | currentPoints = new ArrayList<>(); |
| 89 | 101 | initMap(); |
| 90 | 102 | //返回键 |
| ... | ... | @@ -237,7 +249,7 @@ public class RunningMapFragmentView implements MvpView, SensorEventListener { |
| 237 | 249 | @Override |
| 238 | 250 | public void onReceiveLocation(BDLocation location) { |
| 239 | 251 | // map view 销毁后不在处理新接收的位置 |
| 240 | - if (location == null || mMapView == null) { | |
| 252 | + if (location == null || mMapView == null || getContext() == null) { | |
| 241 | 253 | return; |
| 242 | 254 | } |
| 243 | 255 | |
| ... | ... | @@ -293,17 +305,60 @@ public class RunningMapFragmentView implements MvpView, SensorEventListener { |
| 293 | 305 | |
| 294 | 306 | if (isFirstLoc) { |
| 295 | 307 | isFirstLoc = false; |
| 296 | - if (location.getRadius() > 20) { | |
| 308 | + if (location.getRadius() > Constant.LOCA_ACCURACY) { | |
| 297 | 309 | Toast.makeText(getContext(), "当前定位精度为:" + location.getRadius() + "米,请您移动至空旷地带!", Toast.LENGTH_SHORT).show(); |
| 298 | 310 | } |
| 299 | 311 | |
| 300 | 312 | |
| 301 | 313 | } else { |
| 302 | 314 | //过滤定位精度 |
| 303 | - if (location.getRadius() > 20) { | |
| 315 | + if (location.getRadius() > Constant.LOCA_ACCURACY) { | |
| 304 | 316 | return; |
| 305 | 317 | } |
| 306 | 318 | } |
| 319 | + | |
| 320 | + //进行数据比较(先看看数据库是否有数据) | |
| 321 | + if (null == endLatLng) { | |
| 322 | + if (null == userStepEntity) { | |
| 323 | + userStepEntity = StepUtil.getUserStepData(getContext(), CommonInfo.getUserId(getContext())); | |
| 324 | + } | |
| 325 | + if (null != userStepEntity) { | |
| 326 | + if (!TextUtils.isEmpty(userStepEntity.getEndLatLng())) { | |
| 327 | + endLatLng = GsonUtil.GsonToBean(userStepEntity.getEndLatLng(), LatLng.class); | |
| 328 | + } | |
| 329 | + } | |
| 330 | + } | |
| 331 | + //开始比较 | |
| 332 | + if (null != endLatLng) { | |
| 333 | + LatLng current = new LatLng(location.getLatitude(), location.getLongitude()); | |
| 334 | + if (null != current) { | |
| 335 | + //开始比较数据 | |
| 336 | + double distance = DistanceUtil.getDistance(current, endLatLng); | |
| 337 | + if (distance < Constant.LOCA_END_POINT_ACCURACY) { | |
| 338 | + //设置数据 | |
| 339 | + if (userStepEntity != null) { | |
| 340 | + userStepEntity.setIsArriveEndPoint(true); | |
| 341 | + //更新数据 | |
| 342 | + StepUtil.updateStepData(getContext(), userStepEntity); | |
| 343 | + } | |
| 344 | + //进行提示 | |
| 345 | + if (null == tipDialog) { | |
| 346 | + tipDialog = new TipDialog(getContext(), getContext().getResources().getString(R.string.run_race_arrive_end_tip), "好的", R.color.green_round, new TipDialog.DialogInterface() { | |
| 347 | + @Override | |
| 348 | + public void onClick(TipDialog dialog) { | |
| 349 | + dialog.dismiss(); | |
| 350 | + } | |
| 351 | + }); | |
| 352 | + tipDialog.setCancelable(false); | |
| 353 | + tipDialog.setCanceledOnTouchOutside(false); | |
| 354 | + } | |
| 355 | + if (!tipDialog.isShowing()) { | |
| 356 | + tipDialog.show(); | |
| 357 | + } | |
| 358 | + } | |
| 359 | + } | |
| 360 | + } | |
| 361 | + | |
| 307 | 362 | mCurrentAccracy = location.getRadius(); |
| 308 | 363 | mylocation = new MyLocationData.Builder() |
| 309 | 364 | .accuracy(location.getRadius()) | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/SelfRecordView.java
| ... | ... | @@ -2,6 +2,7 @@ package com.cnlive.moudle.pedometer.frame.view; |
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | import android.support.v7.widget.LinearLayoutManager; |
| 5 | +import android.text.TextUtils; | |
| 5 | 6 | import android.view.View; |
| 6 | 7 | |
| 7 | 8 | import com.cnlive.libs.base.util.AlertUtil; |
| ... | ... | @@ -90,11 +91,19 @@ public class SelfRecordView implements MvpView { |
| 90 | 91 | runningFinishBean.setUserFinishTime(bean.getEndTime()); |
| 91 | 92 | //设置用户是否完成 |
| 92 | 93 | runningFinishBean.setIsFinish(bean.getCompleteStatus() + ""); |
| 93 | - | |
| 94 | + //设置是否暂停 | |
| 95 | + if (!TextUtils.isEmpty(bean.getPauseTime())) { | |
| 96 | + runningFinishBean.setPause(true); | |
| 97 | + //设置暂停时间 | |
| 98 | + runningFinishBean.setUserPauseTime(bean.getPauseTime()); | |
| 99 | + //设置用户继续时间 | |
| 100 | + runningFinishBean.setUserContinueTime(bean.getContinueTime()); | |
| 101 | + } | |
| 94 | 102 | //设置起点 |
| 95 | 103 | ALLScoreDetailActivity.startActivity(fragment.getActivity(), runningFinishBean); |
| 96 | 104 | |
| 97 | - } } | |
| 105 | + } | |
| 106 | + } | |
| 98 | 107 | }); |
| 99 | 108 | } else { |
| 100 | 109 | adapter.notifyDataSetChanged(); |
| ... | ... | @@ -111,13 +120,19 @@ public class SelfRecordView implements MvpView { |
| 111 | 120 | |
| 112 | 121 | SelfRecordInfo.RecordSumBean recordSumBean = selfRecordInfoBaseInfo.getData().getRecordSum(); |
| 113 | 122 | fragment.binding.kilometerNum.setText(recordSumBean.getCountMileage() + ""); |
| 114 | - if(recordSumBean.getYetStep() != null)fragment.binding.stepNum.setText(recordSumBean.getYetStep()); | |
| 115 | - if(recordSumBean.getYetEmployTime() != null)fragment.binding.allTime.setText(TimeUtil.stampToChronometers(Double.parseDouble(recordSumBean.getYetEmployTime()))); | |
| 116 | - if(recordSumBean.getYetNumber() != null)fragment.binding.finishNum.setText(recordSumBean.getYetNumber()); | |
| 117 | - | |
| 118 | - if(recordSumBean.getNotStep() != null)fragment.binding.stepNumNo.setText(recordSumBean.getNotStep()); | |
| 119 | - if(recordSumBean.getNotEmployTime() != null)fragment.binding.allTimeNo.setText(TimeUtil.stampToChronometers(Double.parseDouble(recordSumBean.getNotEmployTime()))); | |
| 120 | - if(recordSumBean.getNotNumber() != null)fragment.binding.finishNumNo.setText(recordSumBean.getNotNumber()); | |
| 123 | + if (recordSumBean.getYetStep() != null) | |
| 124 | + fragment.binding.stepNum.setText(recordSumBean.getYetStep()); | |
| 125 | + if (recordSumBean.getYetEmployTime() != null) | |
| 126 | + fragment.binding.allTime.setText(TimeUtil.stampToChronometers(Double.parseDouble(recordSumBean.getYetEmployTime()))); | |
| 127 | + if (recordSumBean.getYetNumber() != null) | |
| 128 | + fragment.binding.finishNum.setText(recordSumBean.getYetNumber()); | |
| 129 | + | |
| 130 | + if (recordSumBean.getNotStep() != null) | |
| 131 | + fragment.binding.stepNumNo.setText(recordSumBean.getNotStep()); | |
| 132 | + if (recordSumBean.getNotEmployTime() != null) | |
| 133 | + fragment.binding.allTimeNo.setText(TimeUtil.stampToChronometers(Double.parseDouble(recordSumBean.getNotEmployTime()))); | |
| 134 | + if (recordSumBean.getNotNumber() != null) | |
| 135 | + fragment.binding.finishNumNo.setText(recordSumBean.getNotNumber()); | |
| 121 | 136 | |
| 122 | 137 | if (selfRecordInfoBaseInfo.getData().getEventRouteRecordBeanVoList().size() < fragment.pageSize) { |
| 123 | 138 | fragment.binding.refreshLayout.setEnableLoadMore(false); | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/model/Constant.java
| ... | ... | @@ -20,4 +20,8 @@ public class Constant { |
| 20 | 20 | public static final int REGISTRATION_SUCCESS = 11;//用户报名成功 |
| 21 | 21 | public static final double PASS_RATE = 0.7;//通过率70% |
| 22 | 22 | public static final int CHECK_ACCURACY = 50;//判断用户是否完成的精度范围 |
| 23 | + public static final int LOCA_ACCURACY = 20;//定位过滤精度 | |
| 24 | + public static final int LOCA_END_POINT_ACCURACY = 20;//终点位置比较精度 | |
| 25 | + public static final int LOCA_START_POINT_ACCURACY = 200;//起点位置比较精度 | |
| 26 | + | |
| 23 | 27 | } | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/model/RunningFinishBean.java
| ... | ... | @@ -21,8 +21,36 @@ public class RunningFinishBean implements Serializable { |
| 21 | 21 | private String isFinish; |
| 22 | 22 | private String roadmap; |
| 23 | 23 | private String streetTitle; |
| 24 | + //****************************后续添加的,用于我的记录详情页跳转 | |
| 24 | 25 | private String userStartTime; |
| 25 | 26 | private String userFinishTime; |
| 27 | + private boolean isPause; | |
| 28 | + private String userPauseTime; | |
| 29 | + private String userContinueTime; | |
| 30 | + | |
| 31 | + public boolean isPause() { | |
| 32 | + return isPause; | |
| 33 | + } | |
| 34 | + | |
| 35 | + public void setPause(boolean pause) { | |
| 36 | + isPause = pause; | |
| 37 | + } | |
| 38 | + | |
| 39 | + public String getUserPauseTime() { | |
| 40 | + return userPauseTime; | |
| 41 | + } | |
| 42 | + | |
| 43 | + public void setUserPauseTime(String userPauseTime) { | |
| 44 | + this.userPauseTime = userPauseTime; | |
| 45 | + } | |
| 46 | + | |
| 47 | + public String getUserContinueTime() { | |
| 48 | + return userContinueTime; | |
| 49 | + } | |
| 50 | + | |
| 51 | + public void setUserContinueTime(String userContinueTime) { | |
| 52 | + this.userContinueTime = userContinueTime; | |
| 53 | + } | |
| 26 | 54 | |
| 27 | 55 | public String getUserStartTime() { |
| 28 | 56 | return userStartTime; | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/net/bean/EventRouteRecordBeanVoListBean.java
| ... | ... | @@ -30,6 +30,24 @@ public class EventRouteRecordBeanVoListBean { |
| 30 | 30 | private String startLocation; |
| 31 | 31 | private String endLocation; |
| 32 | 32 | private int completeStatus; |
| 33 | + private String pauseTime; | |
| 34 | + private String continueTime; | |
| 35 | + | |
| 36 | + public String getPauseTime() { | |
| 37 | + return pauseTime; | |
| 38 | + } | |
| 39 | + | |
| 40 | + public void setPauseTime(String pauseTime) { | |
| 41 | + this.pauseTime = pauseTime; | |
| 42 | + } | |
| 43 | + | |
| 44 | + public String getContinueTime() { | |
| 45 | + return continueTime; | |
| 46 | + } | |
| 47 | + | |
| 48 | + public void setContinueTime(String continueTime) { | |
| 49 | + this.continueTime = continueTime; | |
| 50 | + } | |
| 33 | 51 | |
| 34 | 52 | public String getStartTime() { |
| 35 | 53 | return startTime; | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/net/bean/RunRaceDetailInfo.java
| 1 | 1 | package com.cnlive.moudle.pedometer.net.bean; |
| 2 | 2 | |
| 3 | +import com.baidu.mapapi.model.LatLng; | |
| 4 | + | |
| 3 | 5 | import java.io.Serializable; |
| 4 | 6 | import java.util.List; |
| 5 | 7 | |
| ... | ... | @@ -84,6 +86,15 @@ public class RunRaceDetailInfo implements Serializable { |
| 84 | 86 | private String userMileage; |
| 85 | 87 | private List<String> faceUrl; |
| 86 | 88 | private List<String> finishFaceUrl; |
| 89 | + private String endLatLng;//终点坐标,后加的,不是后台返回,这是从百度历史轨迹查出来的 | |
| 90 | + | |
| 91 | + public String getEndLatLng() { | |
| 92 | + return endLatLng; | |
| 93 | + } | |
| 94 | + | |
| 95 | + public void setEndLatLng(String endLatLng) { | |
| 96 | + this.endLatLng = endLatLng; | |
| 97 | + } | |
| 87 | 98 | |
| 88 | 99 | public String getAddress() { |
| 89 | 100 | return address; | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/service/StepService.java
| ... | ... | @@ -369,7 +369,10 @@ public class StepService extends Service implements SensorEventListener { |
| 369 | 369 | return; |
| 370 | 370 | } |
| 371 | 371 | UserStepEntity userStepEntity = StepUtil.getUserStepData(getApplicationContext(), CommonInfo.getUserId(getApplicationContext())); |
| 372 | - if (userStepEntity == null) { | |
| 372 | + if (null == userStepEntity) { | |
| 373 | + return; | |
| 374 | + } | |
| 375 | + if (userStepEntity.getFenceId() == 0) { | |
| 373 | 376 | return; |
| 374 | 377 | } |
| 375 | 378 | if (alarmPushInfo.getFenceId() == userStepEntity.getFenceId()) { | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/sql/dao/FailedEntityDao.java
| ... | ... | @@ -45,6 +45,7 @@ public class FailedEntityDao extends AbstractDao<FailedEntity, String> { |
| 45 | 45 | public final static Property StreetId = new Property(18, String.class, "streetId", false, "STREET_ID"); |
| 46 | 46 | public final static Property StreetTitle = new Property(19, String.class, "streetTitle", false, "STREET_TITLE"); |
| 47 | 47 | public final static Property CreatTimeStamp = new Property(20, long.class, "creatTimeStamp", false, "CREAT_TIME_STAMP"); |
| 48 | + public final static Property IsArriveEndPoint = new Property(21, boolean.class, "isArriveEndPoint", false, "IS_ARRIVE_END_POINT"); | |
| 48 | 49 | } |
| 49 | 50 | |
| 50 | 51 | |
| ... | ... | @@ -80,7 +81,8 @@ public class FailedEntityDao extends AbstractDao<FailedEntity, String> { |
| 80 | 81 | "\"IMPORT_POINT\" TEXT," + // 17: importPoint |
| 81 | 82 | "\"STREET_ID\" TEXT," + // 18: streetId |
| 82 | 83 | "\"STREET_TITLE\" TEXT," + // 19: streetTitle |
| 83 | - "\"CREAT_TIME_STAMP\" INTEGER NOT NULL );"); // 20: creatTimeStamp | |
| 84 | + "\"CREAT_TIME_STAMP\" INTEGER NOT NULL ," + // 20: creatTimeStamp | |
| 85 | + "\"IS_ARRIVE_END_POINT\" INTEGER NOT NULL );"); // 21: isArriveEndPoint | |
| 84 | 86 | } |
| 85 | 87 | |
| 86 | 88 | /** Drops the underlying database table. */ |
| ... | ... | @@ -165,6 +167,7 @@ public class FailedEntityDao extends AbstractDao<FailedEntity, String> { |
| 165 | 167 | stmt.bindString(20, streetTitle); |
| 166 | 168 | } |
| 167 | 169 | stmt.bindLong(21, entity.getCreatTimeStamp()); |
| 170 | + stmt.bindLong(22, entity.getIsArriveEndPoint() ? 1L: 0L); | |
| 168 | 171 | } |
| 169 | 172 | |
| 170 | 173 | @Override |
| ... | ... | @@ -243,6 +246,7 @@ public class FailedEntityDao extends AbstractDao<FailedEntity, String> { |
| 243 | 246 | stmt.bindString(20, streetTitle); |
| 244 | 247 | } |
| 245 | 248 | stmt.bindLong(21, entity.getCreatTimeStamp()); |
| 249 | + stmt.bindLong(22, entity.getIsArriveEndPoint() ? 1L: 0L); | |
| 246 | 250 | } |
| 247 | 251 | |
| 248 | 252 | @Override |
| ... | ... | @@ -273,7 +277,8 @@ public class FailedEntityDao extends AbstractDao<FailedEntity, String> { |
| 273 | 277 | cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // importPoint |
| 274 | 278 | cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // streetId |
| 275 | 279 | cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // streetTitle |
| 276 | - cursor.getLong(offset + 20) // creatTimeStamp | |
| 280 | + cursor.getLong(offset + 20), // creatTimeStamp | |
| 281 | + cursor.getShort(offset + 21) != 0 // isArriveEndPoint | |
| 277 | 282 | ); |
| 278 | 283 | return entity; |
| 279 | 284 | } |
| ... | ... | @@ -301,6 +306,7 @@ public class FailedEntityDao extends AbstractDao<FailedEntity, String> { |
| 301 | 306 | entity.setStreetId(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); |
| 302 | 307 | entity.setStreetTitle(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); |
| 303 | 308 | entity.setCreatTimeStamp(cursor.getLong(offset + 20)); |
| 309 | + entity.setIsArriveEndPoint(cursor.getShort(offset + 21) != 0); | |
| 304 | 310 | } |
| 305 | 311 | |
| 306 | 312 | @Override | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/sql/dao/UserStepEntityDao.java
| ... | ... | @@ -27,25 +27,26 @@ public class UserStepEntityDao extends AbstractDao<UserStepEntity, String> { |
| 27 | 27 | public final static Property UserId = new Property(0, String.class, "userId", true, "USER_ID"); |
| 28 | 28 | public final static Property Date = new Property(1, String.class, "date", false, "DATE"); |
| 29 | 29 | public final static Property StepCount = new Property(2, String.class, "stepCount", false, "STEP_COUNT"); |
| 30 | - public final static Property PauseTimeStamp = new Property(3, long.class, "pauseTimeStamp", false, "PAUSE_TIME_STAMP"); | |
| 31 | - public final static Property RecordTime = new Property(4, long.class, "recordTime", false, "RECORD_TIME"); | |
| 32 | - public final static Property CaloriesCount = new Property(5, double.class, "caloriesCount", false, "CALORIES_COUNT"); | |
| 33 | - public final static Property ServerTraceData = new Property(6, String.class, "serverTraceData", false, "SERVER_TRACE_DATA"); | |
| 34 | - public final static Property StartPoint = new Property(7, String.class, "startPoint", false, "START_POINT"); | |
| 35 | - public final static Property EndPoint = new Property(8, String.class, "endPoint", false, "END_POINT"); | |
| 36 | - public final static Property StartTimeStamp = new Property(9, long.class, "startTimeStamp", false, "START_TIME_STAMP"); | |
| 37 | - public final static Property FinishTimeStamp = new Property(10, long.class, "finishTimeStamp", false, "FINISH_TIME_STAMP"); | |
| 38 | - public final static Property StreetId = new Property(11, String.class, "streetId", false, "STREET_ID"); | |
| 39 | - public final static Property PauseCount = new Property(12, int.class, "pauseCount", false, "PAUSE_COUNT"); | |
| 40 | - public final static Property UserPauseTimeStamp = new Property(13, long.class, "userPauseTimeStamp", false, "USER_PAUSE_TIME_STAMP"); | |
| 41 | - public final static Property ChronometerBase = new Property(14, long.class, "chronometerBase", false, "CHRONOMETER_BASE"); | |
| 42 | - public final static Property QueryTraceStartTime = new Property(15, long.class, "queryTraceStartTime", false, "QUERY_TRACE_START_TIME"); | |
| 43 | - public final static Property QueryTraceEndTime = new Property(16, long.class, "queryTraceEndTime", false, "QUERY_TRACE_END_TIME"); | |
| 44 | - public final static Property QueryEntityName = new Property(17, String.class, "queryEntityName", false, "QUERY_ENTITY_NAME"); | |
| 45 | - public final static Property ContinueTime = new Property(18, long.class, "continueTime", false, "CONTINUE_TIME"); | |
| 46 | - public final static Property FenceId = new Property(19, long.class, "fenceId", false, "FENCE_ID"); | |
| 47 | - public final static Property ImportPoint = new Property(20, String.class, "importPoint", false, "IMPORT_POINT"); | |
| 48 | - public final static Property StreetTitle = new Property(21, String.class, "streetTitle", false, "STREET_TITLE"); | |
| 30 | + public final static Property RecordTime = new Property(3, long.class, "recordTime", false, "RECORD_TIME"); | |
| 31 | + public final static Property CaloriesCount = new Property(4, double.class, "caloriesCount", false, "CALORIES_COUNT"); | |
| 32 | + public final static Property ServerTraceData = new Property(5, String.class, "serverTraceData", false, "SERVER_TRACE_DATA"); | |
| 33 | + public final static Property StartPoint = new Property(6, String.class, "startPoint", false, "START_POINT"); | |
| 34 | + public final static Property EndPoint = new Property(7, String.class, "endPoint", false, "END_POINT"); | |
| 35 | + public final static Property StartTimeStamp = new Property(8, long.class, "startTimeStamp", false, "START_TIME_STAMP"); | |
| 36 | + public final static Property FinishTimeStamp = new Property(9, long.class, "finishTimeStamp", false, "FINISH_TIME_STAMP"); | |
| 37 | + public final static Property StreetId = new Property(10, String.class, "streetId", false, "STREET_ID"); | |
| 38 | + public final static Property PauseCount = new Property(11, int.class, "pauseCount", false, "PAUSE_COUNT"); | |
| 39 | + public final static Property UserPauseTimeStamp = new Property(12, long.class, "userPauseTimeStamp", false, "USER_PAUSE_TIME_STAMP"); | |
| 40 | + public final static Property ChronometerBase = new Property(13, long.class, "chronometerBase", false, "CHRONOMETER_BASE"); | |
| 41 | + public final static Property QueryTraceStartTime = new Property(14, long.class, "queryTraceStartTime", false, "QUERY_TRACE_START_TIME"); | |
| 42 | + public final static Property QueryTraceEndTime = new Property(15, long.class, "queryTraceEndTime", false, "QUERY_TRACE_END_TIME"); | |
| 43 | + public final static Property QueryEntityName = new Property(16, String.class, "queryEntityName", false, "QUERY_ENTITY_NAME"); | |
| 44 | + public final static Property ContinueTime = new Property(17, long.class, "continueTime", false, "CONTINUE_TIME"); | |
| 45 | + public final static Property FenceId = new Property(18, long.class, "fenceId", false, "FENCE_ID"); | |
| 46 | + public final static Property ImportPoint = new Property(19, String.class, "importPoint", false, "IMPORT_POINT"); | |
| 47 | + public final static Property StreetTitle = new Property(20, String.class, "streetTitle", false, "STREET_TITLE"); | |
| 48 | + public final static Property EndLatLng = new Property(21, String.class, "endLatLng", false, "END_LAT_LNG"); | |
| 49 | + public final static Property IsArriveEndPoint = new Property(22, boolean.class, "isArriveEndPoint", false, "IS_ARRIVE_END_POINT"); | |
| 49 | 50 | } |
| 50 | 51 | |
| 51 | 52 | |
| ... | ... | @@ -64,25 +65,26 @@ public class UserStepEntityDao extends AbstractDao<UserStepEntity, String> { |
| 64 | 65 | "\"USER_ID\" TEXT PRIMARY KEY NOT NULL ," + // 0: userId |
| 65 | 66 | "\"DATE\" TEXT," + // 1: date |
| 66 | 67 | "\"STEP_COUNT\" TEXT," + // 2: stepCount |
| 67 | - "\"PAUSE_TIME_STAMP\" INTEGER NOT NULL ," + // 3: pauseTimeStamp | |
| 68 | - "\"RECORD_TIME\" INTEGER NOT NULL ," + // 4: recordTime | |
| 69 | - "\"CALORIES_COUNT\" REAL NOT NULL ," + // 5: caloriesCount | |
| 70 | - "\"SERVER_TRACE_DATA\" TEXT," + // 6: serverTraceData | |
| 71 | - "\"START_POINT\" TEXT," + // 7: startPoint | |
| 72 | - "\"END_POINT\" TEXT," + // 8: endPoint | |
| 73 | - "\"START_TIME_STAMP\" INTEGER NOT NULL ," + // 9: startTimeStamp | |
| 74 | - "\"FINISH_TIME_STAMP\" INTEGER NOT NULL ," + // 10: finishTimeStamp | |
| 75 | - "\"STREET_ID\" TEXT," + // 11: streetId | |
| 76 | - "\"PAUSE_COUNT\" INTEGER NOT NULL ," + // 12: pauseCount | |
| 77 | - "\"USER_PAUSE_TIME_STAMP\" INTEGER NOT NULL ," + // 13: userPauseTimeStamp | |
| 78 | - "\"CHRONOMETER_BASE\" INTEGER NOT NULL ," + // 14: chronometerBase | |
| 79 | - "\"QUERY_TRACE_START_TIME\" INTEGER NOT NULL ," + // 15: queryTraceStartTime | |
| 80 | - "\"QUERY_TRACE_END_TIME\" INTEGER NOT NULL ," + // 16: queryTraceEndTime | |
| 81 | - "\"QUERY_ENTITY_NAME\" TEXT," + // 17: queryEntityName | |
| 82 | - "\"CONTINUE_TIME\" INTEGER NOT NULL ," + // 18: continueTime | |
| 83 | - "\"FENCE_ID\" INTEGER NOT NULL ," + // 19: fenceId | |
| 84 | - "\"IMPORT_POINT\" TEXT," + // 20: importPoint | |
| 85 | - "\"STREET_TITLE\" TEXT);"); // 21: streetTitle | |
| 68 | + "\"RECORD_TIME\" INTEGER NOT NULL ," + // 3: recordTime | |
| 69 | + "\"CALORIES_COUNT\" REAL NOT NULL ," + // 4: caloriesCount | |
| 70 | + "\"SERVER_TRACE_DATA\" TEXT," + // 5: serverTraceData | |
| 71 | + "\"START_POINT\" TEXT," + // 6: startPoint | |
| 72 | + "\"END_POINT\" TEXT," + // 7: endPoint | |
| 73 | + "\"START_TIME_STAMP\" INTEGER NOT NULL ," + // 8: startTimeStamp | |
| 74 | + "\"FINISH_TIME_STAMP\" INTEGER NOT NULL ," + // 9: finishTimeStamp | |
| 75 | + "\"STREET_ID\" TEXT," + // 10: streetId | |
| 76 | + "\"PAUSE_COUNT\" INTEGER NOT NULL ," + // 11: pauseCount | |
| 77 | + "\"USER_PAUSE_TIME_STAMP\" INTEGER NOT NULL ," + // 12: userPauseTimeStamp | |
| 78 | + "\"CHRONOMETER_BASE\" INTEGER NOT NULL ," + // 13: chronometerBase | |
| 79 | + "\"QUERY_TRACE_START_TIME\" INTEGER NOT NULL ," + // 14: queryTraceStartTime | |
| 80 | + "\"QUERY_TRACE_END_TIME\" INTEGER NOT NULL ," + // 15: queryTraceEndTime | |
| 81 | + "\"QUERY_ENTITY_NAME\" TEXT," + // 16: queryEntityName | |
| 82 | + "\"CONTINUE_TIME\" INTEGER NOT NULL ," + // 17: continueTime | |
| 83 | + "\"FENCE_ID\" INTEGER NOT NULL ," + // 18: fenceId | |
| 84 | + "\"IMPORT_POINT\" TEXT," + // 19: importPoint | |
| 85 | + "\"STREET_TITLE\" TEXT," + // 20: streetTitle | |
| 86 | + "\"END_LAT_LNG\" TEXT," + // 21: endLatLng | |
| 87 | + "\"IS_ARRIVE_END_POINT\" INTEGER NOT NULL );"); // 22: isArriveEndPoint | |
| 86 | 88 | } |
| 87 | 89 | |
| 88 | 90 | /** Drops the underlying database table. */ |
| ... | ... | @@ -109,53 +111,58 @@ public class UserStepEntityDao extends AbstractDao<UserStepEntity, String> { |
| 109 | 111 | if (stepCount != null) { |
| 110 | 112 | stmt.bindString(3, stepCount); |
| 111 | 113 | } |
| 112 | - stmt.bindLong(4, entity.getPauseTimeStamp()); | |
| 113 | - stmt.bindLong(5, entity.getRecordTime()); | |
| 114 | - stmt.bindDouble(6, entity.getCaloriesCount()); | |
| 114 | + stmt.bindLong(4, entity.getRecordTime()); | |
| 115 | + stmt.bindDouble(5, entity.getCaloriesCount()); | |
| 115 | 116 | |
| 116 | 117 | String serverTraceData = entity.getServerTraceData(); |
| 117 | 118 | if (serverTraceData != null) { |
| 118 | - stmt.bindString(7, serverTraceData); | |
| 119 | + stmt.bindString(6, serverTraceData); | |
| 119 | 120 | } |
| 120 | 121 | |
| 121 | 122 | String startPoint = entity.getStartPoint(); |
| 122 | 123 | if (startPoint != null) { |
| 123 | - stmt.bindString(8, startPoint); | |
| 124 | + stmt.bindString(7, startPoint); | |
| 124 | 125 | } |
| 125 | 126 | |
| 126 | 127 | String endPoint = entity.getEndPoint(); |
| 127 | 128 | if (endPoint != null) { |
| 128 | - stmt.bindString(9, endPoint); | |
| 129 | + stmt.bindString(8, endPoint); | |
| 129 | 130 | } |
| 130 | - stmt.bindLong(10, entity.getStartTimeStamp()); | |
| 131 | - stmt.bindLong(11, entity.getFinishTimeStamp()); | |
| 131 | + stmt.bindLong(9, entity.getStartTimeStamp()); | |
| 132 | + stmt.bindLong(10, entity.getFinishTimeStamp()); | |
| 132 | 133 | |
| 133 | 134 | String streetId = entity.getStreetId(); |
| 134 | 135 | if (streetId != null) { |
| 135 | - stmt.bindString(12, streetId); | |
| 136 | + stmt.bindString(11, streetId); | |
| 136 | 137 | } |
| 137 | - stmt.bindLong(13, entity.getPauseCount()); | |
| 138 | - stmt.bindLong(14, entity.getUserPauseTimeStamp()); | |
| 139 | - stmt.bindLong(15, entity.getChronometerBase()); | |
| 140 | - stmt.bindLong(16, entity.getQueryTraceStartTime()); | |
| 141 | - stmt.bindLong(17, entity.getQueryTraceEndTime()); | |
| 138 | + stmt.bindLong(12, entity.getPauseCount()); | |
| 139 | + stmt.bindLong(13, entity.getUserPauseTimeStamp()); | |
| 140 | + stmt.bindLong(14, entity.getChronometerBase()); | |
| 141 | + stmt.bindLong(15, entity.getQueryTraceStartTime()); | |
| 142 | + stmt.bindLong(16, entity.getQueryTraceEndTime()); | |
| 142 | 143 | |
| 143 | 144 | String queryEntityName = entity.getQueryEntityName(); |
| 144 | 145 | if (queryEntityName != null) { |
| 145 | - stmt.bindString(18, queryEntityName); | |
| 146 | + stmt.bindString(17, queryEntityName); | |
| 146 | 147 | } |
| 147 | - stmt.bindLong(19, entity.getContinueTime()); | |
| 148 | - stmt.bindLong(20, entity.getFenceId()); | |
| 148 | + stmt.bindLong(18, entity.getContinueTime()); | |
| 149 | + stmt.bindLong(19, entity.getFenceId()); | |
| 149 | 150 | |
| 150 | 151 | String importPoint = entity.getImportPoint(); |
| 151 | 152 | if (importPoint != null) { |
| 152 | - stmt.bindString(21, importPoint); | |
| 153 | + stmt.bindString(20, importPoint); | |
| 153 | 154 | } |
| 154 | 155 | |
| 155 | 156 | String streetTitle = entity.getStreetTitle(); |
| 156 | 157 | if (streetTitle != null) { |
| 157 | - stmt.bindString(22, streetTitle); | |
| 158 | + stmt.bindString(21, streetTitle); | |
| 158 | 159 | } |
| 160 | + | |
| 161 | + String endLatLng = entity.getEndLatLng(); | |
| 162 | + if (endLatLng != null) { | |
| 163 | + stmt.bindString(22, endLatLng); | |
| 164 | + } | |
| 165 | + stmt.bindLong(23, entity.getIsArriveEndPoint() ? 1L: 0L); | |
| 159 | 166 | } |
| 160 | 167 | |
| 161 | 168 | @Override |
| ... | ... | @@ -176,53 +183,58 @@ public class UserStepEntityDao extends AbstractDao<UserStepEntity, String> { |
| 176 | 183 | if (stepCount != null) { |
| 177 | 184 | stmt.bindString(3, stepCount); |
| 178 | 185 | } |
| 179 | - stmt.bindLong(4, entity.getPauseTimeStamp()); | |
| 180 | - stmt.bindLong(5, entity.getRecordTime()); | |
| 181 | - stmt.bindDouble(6, entity.getCaloriesCount()); | |
| 186 | + stmt.bindLong(4, entity.getRecordTime()); | |
| 187 | + stmt.bindDouble(5, entity.getCaloriesCount()); | |
| 182 | 188 | |
| 183 | 189 | String serverTraceData = entity.getServerTraceData(); |
| 184 | 190 | if (serverTraceData != null) { |
| 185 | - stmt.bindString(7, serverTraceData); | |
| 191 | + stmt.bindString(6, serverTraceData); | |
| 186 | 192 | } |
| 187 | 193 | |
| 188 | 194 | String startPoint = entity.getStartPoint(); |
| 189 | 195 | if (startPoint != null) { |
| 190 | - stmt.bindString(8, startPoint); | |
| 196 | + stmt.bindString(7, startPoint); | |
| 191 | 197 | } |
| 192 | 198 | |
| 193 | 199 | String endPoint = entity.getEndPoint(); |
| 194 | 200 | if (endPoint != null) { |
| 195 | - stmt.bindString(9, endPoint); | |
| 201 | + stmt.bindString(8, endPoint); | |
| 196 | 202 | } |
| 197 | - stmt.bindLong(10, entity.getStartTimeStamp()); | |
| 198 | - stmt.bindLong(11, entity.getFinishTimeStamp()); | |
| 203 | + stmt.bindLong(9, entity.getStartTimeStamp()); | |
| 204 | + stmt.bindLong(10, entity.getFinishTimeStamp()); | |
| 199 | 205 | |
| 200 | 206 | String streetId = entity.getStreetId(); |
| 201 | 207 | if (streetId != null) { |
| 202 | - stmt.bindString(12, streetId); | |
| 208 | + stmt.bindString(11, streetId); | |
| 203 | 209 | } |
| 204 | - stmt.bindLong(13, entity.getPauseCount()); | |
| 205 | - stmt.bindLong(14, entity.getUserPauseTimeStamp()); | |
| 206 | - stmt.bindLong(15, entity.getChronometerBase()); | |
| 207 | - stmt.bindLong(16, entity.getQueryTraceStartTime()); | |
| 208 | - stmt.bindLong(17, entity.getQueryTraceEndTime()); | |
| 210 | + stmt.bindLong(12, entity.getPauseCount()); | |
| 211 | + stmt.bindLong(13, entity.getUserPauseTimeStamp()); | |
| 212 | + stmt.bindLong(14, entity.getChronometerBase()); | |
| 213 | + stmt.bindLong(15, entity.getQueryTraceStartTime()); | |
| 214 | + stmt.bindLong(16, entity.getQueryTraceEndTime()); | |
| 209 | 215 | |
| 210 | 216 | String queryEntityName = entity.getQueryEntityName(); |
| 211 | 217 | if (queryEntityName != null) { |
| 212 | - stmt.bindString(18, queryEntityName); | |
| 218 | + stmt.bindString(17, queryEntityName); | |
| 213 | 219 | } |
| 214 | - stmt.bindLong(19, entity.getContinueTime()); | |
| 215 | - stmt.bindLong(20, entity.getFenceId()); | |
| 220 | + stmt.bindLong(18, entity.getContinueTime()); | |
| 221 | + stmt.bindLong(19, entity.getFenceId()); | |
| 216 | 222 | |
| 217 | 223 | String importPoint = entity.getImportPoint(); |
| 218 | 224 | if (importPoint != null) { |
| 219 | - stmt.bindString(21, importPoint); | |
| 225 | + stmt.bindString(20, importPoint); | |
| 220 | 226 | } |
| 221 | 227 | |
| 222 | 228 | String streetTitle = entity.getStreetTitle(); |
| 223 | 229 | if (streetTitle != null) { |
| 224 | - stmt.bindString(22, streetTitle); | |
| 230 | + stmt.bindString(21, streetTitle); | |
| 231 | + } | |
| 232 | + | |
| 233 | + String endLatLng = entity.getEndLatLng(); | |
| 234 | + if (endLatLng != null) { | |
| 235 | + stmt.bindString(22, endLatLng); | |
| 225 | 236 | } |
| 237 | + stmt.bindLong(23, entity.getIsArriveEndPoint() ? 1L: 0L); | |
| 226 | 238 | } |
| 227 | 239 | |
| 228 | 240 | @Override |
| ... | ... | @@ -236,25 +248,26 @@ public class UserStepEntityDao extends AbstractDao<UserStepEntity, String> { |
| 236 | 248 | cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0), // userId |
| 237 | 249 | cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // date |
| 238 | 250 | cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // stepCount |
| 239 | - cursor.getLong(offset + 3), // pauseTimeStamp | |
| 240 | - cursor.getLong(offset + 4), // recordTime | |
| 241 | - cursor.getDouble(offset + 5), // caloriesCount | |
| 242 | - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // serverTraceData | |
| 243 | - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // startPoint | |
| 244 | - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // endPoint | |
| 245 | - cursor.getLong(offset + 9), // startTimeStamp | |
| 246 | - cursor.getLong(offset + 10), // finishTimeStamp | |
| 247 | - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // streetId | |
| 248 | - cursor.getInt(offset + 12), // pauseCount | |
| 249 | - cursor.getLong(offset + 13), // userPauseTimeStamp | |
| 250 | - cursor.getLong(offset + 14), // chronometerBase | |
| 251 | - cursor.getLong(offset + 15), // queryTraceStartTime | |
| 252 | - cursor.getLong(offset + 16), // queryTraceEndTime | |
| 253 | - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // queryEntityName | |
| 254 | - cursor.getLong(offset + 18), // continueTime | |
| 255 | - cursor.getLong(offset + 19), // fenceId | |
| 256 | - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // importPoint | |
| 257 | - cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21) // streetTitle | |
| 251 | + cursor.getLong(offset + 3), // recordTime | |
| 252 | + cursor.getDouble(offset + 4), // caloriesCount | |
| 253 | + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // serverTraceData | |
| 254 | + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // startPoint | |
| 255 | + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // endPoint | |
| 256 | + cursor.getLong(offset + 8), // startTimeStamp | |
| 257 | + cursor.getLong(offset + 9), // finishTimeStamp | |
| 258 | + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // streetId | |
| 259 | + cursor.getInt(offset + 11), // pauseCount | |
| 260 | + cursor.getLong(offset + 12), // userPauseTimeStamp | |
| 261 | + cursor.getLong(offset + 13), // chronometerBase | |
| 262 | + cursor.getLong(offset + 14), // queryTraceStartTime | |
| 263 | + cursor.getLong(offset + 15), // queryTraceEndTime | |
| 264 | + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // queryEntityName | |
| 265 | + cursor.getLong(offset + 17), // continueTime | |
| 266 | + cursor.getLong(offset + 18), // fenceId | |
| 267 | + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // importPoint | |
| 268 | + cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // streetTitle | |
| 269 | + cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // endLatLng | |
| 270 | + cursor.getShort(offset + 22) != 0 // isArriveEndPoint | |
| 258 | 271 | ); |
| 259 | 272 | return entity; |
| 260 | 273 | } |
| ... | ... | @@ -264,25 +277,26 @@ public class UserStepEntityDao extends AbstractDao<UserStepEntity, String> { |
| 264 | 277 | entity.setUserId(cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0)); |
| 265 | 278 | entity.setDate(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); |
| 266 | 279 | entity.setStepCount(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); |
| 267 | - entity.setPauseTimeStamp(cursor.getLong(offset + 3)); | |
| 268 | - entity.setRecordTime(cursor.getLong(offset + 4)); | |
| 269 | - entity.setCaloriesCount(cursor.getDouble(offset + 5)); | |
| 270 | - entity.setServerTraceData(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); | |
| 271 | - entity.setStartPoint(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); | |
| 272 | - entity.setEndPoint(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); | |
| 273 | - entity.setStartTimeStamp(cursor.getLong(offset + 9)); | |
| 274 | - entity.setFinishTimeStamp(cursor.getLong(offset + 10)); | |
| 275 | - entity.setStreetId(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); | |
| 276 | - entity.setPauseCount(cursor.getInt(offset + 12)); | |
| 277 | - entity.setUserPauseTimeStamp(cursor.getLong(offset + 13)); | |
| 278 | - entity.setChronometerBase(cursor.getLong(offset + 14)); | |
| 279 | - entity.setQueryTraceStartTime(cursor.getLong(offset + 15)); | |
| 280 | - entity.setQueryTraceEndTime(cursor.getLong(offset + 16)); | |
| 281 | - entity.setQueryEntityName(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); | |
| 282 | - entity.setContinueTime(cursor.getLong(offset + 18)); | |
| 283 | - entity.setFenceId(cursor.getLong(offset + 19)); | |
| 284 | - entity.setImportPoint(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); | |
| 285 | - entity.setStreetTitle(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); | |
| 280 | + entity.setRecordTime(cursor.getLong(offset + 3)); | |
| 281 | + entity.setCaloriesCount(cursor.getDouble(offset + 4)); | |
| 282 | + entity.setServerTraceData(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); | |
| 283 | + entity.setStartPoint(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); | |
| 284 | + entity.setEndPoint(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); | |
| 285 | + entity.setStartTimeStamp(cursor.getLong(offset + 8)); | |
| 286 | + entity.setFinishTimeStamp(cursor.getLong(offset + 9)); | |
| 287 | + entity.setStreetId(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); | |
| 288 | + entity.setPauseCount(cursor.getInt(offset + 11)); | |
| 289 | + entity.setUserPauseTimeStamp(cursor.getLong(offset + 12)); | |
| 290 | + entity.setChronometerBase(cursor.getLong(offset + 13)); | |
| 291 | + entity.setQueryTraceStartTime(cursor.getLong(offset + 14)); | |
| 292 | + entity.setQueryTraceEndTime(cursor.getLong(offset + 15)); | |
| 293 | + entity.setQueryEntityName(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); | |
| 294 | + entity.setContinueTime(cursor.getLong(offset + 17)); | |
| 295 | + entity.setFenceId(cursor.getLong(offset + 18)); | |
| 296 | + entity.setImportPoint(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); | |
| 297 | + entity.setStreetTitle(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); | |
| 298 | + entity.setEndLatLng(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); | |
| 299 | + entity.setIsArriveEndPoint(cursor.getShort(offset + 22) != 0); | |
| 286 | 300 | } |
| 287 | 301 | |
| 288 | 302 | @Override | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/sql/entity/FailedEntity.java
| ... | ... | @@ -36,13 +36,13 @@ public class FailedEntity implements Serializable { |
| 36 | 36 | private String streetId;//赛事id |
| 37 | 37 | private String streetTitle;//赛道标题 |
| 38 | 38 | private long creatTimeStamp;//数据创建的时间 |
| 39 | + private boolean isArriveEndPoint;//是否到达终点 | |
| 39 | 40 | |
| 40 | - @Generated(hash = 458367844) | |
| 41 | - public FailedEntity(String uuid, String uid, boolean isPause, long userPauseTime, long usrContinueTime, | |
| 42 | - String isFinish, String time, String speed, String step, String distance, String startPoint, | |
| 43 | - String endPoint, long streetTraceStartTime, long streetTraceEndTime, String entityName, | |
| 44 | - long userStartTime, long userEndTime, String importPoint, String streetId, String streetTitle, | |
| 45 | - long creatTimeStamp) { | |
| 41 | + @Generated(hash = 1057412546) | |
| 42 | + public FailedEntity(String uuid, String uid, boolean isPause, long userPauseTime, long usrContinueTime, String isFinish, | |
| 43 | + String time, String speed, String step, String distance, String startPoint, String endPoint, | |
| 44 | + long streetTraceStartTime, long streetTraceEndTime, String entityName, long userStartTime, long userEndTime, | |
| 45 | + String importPoint, String streetId, String streetTitle, long creatTimeStamp, boolean isArriveEndPoint) { | |
| 46 | 46 | this.uuid = uuid; |
| 47 | 47 | this.uid = uid; |
| 48 | 48 | this.isPause = isPause; |
| ... | ... | @@ -64,6 +64,7 @@ public class FailedEntity implements Serializable { |
| 64 | 64 | this.streetId = streetId; |
| 65 | 65 | this.streetTitle = streetTitle; |
| 66 | 66 | this.creatTimeStamp = creatTimeStamp; |
| 67 | + this.isArriveEndPoint = isArriveEndPoint; | |
| 67 | 68 | } |
| 68 | 69 | |
| 69 | 70 | @Generated(hash = 1639581354) |
| ... | ... | @@ -238,6 +239,13 @@ public class FailedEntity implements Serializable { |
| 238 | 239 | this.distance = distance; |
| 239 | 240 | } |
| 240 | 241 | |
| 242 | + public boolean getIsArriveEndPoint() { | |
| 243 | + return this.isArriveEndPoint; | |
| 244 | + } | |
| 245 | + | |
| 246 | + public void setIsArriveEndPoint(boolean isArriveEndPoint) { | |
| 247 | + this.isArriveEndPoint = isArriveEndPoint; | |
| 248 | + } | |
| 241 | 249 | |
| 242 | 250 | |
| 243 | 251 | } | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/sql/entity/UserStepEntity.java
| 1 | 1 | package com.cnlive.moudle.pedometer.sql.entity; |
| 2 | 2 | |
| 3 | +import com.baidu.mapapi.model.LatLng; | |
| 4 | + | |
| 3 | 5 | import org.greenrobot.greendao.annotation.Entity; |
| 4 | 6 | import org.greenrobot.greendao.annotation.Generated; |
| 5 | 7 | import org.greenrobot.greendao.annotation.Id; |
| ... | ... | @@ -10,7 +12,6 @@ public class UserStepEntity { |
| 10 | 12 | private String userId; |
| 11 | 13 | private String date; |
| 12 | 14 | private String stepCount; |
| 13 | - private long pauseTimeStamp;//暂停时间戳 | |
| 14 | 15 | private long recordTime;//暂停时间 |
| 15 | 16 | private double caloriesCount;//卡路里 |
| 16 | 17 | private String serverTraceData;//服务端赛道数据 |
| ... | ... | @@ -29,15 +30,15 @@ public class UserStepEntity { |
| 29 | 30 | private long fenceId;//围栏id |
| 30 | 31 | private String importPoint;//关键点 |
| 31 | 32 | private String streetTitle;//赛事标题 |
| 32 | - | |
| 33 | - @Generated(hash = 1762072682) | |
| 34 | - public UserStepEntity(String userId, String date, String stepCount, long pauseTimeStamp, long recordTime, double caloriesCount, String serverTraceData, String startPoint, | |
| 35 | - String endPoint, long startTimeStamp, long finishTimeStamp, String streetId, int pauseCount, long userPauseTimeStamp, long chronometerBase, long queryTraceStartTime, | |
| 36 | - long queryTraceEndTime, String queryEntityName, long continueTime, long fenceId, String importPoint, String streetTitle) { | |
| 33 | + private String endLatLng;//终点坐标 | |
| 34 | + private boolean isArriveEndPoint;//是否到达终点 | |
| 35 | + @Generated(hash = 434792384) | |
| 36 | + public UserStepEntity(String userId, String date, String stepCount, long recordTime, double caloriesCount, String serverTraceData, String startPoint, String endPoint, | |
| 37 | + long startTimeStamp, long finishTimeStamp, String streetId, int pauseCount, long userPauseTimeStamp, long chronometerBase, long queryTraceStartTime, long queryTraceEndTime, | |
| 38 | + String queryEntityName, long continueTime, long fenceId, String importPoint, String streetTitle, String endLatLng, boolean isArriveEndPoint) { | |
| 37 | 39 | this.userId = userId; |
| 38 | 40 | this.date = date; |
| 39 | 41 | this.stepCount = stepCount; |
| 40 | - this.pauseTimeStamp = pauseTimeStamp; | |
| 41 | 42 | this.recordTime = recordTime; |
| 42 | 43 | this.caloriesCount = caloriesCount; |
| 43 | 44 | this.serverTraceData = serverTraceData; |
| ... | ... | @@ -56,6 +57,8 @@ public class UserStepEntity { |
| 56 | 57 | this.fenceId = fenceId; |
| 57 | 58 | this.importPoint = importPoint; |
| 58 | 59 | this.streetTitle = streetTitle; |
| 60 | + this.endLatLng = endLatLng; | |
| 61 | + this.isArriveEndPoint = isArriveEndPoint; | |
| 59 | 62 | } |
| 60 | 63 | |
| 61 | 64 | @Generated(hash = 273857141) |
| ... | ... | @@ -86,13 +89,6 @@ public class UserStepEntity { |
| 86 | 89 | this.stepCount = stepCount; |
| 87 | 90 | } |
| 88 | 91 | |
| 89 | - public long getPauseTimeStamp() { | |
| 90 | - return this.pauseTimeStamp; | |
| 91 | - } | |
| 92 | - | |
| 93 | - public void setPauseTimeStamp(long pauseTimeStamp) { | |
| 94 | - this.pauseTimeStamp = pauseTimeStamp; | |
| 95 | - } | |
| 96 | 92 | |
| 97 | 93 | public long getRecordTime() { |
| 98 | 94 | return this.recordTime; |
| ... | ... | @@ -238,5 +234,21 @@ public class UserStepEntity { |
| 238 | 234 | this.streetTitle = streetTitle; |
| 239 | 235 | } |
| 240 | 236 | |
| 237 | + public boolean getIsArriveEndPoint() { | |
| 238 | + return this.isArriveEndPoint; | |
| 239 | + } | |
| 240 | + | |
| 241 | + public void setIsArriveEndPoint(boolean isArriveEndPoint) { | |
| 242 | + this.isArriveEndPoint = isArriveEndPoint; | |
| 243 | + } | |
| 244 | + | |
| 245 | + public String getEndLatLng() { | |
| 246 | + return this.endLatLng; | |
| 247 | + } | |
| 248 | + | |
| 249 | + public void setEndLatLng(String endLatLng) { | |
| 250 | + this.endLatLng = endLatLng; | |
| 251 | + } | |
| 252 | + | |
| 241 | 253 | |
| 242 | 254 | } | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/ALLScoreDetailFragment.java
| ... | ... | @@ -12,6 +12,11 @@ import com.cnlive.moudle.pedometer.model.RunningFinishBean; |
| 12 | 12 | import com.example.moudle_pedometer.R; |
| 13 | 13 | import com.example.moudle_pedometer.databinding.FragmentFinishRunMapBinding; |
| 14 | 14 | |
| 15 | +/** | |
| 16 | + * 我的活动-全部成绩 | |
| 17 | + * | |
| 18 | + * @author ShinnyYang | |
| 19 | + */ | |
| 15 | 20 | public class ALLScoreDetailFragment extends QMUIFragment<ALLScoreDetailFragmentView, ALLScoreDetailFragmentPresenter, FragmentFinishRunMapBinding> { |
| 16 | 21 | private RunningFinishBean runningFinishBean; |
| 17 | 22 | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RunMainFragment.java
| ... | ... | @@ -2,6 +2,7 @@ package com.cnlive.moudle.pedometer.ui.fragment; |
| 2 | 2 | |
| 3 | 3 | import android.os.Bundle; |
| 4 | 4 | import android.os.Handler; |
| 5 | +import android.os.Vibrator; | |
| 5 | 6 | import android.support.annotation.Nullable; |
| 6 | 7 | import android.text.TextUtils; |
| 7 | 8 | import android.util.Log; |
| ... | ... | @@ -18,6 +19,8 @@ import com.cnlive.moudle.pedometer.model.Constant; |
| 18 | 19 | import com.cnlive.moudle.pedometer.model.MessageEvent; |
| 19 | 20 | import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; |
| 20 | 21 | import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; |
| 22 | +import com.cnlive.moudle.pedometer.ui.widget.TipDialog; | |
| 23 | +import com.cnlive.moudle.pedometer.utils.ChineseToSpeechUtil; | |
| 21 | 24 | import com.cnlive.moudle.pedometer.utils.GsonUtil; |
| 22 | 25 | import com.cnlive.moudle.pedometer.utils.StepUtil; |
| 23 | 26 | import com.example.moudle_pedometer.R; |
| ... | ... | @@ -34,6 +37,9 @@ import java.util.List; |
| 34 | 37 | public class RunMainFragment extends QMUIFragment<RunMainFragmentView, RunMainFragmentPresenter, FragmentRunMainBinding> { |
| 35 | 38 | private final String TAG = "RunMainFragment"; |
| 36 | 39 | private RunRaceDetailInfo runRaceDetailInfo; |
| 40 | + //创建震动服务对象 | |
| 41 | + private Vibrator mVibrator; | |
| 42 | + private TipDialog tipDialog; | |
| 37 | 43 | |
| 38 | 44 | public static RunMainFragment newInstance(RunRaceDetailInfo runRaceDetailInfo) { |
| 39 | 45 | Bundle bundle = new Bundle(); |
| ... | ... | @@ -50,6 +56,7 @@ public class RunMainFragment extends QMUIFragment<RunMainFragmentView, RunMainFr |
| 50 | 56 | StatusBarUtil2.setColor(getActivity(), getResources().getColor(R.color.run_main_bg), 0); |
| 51 | 57 | EventBus.getDefault().register(this); |
| 52 | 58 | if (getArguments() != null) { |
| 59 | + initTipDialog(); | |
| 53 | 60 | runRaceDetailInfo = (RunRaceDetailInfo) getArguments().getSerializable("runRaceDetailInfo"); |
| 54 | 61 | UserStepEntity userStepEntity = StepUtil.getUserStepData(getActivity(), CommonInfo.getUserId(getActivity())); |
| 55 | 62 | if (userStepEntity != null) { |
| ... | ... | @@ -129,6 +136,19 @@ public class RunMainFragment extends QMUIFragment<RunMainFragmentView, RunMainFr |
| 129 | 136 | return R.layout.fragment_run_main; |
| 130 | 137 | } |
| 131 | 138 | |
| 139 | + private void initTipDialog() { | |
| 140 | + if (tipDialog == null) { | |
| 141 | + tipDialog = new TipDialog(getActivity(), "您已偏离预定轨迹!", "我知道了", R.color.green_round, new TipDialog.DialogInterface() { | |
| 142 | + @Override | |
| 143 | + public void onClick(TipDialog dialog) { | |
| 144 | + dialog.dismiss(); | |
| 145 | + } | |
| 146 | + }); | |
| 147 | + tipDialog.setCancelable(false); | |
| 148 | + tipDialog.setCanceledOnTouchOutside(false); | |
| 149 | + } | |
| 150 | + } | |
| 151 | + | |
| 132 | 152 | @Subscribe(threadMode = ThreadMode.MAIN) |
| 133 | 153 | public void Event(MessageEvent messageEvent) { |
| 134 | 154 | //更新步数 |
| ... | ... | @@ -143,6 +163,32 @@ public class RunMainFragment extends QMUIFragment<RunMainFragmentView, RunMainFr |
| 143 | 163 | getMvpView().resetSpeed(); |
| 144 | 164 | } |
| 145 | 165 | } |
| 166 | + //超出范围 | |
| 167 | + else if (messageEvent.getMessageType() == Constant.EXIT_RANGE) { | |
| 168 | + ChineseToSpeechUtil.speech(getActivity().getApplicationContext(), getString(R.string.exit_range_tip)); | |
| 169 | + if (mVibrator != null) { | |
| 170 | + //设置震动周期,数组表示时间:等待+执行,单位是毫秒,下面操作代表:等待100,执行100,等待100,执行1000, | |
| 171 | + //后面的数字如果为-1代表不重复,之执行一次,其他代表会重复,0代表从数组的第0个位置开始 | |
| 172 | + mVibrator.vibrate(new long[]{100, 1000, 100, 1000}, -1); | |
| 173 | + } | |
| 174 | + if (tipDialog != null) { | |
| 175 | + tipDialog.setTipMsg("您已偏离路径轨迹\n请您计时回归路径!"); | |
| 176 | + tipDialog.show(); | |
| 177 | + } | |
| 178 | + } | |
| 179 | + //进入范围 | |
| 180 | + else if (messageEvent.getMessageType() == Constant.ENTER_RANGE) { | |
| 181 | + ChineseToSpeechUtil.speech(getActivity().getApplicationContext(), getString(R.string.enter_range_tip)); | |
| 182 | + if (mVibrator != null) { | |
| 183 | + //设置震动周期,数组表示时间:等待+执行,单位是毫秒,下面操作代表:等待100,执行100,等待100,执行1000, | |
| 184 | + //后面的数字如果为-1代表不重复,之执行一次,其他代表会重复,0代表从数组的第0个位置开始 | |
| 185 | + mVibrator.vibrate(new long[]{100, 1000, 100, 1000}, -1); | |
| 186 | + } | |
| 187 | + if (tipDialog != null) { | |
| 188 | + tipDialog.setTipMsg("您已回归轨迹\n继续参与运动吧"); | |
| 189 | + tipDialog.show(); | |
| 190 | + } | |
| 191 | + } | |
| 146 | 192 | } |
| 147 | 193 | |
| 148 | 194 | /** | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RunRaceDetailFragment.java
| ... | ... | @@ -177,8 +177,8 @@ public class RunRaceDetailFragment extends QMUIFragment<RunRaceDetailFragmentVie |
| 177 | 177 | public void Event(MessageEvent messageEvent) { |
| 178 | 178 | //启动鹰眼成功 |
| 179 | 179 | if (messageEvent.getMessageType() == Constant.START_TRACE_GATHER_SUCCESS) { |
| 180 | + Log.e(TAG, "Event: 启动成功"); | |
| 180 | 181 | if (getMvpView() != null) { |
| 181 | - Log.e(TAG, "跳转: " + getMvpView().importStreetPoints.size()); | |
| 182 | 182 | QMUITipDialogUtil.dismessDialog(); |
| 183 | 183 | PedometerMainActivity.startActivity(getActivity(), getMvpView().runRaceDetailInfo); |
| 184 | 184 | } | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RunningMapFragment.java
| ... | ... | @@ -110,9 +110,15 @@ public class RunningMapFragment extends QMUIFragment<RunningMapFragmentView, Run |
| 110 | 110 | if (getMvpView() != null && userStepEntity != null) { |
| 111 | 111 | //查询运营人员踩得轨迹 |
| 112 | 112 | getPresenter().getServerStreetTrace(getActivity(), userStepEntity); |
| 113 | - | |
| 114 | - //开始查询 | |
| 115 | - getPresenter().queryHistoryTrace(getActivity(), userStepEntity); | |
| 113 | + //判断用户是否暂停过 | |
| 114 | + if (userStepEntity.getPauseCount() != 0) { | |
| 115 | + //开始查询,用户已经点击暂停按钮(先画出用户 开始-暂停时间中的轨迹) | |
| 116 | + getPresenter().queryHistoryTrace(getActivity(), userStepEntity, true); | |
| 117 | + | |
| 118 | + } else { | |
| 119 | + //开始查询,用户没有点击暂停按钮 | |
| 120 | + getPresenter().queryHistoryTrace(getActivity(), userStepEntity, false); | |
| 121 | + } | |
| 116 | 122 | } |
| 117 | 123 | |
| 118 | 124 | |
| ... | ... | @@ -193,6 +199,7 @@ public class RunningMapFragment extends QMUIFragment<RunningMapFragmentView, Run |
| 193 | 199 | mVibrator.vibrate(new long[]{100, 1000, 100, 1000}, -1); |
| 194 | 200 | } |
| 195 | 201 | if (tipDialog != null) { |
| 202 | + tipDialog.setTipMsg("您已偏离路径轨迹\n请您计时回归路径!"); | |
| 196 | 203 | tipDialog.show(); |
| 197 | 204 | } |
| 198 | 205 | } |
| ... | ... | @@ -205,6 +212,7 @@ public class RunningMapFragment extends QMUIFragment<RunningMapFragmentView, Run |
| 205 | 212 | mVibrator.vibrate(new long[]{100, 1000, 100, 1000}, -1); |
| 206 | 213 | } |
| 207 | 214 | if (tipDialog != null) { |
| 215 | + tipDialog.setTipMsg("您已回归轨迹\n继续参与运动吧"); | |
| 208 | 216 | tipDialog.show(); |
| 209 | 217 | } |
| 210 | 218 | } | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/UploadFailDetailFragment.java
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/widget/TipDialog.java
| ... | ... | @@ -54,12 +54,14 @@ public class TipDialog extends Dialog { |
| 54 | 54 | @Override |
| 55 | 55 | protected void onCreate(Bundle savedInstanceState) { |
| 56 | 56 | super.onCreate(savedInstanceState); |
| 57 | - | |
| 58 | - | |
| 59 | 57 | //显示视图 |
| 60 | 58 | this.setContentView(view); |
| 61 | 59 | } |
| 62 | 60 | |
| 61 | + public void setTipMsg(String tipMsg) { | |
| 62 | + tv_dialog_tip.setText(tipMsg); | |
| 63 | + } | |
| 64 | + | |
| 63 | 65 | private void initView(View rootView) { |
| 64 | 66 | this.tv_dialog_tip = (TextView) rootView.findViewById(R.id.tv_dialog_tip); |
| 65 | 67 | this.btn_ok = (Button) rootView.findViewById(R.id.btn_ok); | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/MyMapUtil.java
| ... | ... | @@ -270,7 +270,7 @@ public class MyMapUtil { |
| 270 | 270 | */ |
| 271 | 271 | public static Overlay drawHistoryTrack(Context context, BaiduMap baiduMap, List<LatLng> points, SortType sortType, int lineColor, int startIconRes, int endIconRes) { |
| 272 | 272 | // 绘制新覆盖物前,清空之前的覆盖物 |
| 273 | - if (points == null || points.size() == 0 || lineColor == 0 || startIconRes == 0 || endIconRes == 0) { | |
| 273 | + if (points == null || points.size() == 0 || lineColor == 0) { | |
| 274 | 274 | return null; |
| 275 | 275 | } |
| 276 | 276 | //只有一个点 |
| ... | ... | @@ -331,7 +331,7 @@ public class MyMapUtil { |
| 331 | 331 | */ |
| 332 | 332 | public static Overlay drawRealTimeTrack(Context context, BaiduMap baiduMap, List<LatLng> points, SortType sortType, int lineColor, int startIconRes) { |
| 333 | 333 | // 绘制新覆盖物前,清空之前的覆盖物 |
| 334 | - if (points == null || points.size() == 0 || lineColor == 0 || startIconRes == 0) { | |
| 334 | + if (points == null || points.size() == 0 || lineColor == 0 ) { | |
| 335 | 335 | return null; |
| 336 | 336 | } |
| 337 | 337 | //只有一个点 | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/StepUtil.java
moudle_pedometer/src/main/res/layout/fragment_run_race_detail.xml
moudle_pedometer/src/main/res/layout/fragment_running_map.xml
| ... | ... | @@ -175,7 +175,6 @@ |
| 175 | 175 | android:layout_weight="1" |
| 176 | 176 | android:gravity="center" |
| 177 | 177 | android:orientation="vertical" |
| 178 | - android:paddingLeft="5dp" | |
| 179 | 178 | android:paddingRight="5dp"> |
| 180 | 179 | |
| 181 | 180 | <TextView |
| ... | ... | @@ -183,6 +182,7 @@ |
| 183 | 182 | android:layout_width="wrap_content" |
| 184 | 183 | android:layout_height="wrap_content" |
| 185 | 184 | android:text="--" |
| 185 | + android:layout_marginRight="5dp" | |
| 186 | 186 | android:textColor="@color/black" |
| 187 | 187 | android:textSize="20sp" |
| 188 | 188 | android:textStyle="bold" /> |
| ... | ... | @@ -192,6 +192,7 @@ |
| 192 | 192 | android:layout_height="wrap_content" |
| 193 | 193 | android:layout_marginTop="10dp" |
| 194 | 194 | android:text="距离(km)" |
| 195 | + android:layout_marginRight="5dp" | |
| 195 | 196 | android:textColor="@color/black" |
| 196 | 197 | android:textSize="15sp" /> |
| 197 | 198 | </LinearLayout> | ... | ... |
moudle_pedometer/src/main/res/layout/fragment_self_record.xml
| ... | ... | @@ -16,6 +16,7 @@ |
| 16 | 16 | android:layout_width="wrap_content" |
| 17 | 17 | android:layout_height="wrap_content" |
| 18 | 18 | android:layout_centerVertical="true" |
| 19 | + android:layout_marginLeft="10dp" | |
| 19 | 20 | android:padding="10dp" |
| 20 | 21 | android:src="@drawable/top_back_black" /> |
| 21 | 22 | |
| ... | ... | @@ -44,7 +45,7 @@ |
| 44 | 45 | android:id="@+id/ry_record" |
| 45 | 46 | android:layout_width="match_parent" |
| 46 | 47 | android:layout_height="wrap_content" |
| 47 | - android:layout_marginTop="10dp" | |
| 48 | + android:layout_marginTop="-15dp" | |
| 48 | 49 | android:background="@drawable/wdjl_backgroud" |
| 49 | 50 | android:padding="25dp"> |
| 50 | 51 | |
| ... | ... | @@ -68,7 +69,7 @@ |
| 68 | 69 | android:layout_width="wrap_content" |
| 69 | 70 | android:layout_height="wrap_content" |
| 70 | 71 | android:layout_centerHorizontal="true" |
| 71 | - android:layout_marginTop="20dp" | |
| 72 | + android:layout_marginTop="10dp" | |
| 72 | 73 | android:text="0.0" |
| 73 | 74 | android:textColor="@color/white" |
| 74 | 75 | android:textSize="50sp" /> |
| ... | ... | @@ -249,7 +250,6 @@ |
| 249 | 250 | android:layout_width="match_parent" |
| 250 | 251 | android:layout_height="wrap_content" |
| 251 | 252 | android:layout_marginLeft="10dp" |
| 252 | - android:layout_marginTop="10dp" | |
| 253 | 253 | android:layout_marginRight="10dp"> |
| 254 | 254 | |
| 255 | 255 | <TextView | ... | ... |
moudle_pedometer/src/main/res/layout/layout_finish_running_route.xml
| ... | ... | @@ -4,7 +4,10 @@ |
| 4 | 4 | <LinearLayout |
| 5 | 5 | android:layout_width="match_parent" |
| 6 | 6 | android:layout_height="wrap_content" |
| 7 | - android:layout_margin="10dp" | |
| 7 | + android:layout_marginLeft="10dp" | |
| 8 | + android:layout_marginTop="20dp" | |
| 9 | + android:layout_marginRight="10dp" | |
| 10 | + android:layout_marginBottom="10dp" | |
| 8 | 11 | android:background="@drawable/shape_10dp_white_raduis_bg" |
| 9 | 12 | android:orientation="vertical"> |
| 10 | 13 | <!--跑步路线--> | ... | ... |
moudle_pedometer/src/main/res/layout/layout_finish_step.xml
| ... | ... | @@ -4,7 +4,10 @@ |
| 4 | 4 | <LinearLayout |
| 5 | 5 | android:layout_width="match_parent" |
| 6 | 6 | android:layout_height="80dp" |
| 7 | - android:layout_margin="10dp" | |
| 7 | + android:layout_marginLeft="10dp" | |
| 8 | + android:layout_marginTop="20dp" | |
| 9 | + android:layout_marginRight="10dp" | |
| 10 | + android:layout_marginBottom="10dp" | |
| 8 | 11 | android:background="@drawable/shape_10dp_white_raduis_bg" |
| 9 | 12 | android:orientation="vertical"> |
| 10 | 13 | ... | ... |
moudle_pedometer/src/main/res/layout/layout_finish_user_info.xml
| ... | ... | @@ -85,7 +85,9 @@ |
| 85 | 85 | <View |
| 86 | 86 | android:layout_width="match_parent" |
| 87 | 87 | android:layout_height="1dp" |
| 88 | + android:layout_marginLeft="10dp" | |
| 88 | 89 | android:layout_marginTop="10dp" |
| 90 | + android:layout_marginRight="10dp" | |
| 89 | 91 | android:background="@color/line" /> |
| 90 | 92 | <!--配速和用时--> |
| 91 | 93 | <LinearLayout |
| ... | ... | @@ -113,6 +115,7 @@ |
| 113 | 115 | android:layout_width="wrap_content" |
| 114 | 116 | android:layout_height="wrap_content" |
| 115 | 117 | android:layout_marginTop="5dp" |
| 118 | + android:layout_marginBottom="10dp" | |
| 116 | 119 | android:text="配速" |
| 117 | 120 | android:textColor="@color/text_black" |
| 118 | 121 | android:textSize="15sp" /> |
| ... | ... | @@ -138,6 +141,7 @@ |
| 138 | 141 | android:layout_width="wrap_content" |
| 139 | 142 | android:layout_height="wrap_content" |
| 140 | 143 | android:layout_marginTop="5dp" |
| 144 | + android:layout_marginBottom="10dp" | |
| 141 | 145 | android:text="用时" |
| 142 | 146 | android:textColor="@color/text_black" |
| 143 | 147 | android:textSize="15sp" /> | ... | ... |
moudle_pedometer/src/main/res/layout/layout_run_detail_person_score.xml
| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | <!--个人最佳成绩--> |
| 10 | 10 | <LinearLayout |
| 11 | 11 | android:layout_width="match_parent" |
| 12 | - android:layout_height="180dp" | |
| 12 | + android:layout_height="200dp" | |
| 13 | 13 | android:background="@drawable/white_shadow_bg" |
| 14 | 14 | android:orientation="vertical" |
| 15 | 15 | android:paddingLeft="15dp" | ... | ... |
moudle_pedometer/src/main/res/layout/layout_run_detail_rank.xml
moudle_pedometer/src/main/res/layout/layout_run_detail_street.xml
| ... | ... | @@ -3,7 +3,8 @@ |
| 3 | 3 | |
| 4 | 4 | <LinearLayout xmlns:FivePersonIconView="http://schemas.android.com/apk/res-auto" |
| 5 | 5 | android:layout_width="match_parent" |
| 6 | - android:layout_height="wrap_content"> | |
| 6 | + android:layout_height="wrap_content" | |
| 7 | + android:background="@color/white"> | |
| 7 | 8 | |
| 8 | 9 | <LinearLayout |
| 9 | 10 | android:id="@+id/ll_run_detail_street_root" |
| ... | ... | @@ -78,6 +79,14 @@ |
| 78 | 79 | |
| 79 | 80 | </LinearLayout> |
| 80 | 81 | </LinearLayout> |
| 82 | + | |
| 83 | + <View | |
| 84 | + android:layout_width="match_parent" | |
| 85 | + android:layout_height="1dp" | |
| 86 | + android:layout_marginLeft="35dp" | |
| 87 | + android:layout_marginRight="35dp" | |
| 88 | + android:layout_marginBottom="5dp" | |
| 89 | + android:background="@color/line" /> | |
| 81 | 90 | <!--按钮--> |
| 82 | 91 | <RelativeLayout |
| 83 | 92 | android:id="@+id/rl_start_btn" |
| ... | ... | @@ -128,8 +137,8 @@ |
| 128 | 137 | android:gravity="center_vertical"> |
| 129 | 138 | |
| 130 | 139 | <View |
| 131 | - android:layout_width="10dp" | |
| 132 | - android:layout_height="10dp" | |
| 140 | + android:layout_width="6dp" | |
| 141 | + android:layout_height="6dp" | |
| 133 | 142 | android:layout_marginLeft="25dp" |
| 134 | 143 | android:background="@drawable/shape_circle_green" /> |
| 135 | 144 | |
| ... | ... | @@ -150,6 +159,14 @@ |
| 150 | 159 | android:textColor="@color/text_black" |
| 151 | 160 | android:textSize="15sp" /> |
| 152 | 161 | </LinearLayout> |
| 162 | + <!--竖线--> | |
| 163 | + <View | |
| 164 | + android:layout_width="1dp" | |
| 165 | + android:layout_height="20dp" | |
| 166 | + android:layout_marginLeft="37dp" | |
| 167 | + android:layout_marginTop="-3dp" | |
| 168 | + android:layout_marginBottom="-13dp" | |
| 169 | + android:background="@color/vertical_line" /> | |
| 153 | 170 | <!--终点--> |
| 154 | 171 | <LinearLayout |
| 155 | 172 | android:id="@+id/ll_end_point" |
| ... | ... | @@ -160,8 +177,8 @@ |
| 160 | 177 | android:gravity="center_vertical"> |
| 161 | 178 | |
| 162 | 179 | <View |
| 163 | - android:layout_width="10dp" | |
| 164 | - android:layout_height="10dp" | |
| 180 | + android:layout_width="6dp" | |
| 181 | + android:layout_height="6dp" | |
| 165 | 182 | android:layout_marginLeft="25dp" |
| 166 | 183 | android:background="@drawable/shape_circle_red" /> |
| 167 | 184 | |
| ... | ... | @@ -242,9 +259,9 @@ |
| 242 | 259 | <View |
| 243 | 260 | android:layout_width="match_parent" |
| 244 | 261 | android:layout_height="1dp" |
| 245 | - android:layout_marginLeft="10dp" | |
| 262 | + android:layout_marginLeft="35dp" | |
| 246 | 263 | android:layout_marginTop="5dp" |
| 247 | - android:layout_marginRight="10dp" | |
| 264 | + android:layout_marginRight="35dp" | |
| 248 | 265 | android:background="@color/line" /> |
| 249 | 266 | <!--活动时间--> |
| 250 | 267 | <LinearLayout |
| ... | ... | @@ -304,9 +321,9 @@ |
| 304 | 321 | <View |
| 305 | 322 | android:layout_width="match_parent" |
| 306 | 323 | android:layout_height="1dp" |
| 307 | - android:layout_marginLeft="10dp" | |
| 324 | + android:layout_marginLeft="35dp" | |
| 308 | 325 | android:layout_marginTop="5dp" |
| 309 | - android:layout_marginRight="10dp" | |
| 326 | + android:layout_marginRight="35dp" | |
| 310 | 327 | android:background="@color/line" /> |
| 311 | 328 | <!--活动类型--> |
| 312 | 329 | <LinearLayout |
| ... | ... | @@ -347,6 +364,14 @@ |
| 347 | 364 | android:textStyle="bold" /> |
| 348 | 365 | |
| 349 | 366 | </LinearLayout> |
| 367 | + | |
| 368 | + <View | |
| 369 | + android:layout_width="match_parent" | |
| 370 | + android:layout_height="1dp" | |
| 371 | + android:layout_marginLeft="35dp" | |
| 372 | + android:layout_marginTop="5dp" | |
| 373 | + android:layout_marginRight="35dp" | |
| 374 | + android:background="@color/line" /> | |
| 350 | 375 | <!--参与人数--> |
| 351 | 376 | <LinearLayout |
| 352 | 377 | android:layout_width="match_parent" | ... | ... |
moudle_pedometer/src/main/res/layout/layout_run_detail_street_introduce.xml
| ... | ... | @@ -13,7 +13,7 @@ |
| 13 | 13 | android:id="@+id/tv_race_title" |
| 14 | 14 | android:layout_width="wrap_content" |
| 15 | 15 | android:layout_height="wrap_content" |
| 16 | - android:layout_marginTop="10dp" | |
| 16 | + android:layout_marginTop="18dp" | |
| 17 | 17 | android:text="@string/layout_run_detail_street_introduce_title" |
| 18 | 18 | android:textSize="18sp" |
| 19 | 19 | android:textStyle="bold" /> | ... | ... |
moudle_pedometer/src/main/res/values/strings.xml
| ... | ... | @@ -31,7 +31,6 @@ |
| 31 | 31 | <!--赛事详情--> |
| 32 | 32 | <string name="run_race_btn_sign_up">立即报名</string> |
| 33 | 33 | <string name="run_race_btn_start_now">现在开始</string> |
| 34 | - <string name="run_race_far_tip">您距离起点较远\n请到达起点附近再开始!</string> | |
| 35 | 34 | <!--layout_street--> |
| 36 | 35 | <string name="layout_street_active_point">活动地点</string> |
| 37 | 36 | <string name="layout_street_start_point">(起)</string> |
| ... | ... | @@ -81,14 +80,16 @@ |
| 81 | 80 | <string name="again_up">重新上传</string> |
| 82 | 81 | <string name="myrecord">我的记录</string> |
| 83 | 82 | <string name="up_fail">上传失败</string> |
| 84 | - <string name="enter_range_tip">您已回归轨迹 继续参与运动吧</string> | |
| 85 | - <string name="exit_range_tip">您已偏离路径轨迹 请您计时回归路径!</string> | |
| 86 | - <string name="more_than_pause_count_tip">您已超过最大暂停次数,无法继续比赛!</string> | |
| 83 | + <string name="enter_range_tip">您已回归轨迹继续参与运动吧</string> | |
| 84 | + <string name="exit_range_tip">您已偏离路径轨迹请您计时回归路径</string> | |
| 85 | + <string name="more_than_pause_count_tip">您已超过最大暂停次数,无法继续比赛</string> | |
| 87 | 86 | <string name="run_pause_tip">固定赛事只可暂停一次\n是否确定使用?</string> |
| 88 | 87 | <string name="add_path">添加轨迹</string> |
| 89 | 88 | <string name="addpath">绑定轨迹</string> |
| 90 | 89 | <string name="delect">删除</string> |
| 91 | 90 | <string name="no_fail_line_text_tip">没有上传失败的路线哦</string> |
| 91 | + <string name="run_race_far_tip">您距离起点较远\n请到达起点附近再开始</string> | |
| 92 | + <string name="run_race_arrive_end_tip">您已到达终点附近\n可以结束运动了</string> | |
| 92 | 93 | |
| 93 | 94 | |
| 94 | 95 | </resources> | ... | ... |