Commit 48e6ef4509254246c3682a8a5abc60bf4eabaf1b
Merge branch 'master' of bj.gitlab.cnlive.com:cnlive-team/ModulePedometer
Showing
16 changed files
with
178 additions
and
133 deletions
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/presenter/CollRunningMapFragmentPresenter.java
| @@ -287,81 +287,6 @@ public class CollRunningMapFragmentPresenter extends MvpBasePresenter<CollRunnin | @@ -287,81 +287,6 @@ public class CollRunningMapFragmentPresenter extends MvpBasePresenter<CollRunnin | ||
| 287 | } | 287 | } |
| 288 | 288 | ||
| 289 | 289 | ||
| 290 | - public void queryRealTimeTrace(Context context, String entityName, long activeTime) { | ||
| 291 | - if (realTimeListRequest == null) { | ||
| 292 | - List<String> names = new ArrayList<>(); | ||
| 293 | - names.add(entityName); | ||
| 294 | - realTimeListRequest = new LocRequest(); | ||
| 295 | - realTimeListRequest.setServiceId(Constant.SERVICE_ID); | ||
| 296 | - realTimeListRequest.setTag(Constant.TAG); | ||
| 297 | - } | ||
| 298 | - if (realTimePoints == null) { | ||
| 299 | - realTimePoints = new ArrayList<>(); | ||
| 300 | - } | ||
| 301 | - | ||
| 302 | - OnEntityListener onEntityListener = new OnEntityListener() { | ||
| 303 | - Overlay realTimeOverlay = null; | ||
| 304 | - | ||
| 305 | - @Override | ||
| 306 | - public void onEntityListCallback(EntityListResponse entityListResponse) { | ||
| 307 | - super.onEntityListCallback(entityListResponse); | ||
| 308 | - Log.e(TAG, "onEntityListCallback"); | ||
| 309 | -// Toast.makeText(context, "onEntityListCallback", Toast.LENGTH_SHORT).show(); | ||
| 310 | - } | ||
| 311 | - | ||
| 312 | - @Override | ||
| 313 | - public void onSearchEntityCallback(SearchResponse searchResponse) { | ||
| 314 | - super.onSearchEntityCallback(searchResponse); | ||
| 315 | - Log.e(TAG, "onSearchEntityCallback"); | ||
| 316 | - Toast.makeText(context, "onSearchEntityCallback", Toast.LENGTH_SHORT).show(); | ||
| 317 | - | ||
| 318 | - } | ||
| 319 | - | ||
| 320 | - @Override | ||
| 321 | - public void onBoundSearchCallback(BoundSearchResponse boundSearchResponse) { | ||
| 322 | - super.onBoundSearchCallback(boundSearchResponse); | ||
| 323 | - Log.e(TAG, "onBoundSearchCallback"); | ||
| 324 | - Toast.makeText(context, "onBoundSearchCallback", Toast.LENGTH_SHORT).show(); | ||
| 325 | - | ||
| 326 | - } | ||
| 327 | - | ||
| 328 | - @Override | ||
| 329 | - public void onAroundSearchCallback(AroundSearchResponse aroundSearchResponse) { | ||
| 330 | - super.onAroundSearchCallback(aroundSearchResponse); | ||
| 331 | - Log.e(TAG, "onAroundSearchCallback"); | ||
| 332 | - Toast.makeText(context, "onAroundSearchCallback", Toast.LENGTH_SHORT).show(); | ||
| 333 | - | ||
| 334 | - } | ||
| 335 | - | ||
| 336 | - @Override | ||
| 337 | - public void onPolygonSearchCallback(PolygonSearchResponse polygonSearchResponse) { | ||
| 338 | - super.onPolygonSearchCallback(polygonSearchResponse); | ||
| 339 | - Log.e(TAG, "onPolygonSearchCallback"); | ||
| 340 | - Toast.makeText(context, "onPolygonSearchCallback", Toast.LENGTH_SHORT).show(); | ||
| 341 | - } | ||
| 342 | - | ||
| 343 | - @Override | ||
| 344 | - public void onDistrictSearchCallback(DistrictSearchResponse districtSearchResponse) { | ||
| 345 | - super.onDistrictSearchCallback(districtSearchResponse); | ||
| 346 | - Log.e(TAG, "onDistrictSearchCallback"); | ||
| 347 | - Toast.makeText(context, "onDistrictSearchCallback", Toast.LENGTH_SHORT).show(); | ||
| 348 | - | ||
| 349 | - } | ||
| 350 | - | ||
| 351 | - /**实时定位回调接口 | ||
| 352 | - * @param traceLocation | ||
| 353 | - */ | ||
| 354 | - @Override | ||
| 355 | - public void onReceiveLocation(TraceLocation traceLocation) { | ||
| 356 | - super.onReceiveLocation(traceLocation); | ||
| 357 | - } | ||
| 358 | - }; | ||
| 359 | - //查询实时轨迹 | ||
| 360 | - if (StepService.mClient != null) { | ||
| 361 | - StepService.mClient.queryRealTimeLoc(realTimeListRequest, onEntityListener); | ||
| 362 | - } | ||
| 363 | - | ||
| 364 | - } | ||
| 365 | 290 | ||
| 366 | //创建地理围栏 | 291 | //创建地理围栏 |
| 367 | public void createFence(Context context, List<com.baidu.trace.model.LatLng> latLngs) { | 292 | public void createFence(Context context, List<com.baidu.trace.model.LatLng> latLngs) { |
| @@ -481,25 +406,25 @@ public class CollRunningMapFragmentPresenter extends MvpBasePresenter<CollRunnin | @@ -481,25 +406,25 @@ public class CollRunningMapFragmentPresenter extends MvpBasePresenter<CollRunnin | ||
| 481 | 406 | ||
| 482 | 407 | ||
| 483 | 408 | ||
| 484 | - FenceListRequest request = FenceListRequest.buildServerRequest(Constant.TAG, Constant.SERVICE_ID, "yangshuai", null, CoordType.gcj02); | ||
| 485 | - | ||
| 486 | - //发起查询围栏请求 | ||
| 487 | - if (StepService.mClient != null) { | ||
| 488 | - StepService.mClient.queryFenceList(request, onFenceListener); | ||
| 489 | - } | ||
| 490 | - | ||
| 491 | - List<Long> fenid = new ArrayList<>(); | ||
| 492 | - fenid.add(1L); | ||
| 493 | - MonitoredStatusRequest request1 = MonitoredStatusRequest.buildServerRequest(Constant.TAG, | ||
| 494 | - Constant.SERVICE_ID, "yangshuai", fenid); | ||
| 495 | - Handler handler = new Handler(); | ||
| 496 | - Runnable runnable = new Runnable() { | ||
| 497 | - @Override | ||
| 498 | - public void run() { | ||
| 499 | - StepService.mClient.queryMonitoredStatus(request1, onFenceListener); | ||
| 500 | - } | ||
| 501 | - }; | ||
| 502 | - handler.postDelayed(runnable, 5000); | 409 | +// FenceListRequest request = FenceListRequest.buildServerRequest(Constant.TAG, Constant.SERVICE_ID, "yangshuai", null, CoordType.gcj02); |
| 410 | +// | ||
| 411 | +// //发起查询围栏请求 | ||
| 412 | +// if (StepService.mClient != null) { | ||
| 413 | +// StepService.mClient.queryFenceList(request, onFenceListener); | ||
| 414 | +// } | ||
| 415 | +// | ||
| 416 | +// List<Long> fenid = new ArrayList<>(); | ||
| 417 | +// fenid.add(1L); | ||
| 418 | +// MonitoredStatusRequest request1 = MonitoredStatusRequest.buildServerRequest(Constant.TAG, | ||
| 419 | +// Constant.SERVICE_ID, "yangshuai", fenid); | ||
| 420 | +// Handler handler = new Handler(); | ||
| 421 | +// Runnable runnable = new Runnable() { | ||
| 422 | +// @Override | ||
| 423 | +// public void run() { | ||
| 424 | +// StepService.mClient.queryMonitoredStatus(request1, onFenceListener); | ||
| 425 | +// } | ||
| 426 | +// }; | ||
| 427 | +// handler.postDelayed(runnable, 5000); | ||
| 503 | } | 428 | } |
| 504 | 429 | ||
| 505 | public void query() { | 430 | public void query() { |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollRunMainFragmentView.java
| @@ -17,6 +17,7 @@ import com.baidu.location.LocationClient; | @@ -17,6 +17,7 @@ import com.baidu.location.LocationClient; | ||
| 17 | import com.baidu.location.LocationClientOption; | 17 | import com.baidu.location.LocationClientOption; |
| 18 | import com.cnlive.moudle.collectionTrace.service.CollKeepLiveService; | 18 | import com.cnlive.moudle.collectionTrace.service.CollKeepLiveService; |
| 19 | import com.cnlive.moudle.collectionTrace.service.CollStepService; | 19 | import com.cnlive.moudle.collectionTrace.service.CollStepService; |
| 20 | +import com.cnlive.moudle.collectionTrace.ui.activity.CollRunningMapActivity; | ||
| 20 | import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunMainFragment; | 21 | import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunMainFragment; |
| 21 | import com.cnlive.moudle.pedometer.commonInfo.CollCommonInfo; | 22 | import com.cnlive.moudle.pedometer.commonInfo.CollCommonInfo; |
| 22 | import com.cnlive.moudle.pedometer.model.Constant; | 23 | import com.cnlive.moudle.pedometer.model.Constant; |
| @@ -157,18 +158,36 @@ public class CollRunMainFragmentView implements MvpView { | @@ -157,18 +158,36 @@ public class CollRunMainFragmentView implements MvpView { | ||
| 157 | int hour = (int) ((SystemClock.elapsedRealtime() - chronometer.getBase()) / 1000 / 60 / 60); | 158 | int hour = (int) ((SystemClock.elapsedRealtime() - chronometer.getBase()) / 1000 / 60 / 60); |
| 158 | int minute = (int) ((SystemClock.elapsedRealtime() - chronometer.getBase()) / 1000 / 60) % 60; | 159 | int minute = (int) ((SystemClock.elapsedRealtime() - chronometer.getBase()) / 1000 / 60) % 60; |
| 159 | int second = (int) ((SystemClock.elapsedRealtime() - chronometer.getBase()) / 1000) % 60; | 160 | int second = (int) ((SystemClock.elapsedRealtime() - chronometer.getBase()) / 1000) % 60; |
| 161 | +// if (hour < 1) { | ||
| 162 | +// if (minute == 59 && second == 59) { | ||
| 163 | +// chronometer.setFormat("0" + "%s"); | ||
| 164 | +// } else { | ||
| 165 | +// chronometer.setFormat("0" + String.valueOf(hour) + ":%s"); | ||
| 166 | +// } | ||
| 167 | +// } else if (hour < 10) { | ||
| 168 | +// chronometer.setFormat("0" + "%s"); | ||
| 169 | +// } else { | ||
| 170 | +// chronometer.setFormat("%s"); | ||
| 171 | +// } | ||
| 172 | + String result = ""; | ||
| 160 | if (hour < 1) { | 173 | if (hour < 1) { |
| 161 | - if (minute == 59 && second == 59) { | ||
| 162 | - chronometer.setFormat("0" + "%s"); | ||
| 163 | - } else { | ||
| 164 | - chronometer.setFormat("0" + String.valueOf(hour) + ":%s"); | ||
| 165 | - } | ||
| 166 | - } else if (hour < 10) { | ||
| 167 | - chronometer.setFormat("0" + "%s"); | 174 | + result += "0" + hour + ":"; |
| 168 | } else { | 175 | } else { |
| 169 | - chronometer.setFormat("%s"); | 176 | + result += hour + ":"; |
| 177 | + } | ||
| 178 | + if (minute < 10) { | ||
| 179 | + result += "0" + minute + ":"; | ||
| 180 | + } else { | ||
| 181 | + result += minute + ":"; | ||
| 182 | + } | ||
| 183 | + if (second < 10) { | ||
| 184 | + result += "0" + second; | ||
| 185 | + } else { | ||
| 186 | + result += second; | ||
| 187 | + } | ||
| 188 | + if (!TextUtils.isEmpty(result)) { | ||
| 189 | + chronometer.setFormat(result); | ||
| 170 | } | 190 | } |
| 171 | - | ||
| 172 | } | 191 | } |
| 173 | }); | 192 | }); |
| 174 | 193 | ||
| @@ -422,7 +441,7 @@ public class CollRunMainFragmentView implements MvpView { | @@ -422,7 +441,7 @@ public class CollRunMainFragmentView implements MvpView { | ||
| 422 | } | 441 | } |
| 423 | runningMapBean.setDistance(fragment.binding.tvRunDistance.getText().toString()); | 442 | runningMapBean.setDistance(fragment.binding.tvRunDistance.getText().toString()); |
| 424 | runningMapBean.setCurrentSpeed(fragment.binding.tvSpeed.getText().toString()); | 443 | runningMapBean.setCurrentSpeed(fragment.binding.tvSpeed.getText().toString()); |
| 425 | - RunningMapActivity.startActivity(fragment.getActivity(), runningMapBean); | 444 | + CollRunningMapActivity.startActivity(fragment.getActivity(), runningMapBean); |
| 426 | } | 445 | } |
| 427 | }); | 446 | }); |
| 428 | 447 | ||
| @@ -452,7 +471,6 @@ public class CollRunMainFragmentView implements MvpView { | @@ -452,7 +471,6 @@ public class CollRunMainFragmentView implements MvpView { | ||
| 452 | } | 471 | } |
| 453 | 472 | ||
| 454 | 473 | ||
| 455 | - | ||
| 456 | /** | 474 | /** |
| 457 | * 更新行走距离 | 475 | * 更新行走距离 |
| 458 | * | 476 | * |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/StartTraceFragmentView.java
| @@ -117,6 +117,7 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { | @@ -117,6 +117,7 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { | ||
| 117 | * 启动计步服务 | 117 | * 启动计步服务 |
| 118 | */ | 118 | */ |
| 119 | public void startStepService(Context context) { | 119 | public void startStepService(Context context) { |
| 120 | + CollCommonInfo.setIsFirstStepSendTraceTip(getContext(),true); | ||
| 120 | QMUITipDialogUtil.loadingDialog(getContext(), "请稍后", false); | 121 | QMUITipDialogUtil.loadingDialog(getContext(), "请稍后", false); |
| 121 | if (CollCommonInfo.getStepStartTime(context) == 0) { | 122 | if (CollCommonInfo.getStepStartTime(context) == 0) { |
| 122 | CollCommonInfo.setStepStartTime(context, TimeUtil.getNowTimeStamp()); | 123 | CollCommonInfo.setStepStartTime(context, TimeUtil.getNowTimeStamp()); |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/fragment/CollRunMainFragment.java
| @@ -16,6 +16,7 @@ import com.cnlive.moudle.collectionTrace.frame.presenter.CollRunMainFragmentPres | @@ -16,6 +16,7 @@ import com.cnlive.moudle.collectionTrace.frame.presenter.CollRunMainFragmentPres | ||
| 16 | import com.cnlive.moudle.collectionTrace.frame.view.CollRunMainFragmentView; | 16 | import com.cnlive.moudle.collectionTrace.frame.view.CollRunMainFragmentView; |
| 17 | import com.cnlive.moudle.pedometer.model.Constant; | 17 | import com.cnlive.moudle.pedometer.model.Constant; |
| 18 | import com.cnlive.moudle.pedometer.model.MessageEvent; | 18 | import com.cnlive.moudle.pedometer.model.MessageEvent; |
| 19 | +import com.cnlive.moudle.pedometer.utils.TimeUtil; | ||
| 19 | import com.example.moudle_pedometer.R; | 20 | import com.example.moudle_pedometer.R; |
| 20 | import com.example.moudle_pedometer.databinding.FragmentRunMainBinding; | 21 | import com.example.moudle_pedometer.databinding.FragmentRunMainBinding; |
| 21 | 22 | ||
| @@ -124,4 +125,5 @@ public class CollRunMainFragment extends QMUIFragment<CollRunMainFragmentView, C | @@ -124,4 +125,5 @@ public class CollRunMainFragment extends QMUIFragment<CollRunMainFragmentView, C | ||
| 124 | return 0; | 125 | return 0; |
| 125 | 126 | ||
| 126 | } | 127 | } |
| 128 | + | ||
| 127 | } | 129 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/fragment/CollRunningMapFragment.java
| @@ -26,7 +26,6 @@ import com.cnlive.moudle.pedometer.utils.GsonUtil; | @@ -26,7 +26,6 @@ import com.cnlive.moudle.pedometer.utils.GsonUtil; | ||
| 26 | import com.cnlive.moudle.pedometer.utils.TimeUtil; | 26 | import com.cnlive.moudle.pedometer.utils.TimeUtil; |
| 27 | import com.example.moudle_pedometer.R; | 27 | import com.example.moudle_pedometer.R; |
| 28 | import com.example.moudle_pedometer.databinding.FragmentCollectRunningMapBinding; | 28 | import com.example.moudle_pedometer.databinding.FragmentCollectRunningMapBinding; |
| 29 | -import com.example.moudle_pedometer.databinding.FragmentRunningMapBinding; | ||
| 30 | 29 | ||
| 31 | import org.greenrobot.eventbus.EventBus; | 30 | import org.greenrobot.eventbus.EventBus; |
| 32 | import org.greenrobot.eventbus.Subscribe; | 31 | import org.greenrobot.eventbus.Subscribe; |
| @@ -118,8 +117,6 @@ public class CollRunningMapFragment extends QMUIFragment<CollRunningMapFragmentV | @@ -118,8 +117,6 @@ public class CollRunningMapFragment extends QMUIFragment<CollRunningMapFragmentV | ||
| 118 | long endTime = current; | 117 | long endTime = current; |
| 119 | // Log.e(TAG, "onViewCreated: " + "hour:" + hour + ",minute" + minute + ",second:" + second); | 118 | // Log.e(TAG, "onViewCreated: " + "hour:" + hour + ",minute" + minute + ",second:" + second); |
| 120 | getPresenter().queryHistoryTrace(getActivity(), StepService.entityName, startTime, endTime); | 119 | getPresenter().queryHistoryTrace(getActivity(), StepService.entityName, startTime, endTime); |
| 121 | - //查询实时轨迹 | ||
| 122 | -// getPresenter().queryRealTimeTrace(getActivity(), StepService.entityName, startTime); | ||
| 123 | 120 | ||
| 124 | } | 121 | } |
| 125 | 122 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/commonInfo/CommonInfo.java
| @@ -26,6 +26,24 @@ public class CommonInfo { | @@ -26,6 +26,24 @@ public class CommonInfo { | ||
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | /** | 28 | /** |
| 29 | + * 设置计步完成时间 | ||
| 30 | + * | ||
| 31 | + * @param context | ||
| 32 | + */ | ||
| 33 | + public static void setStepEndTime(Context context, long currentTime) { | ||
| 34 | + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).putLong("stepEndTime", currentTime); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * 获取计步完成时间 | ||
| 39 | + * | ||
| 40 | + * @param context | ||
| 41 | + */ | ||
| 42 | + public static long getStepEndTime(Context context) { | ||
| 43 | + return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getLong("stepEndTime", 0); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + /** | ||
| 29 | * 是否允许写入步数 | 47 | * 是否允许写入步数 |
| 30 | * | 48 | * |
| 31 | * @param context | 49 | * @param context |
| @@ -175,6 +193,27 @@ public class CommonInfo { | @@ -175,6 +193,27 @@ public class CommonInfo { | ||
| 175 | return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getInt("FenceId", -1); | 193 | return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getInt("FenceId", -1); |
| 176 | } | 194 | } |
| 177 | 195 | ||
| 196 | + /** | ||
| 197 | + * 设置用户昵称 | ||
| 198 | + * | ||
| 199 | + * @param context | ||
| 200 | + * @param nickName | ||
| 201 | + */ | ||
| 202 | + public static void setUserNickName(Context context, String nickName) { | ||
| 203 | + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).putString("RunUserNickName", nickName); | ||
| 204 | + | ||
| 205 | + } | ||
| 206 | + | ||
| 207 | + /** | ||
| 208 | + * 获取用户昵称 | ||
| 209 | + * | ||
| 210 | + * @param context | ||
| 211 | + */ | ||
| 212 | + public static void getUserNickName(Context context) { | ||
| 213 | + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getString("RunUserNickName", ""); | ||
| 214 | + | ||
| 215 | + } | ||
| 216 | + | ||
| 178 | /*重置 | 217 | /*重置 |
| 179 | * @param context | 218 | * @param context |
| 180 | */ | 219 | */ |
| @@ -188,6 +227,8 @@ public class CommonInfo { | @@ -188,6 +227,8 @@ public class CommonInfo { | ||
| 188 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("streetId"); | 227 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("streetId"); |
| 189 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("FirstStepSendTraceTip"); | 228 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("FirstStepSendTraceTip"); |
| 190 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("FenceId"); | 229 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("FenceId"); |
| 230 | + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("stepEndTime"); | ||
| 231 | + | ||
| 191 | 232 | ||
| 192 | } | 233 | } |
| 193 | 234 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/RunningMapFragmentPresenter.java
| @@ -277,7 +277,7 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | @@ -277,7 +277,7 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | ||
| 277 | for (int i = 0; i < importHash.size(); i++) { | 277 | for (int i = 0; i < importHash.size(); i++) { |
| 278 | if (!importHash.get(i)) { | 278 | if (!importHash.get(i)) { |
| 279 | result++; | 279 | result++; |
| 280 | - Log.e(TAG, "onHistoryTrackCallback: 没过:" + i + importHash.get(i)); | 280 | +// Log.e(TAG, "onHistoryTrackCallback: 没过:" + i + importHash.get(i)); |
| 281 | } | 281 | } |
| 282 | } | 282 | } |
| 283 | if (result > importPoints.size() * 0.4) { | 283 | if (result > importPoints.size() * 0.4) { |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunMainFragmentView.java
| @@ -150,7 +150,7 @@ public class RunMainFragmentView implements MvpView { | @@ -150,7 +150,7 @@ public class RunMainFragmentView implements MvpView { | ||
| 150 | if (firstTimeFlag) { | 150 | if (firstTimeFlag) { |
| 151 | firstTimeFlag = false; | 151 | firstTimeFlag = false; |
| 152 | fragment.binding.chronometer.setFormat("00:00:01"); | 152 | fragment.binding.chronometer.setFormat("00:00:01"); |
| 153 | - fragment.binding.chronometer.setBase(SystemClock.elapsedRealtime()-50000000); | 153 | + fragment.binding.chronometer.setBase(SystemClock.elapsedRealtime()); |
| 154 | fragment.binding.chronometer.start(); | 154 | fragment.binding.chronometer.start(); |
| 155 | } | 155 | } |
| 156 | } | 156 | } |
| @@ -310,10 +310,10 @@ public class RunMainFragmentView implements MvpView { | @@ -310,10 +310,10 @@ public class RunMainFragmentView implements MvpView { | ||
| 310 | public void onClick(SelectDialog dialog) { | 310 | public void onClick(SelectDialog dialog) { |
| 311 | CommonInfo.setIsRunKeepAliveService(getContext(), false); | 311 | CommonInfo.setIsRunKeepAliveService(getContext(), false); |
| 312 | CommonInfo.setIsWriteUserStep(getContext(), false); | 312 | CommonInfo.setIsWriteUserStep(getContext(), false); |
| 313 | + //设置运动结束时间 | ||
| 314 | + CommonInfo.setStepEndTime(getContext(), TimeUtil.getNowTimeStamp()); | ||
| 313 | fragment.binding.cpCurrent.setVisibility(View.GONE); | 315 | fragment.binding.cpCurrent.setVisibility(View.GONE); |
| 314 | ButtonAnimUtil.setViewDefault(fragment.binding.flStop); | 316 | ButtonAnimUtil.setViewDefault(fragment.binding.flStop); |
| 315 | - //清空数据 | ||
| 316 | - CommonInfo.reset(getContext()); | ||
| 317 | dialog.dismiss(); | 317 | dialog.dismiss(); |
| 318 | if (StepService.mClient != null) { | 318 | if (StepService.mClient != null) { |
| 319 | StepService.mClient.stopGather(StepService.traceListener); | 319 | StepService.mClient.stopGather(StepService.traceListener); |
| @@ -458,7 +458,6 @@ public class RunMainFragmentView implements MvpView { | @@ -458,7 +458,6 @@ public class RunMainFragmentView implements MvpView { | ||
| 458 | } | 458 | } |
| 459 | 459 | ||
| 460 | 460 | ||
| 461 | - | ||
| 462 | /** | 461 | /** |
| 463 | * 更新行走距离 | 462 | * 更新行走距离 |
| 464 | * | 463 | * |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunRaceDetailFragmentView.java
| @@ -46,6 +46,7 @@ import com.baidu.mapapi.search.route.WalkingRoutePlanOption; | @@ -46,6 +46,7 @@ import com.baidu.mapapi.search.route.WalkingRoutePlanOption; | ||
| 46 | import com.baidu.mapapi.search.route.WalkingRouteResult; | 46 | import com.baidu.mapapi.search.route.WalkingRouteResult; |
| 47 | import com.baidu.mapapi.utils.DistanceUtil; | 47 | import com.baidu.mapapi.utils.DistanceUtil; |
| 48 | import com.baidu.trace.model.SortType; | 48 | import com.baidu.trace.model.SortType; |
| 49 | +import com.cnlive.moudle.pedometer.commonInfo.CollCommonInfo; | ||
| 49 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | 50 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| 50 | import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; | 51 | import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; |
| 51 | import com.cnlive.moudle.pedometer.service.KeepLiveService; | 52 | import com.cnlive.moudle.pedometer.service.KeepLiveService; |
| @@ -308,7 +309,6 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -308,7 +309,6 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 308 | 309 | ||
| 309 | } | 310 | } |
| 310 | //判断用户是否报名 | 311 | //判断用户是否报名 |
| 311 | - Log.e(TAG, "initView: 是否报名"+runRaceDetailInfo.isSignResult() ); | ||
| 312 | if (runRaceDetailInfo.isSignResult()) { | 312 | if (runRaceDetailInfo.isSignResult()) { |
| 313 | fragment.binding.rlScrollViewStartBtn.setTag("1"); | 313 | fragment.binding.rlScrollViewStartBtn.setTag("1"); |
| 314 | fragment.binding.tvRunNow.setText("现在开始"); | 314 | fragment.binding.tvRunNow.setText("现在开始"); |
| @@ -396,6 +396,13 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -396,6 +396,13 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 396 | fragment.getActivity().finish(); | 396 | fragment.getActivity().finish(); |
| 397 | } | 397 | } |
| 398 | }); | 398 | }); |
| 399 | + //todo 查看排行榜点击 | ||
| 400 | + fragment.binding.includeRank.tvCatAllRank.setOnClickListener(new View.OnClickListener() { | ||
| 401 | + @Override | ||
| 402 | + public void onClick(View view) { | ||
| 403 | + | ||
| 404 | + } | ||
| 405 | + }); | ||
| 399 | } | 406 | } |
| 400 | 407 | ||
| 401 | public void initMap() { | 408 | public void initMap() { |
| @@ -853,6 +860,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -853,6 +860,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 853 | * 启动计步服务 | 860 | * 启动计步服务 |
| 854 | */ | 861 | */ |
| 855 | public void startStepService(Context context) { | 862 | public void startStepService(Context context) { |
| 863 | + CommonInfo.setIsFirstStepSendTraceTip(getContext(), true); | ||
| 856 | QMUITipDialogUtil.loadingDialog(getContext(), "请稍后", false); | 864 | QMUITipDialogUtil.loadingDialog(getContext(), "请稍后", false); |
| 857 | if (CommonInfo.getStepStartTime(context) == 0) { | 865 | if (CommonInfo.getStepStartTime(context) == 0) { |
| 858 | CommonInfo.setStepStartTime(context, TimeUtil.getNowTimeStamp()); | 866 | CommonInfo.setStepStartTime(context, TimeUtil.getNowTimeStamp()); |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/sql/dao/DaoMaster.java
| @@ -21,14 +21,14 @@ public class DaoMaster extends AbstractDaoMaster { | @@ -21,14 +21,14 @@ public class DaoMaster extends AbstractDaoMaster { | ||
| 21 | 21 | ||
| 22 | /** Creates underlying database table using DAOs. */ | 22 | /** Creates underlying database table using DAOs. */ |
| 23 | public static void createAllTables(Database db, boolean ifNotExists) { | 23 | public static void createAllTables(Database db, boolean ifNotExists) { |
| 24 | - UserStepEntityDao.createTable(db, ifNotExists); | ||
| 25 | CollUserStepEntityDao.createTable(db, ifNotExists); | 24 | CollUserStepEntityDao.createTable(db, ifNotExists); |
| 25 | + UserStepEntityDao.createTable(db, ifNotExists); | ||
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | /** Drops underlying database table using DAOs. */ | 28 | /** Drops underlying database table using DAOs. */ |
| 29 | public static void dropAllTables(Database db, boolean ifExists) { | 29 | public static void dropAllTables(Database db, boolean ifExists) { |
| 30 | - UserStepEntityDao.dropTable(db, ifExists); | ||
| 31 | CollUserStepEntityDao.dropTable(db, ifExists); | 30 | CollUserStepEntityDao.dropTable(db, ifExists); |
| 31 | + UserStepEntityDao.dropTable(db, ifExists); | ||
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | /** | 34 | /** |
| @@ -47,8 +47,8 @@ public class DaoMaster extends AbstractDaoMaster { | @@ -47,8 +47,8 @@ public class DaoMaster extends AbstractDaoMaster { | ||
| 47 | 47 | ||
| 48 | public DaoMaster(Database db) { | 48 | public DaoMaster(Database db) { |
| 49 | super(db, SCHEMA_VERSION); | 49 | super(db, SCHEMA_VERSION); |
| 50 | - registerDaoClass(UserStepEntityDao.class); | ||
| 51 | registerDaoClass(CollUserStepEntityDao.class); | 50 | registerDaoClass(CollUserStepEntityDao.class); |
| 51 | + registerDaoClass(UserStepEntityDao.class); | ||
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | public DaoSession newSession() { | 54 | public DaoSession newSession() { |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/sql/dao/DaoSession.java
| @@ -8,11 +8,11 @@ import org.greenrobot.greendao.database.Database; | @@ -8,11 +8,11 @@ import org.greenrobot.greendao.database.Database; | ||
| 8 | import org.greenrobot.greendao.identityscope.IdentityScopeType; | 8 | import org.greenrobot.greendao.identityscope.IdentityScopeType; |
| 9 | import org.greenrobot.greendao.internal.DaoConfig; | 9 | import org.greenrobot.greendao.internal.DaoConfig; |
| 10 | 10 | ||
| 11 | -import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; | ||
| 12 | import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity; | 11 | import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity; |
| 12 | +import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; | ||
| 13 | 13 | ||
| 14 | -import com.cnlive.moudle.pedometer.sql.dao.UserStepEntityDao; | ||
| 15 | import com.cnlive.moudle.pedometer.sql.dao.CollUserStepEntityDao; | 14 | import com.cnlive.moudle.pedometer.sql.dao.CollUserStepEntityDao; |
| 15 | +import com.cnlive.moudle.pedometer.sql.dao.UserStepEntityDao; | ||
| 16 | 16 | ||
| 17 | // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. | 17 | // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. |
| 18 | 18 | ||
| @@ -23,40 +23,40 @@ import com.cnlive.moudle.pedometer.sql.dao.CollUserStepEntityDao; | @@ -23,40 +23,40 @@ import com.cnlive.moudle.pedometer.sql.dao.CollUserStepEntityDao; | ||
| 23 | */ | 23 | */ |
| 24 | public class DaoSession extends AbstractDaoSession { | 24 | public class DaoSession extends AbstractDaoSession { |
| 25 | 25 | ||
| 26 | - private final DaoConfig userStepEntityDaoConfig; | ||
| 27 | private final DaoConfig collUserStepEntityDaoConfig; | 26 | private final DaoConfig collUserStepEntityDaoConfig; |
| 27 | + private final DaoConfig userStepEntityDaoConfig; | ||
| 28 | 28 | ||
| 29 | - private final UserStepEntityDao userStepEntityDao; | ||
| 30 | private final CollUserStepEntityDao collUserStepEntityDao; | 29 | private final CollUserStepEntityDao collUserStepEntityDao; |
| 30 | + private final UserStepEntityDao userStepEntityDao; | ||
| 31 | 31 | ||
| 32 | public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig> | 32 | public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig> |
| 33 | daoConfigMap) { | 33 | daoConfigMap) { |
| 34 | super(db); | 34 | super(db); |
| 35 | 35 | ||
| 36 | - userStepEntityDaoConfig = daoConfigMap.get(UserStepEntityDao.class).clone(); | ||
| 37 | - userStepEntityDaoConfig.initIdentityScope(type); | ||
| 38 | - | ||
| 39 | collUserStepEntityDaoConfig = daoConfigMap.get(CollUserStepEntityDao.class).clone(); | 36 | collUserStepEntityDaoConfig = daoConfigMap.get(CollUserStepEntityDao.class).clone(); |
| 40 | collUserStepEntityDaoConfig.initIdentityScope(type); | 37 | collUserStepEntityDaoConfig.initIdentityScope(type); |
| 41 | 38 | ||
| 42 | - userStepEntityDao = new UserStepEntityDao(userStepEntityDaoConfig, this); | 39 | + userStepEntityDaoConfig = daoConfigMap.get(UserStepEntityDao.class).clone(); |
| 40 | + userStepEntityDaoConfig.initIdentityScope(type); | ||
| 41 | + | ||
| 43 | collUserStepEntityDao = new CollUserStepEntityDao(collUserStepEntityDaoConfig, this); | 42 | collUserStepEntityDao = new CollUserStepEntityDao(collUserStepEntityDaoConfig, this); |
| 43 | + userStepEntityDao = new UserStepEntityDao(userStepEntityDaoConfig, this); | ||
| 44 | 44 | ||
| 45 | - registerDao(UserStepEntity.class, userStepEntityDao); | ||
| 46 | registerDao(CollUserStepEntity.class, collUserStepEntityDao); | 45 | registerDao(CollUserStepEntity.class, collUserStepEntityDao); |
| 46 | + registerDao(UserStepEntity.class, userStepEntityDao); | ||
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | public void clear() { | 49 | public void clear() { |
| 50 | - userStepEntityDaoConfig.clearIdentityScope(); | ||
| 51 | collUserStepEntityDaoConfig.clearIdentityScope(); | 50 | collUserStepEntityDaoConfig.clearIdentityScope(); |
| 52 | - } | ||
| 53 | - | ||
| 54 | - public UserStepEntityDao getUserStepEntityDao() { | ||
| 55 | - return userStepEntityDao; | 51 | + userStepEntityDaoConfig.clearIdentityScope(); |
| 56 | } | 52 | } |
| 57 | 53 | ||
| 58 | public CollUserStepEntityDao getCollUserStepEntityDao() { | 54 | public CollUserStepEntityDao getCollUserStepEntityDao() { |
| 59 | return collUserStepEntityDao; | 55 | return collUserStepEntityDao; |
| 60 | } | 56 | } |
| 61 | 57 | ||
| 58 | + public UserStepEntityDao getUserStepEntityDao() { | ||
| 59 | + return userStepEntityDao; | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | } | 62 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RegistrationInfoFragment.java
| @@ -135,6 +135,7 @@ public class RegistrationInfoFragment extends MvpBindingFragment<RegistrationInf | @@ -135,6 +135,7 @@ public class RegistrationInfoFragment extends MvpBindingFragment<RegistrationInf | ||
| 135 | binding.birthday.getText().toString().trim().equals("未选择") ? "" : binding.birthday.getText().toString().trim()); | 135 | binding.birthday.getText().toString().trim().equals("未选择") ? "" : binding.birthday.getText().toString().trim()); |
| 136 | } else { | 136 | } else { |
| 137 | QMUITipDialogUtil.dismessDialog(); | 137 | QMUITipDialogUtil.dismessDialog(); |
| 138 | + QMUITipDialogUtil.messageDialog(getContext(),"报名失败,请稍后重试!",2); | ||
| 138 | } | 139 | } |
| 139 | } | 140 | } |
| 140 | 141 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RunningMapFragment.java
| @@ -133,7 +133,7 @@ public class RunningMapFragment extends QMUIFragment<RunningMapFragmentView, Run | @@ -133,7 +133,7 @@ public class RunningMapFragment extends QMUIFragment<RunningMapFragmentView, Run | ||
| 133 | com.baidu.trace.model.LatLng tempLatLng = new com.baidu.trace.model.LatLng(latLng.latitude, latLng.longitude); | 133 | com.baidu.trace.model.LatLng tempLatLng = new com.baidu.trace.model.LatLng(latLng.latitude, latLng.longitude); |
| 134 | fenceLatLngs.add(tempLatLng); | 134 | fenceLatLngs.add(tempLatLng); |
| 135 | } | 135 | } |
| 136 | - getPresenter().createFence(getActivity(), fenceLatLngs); | 136 | +// getPresenter().createFence(getActivity(), fenceLatLngs); |
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | @Override | 139 | @Override |
| @@ -197,7 +197,19 @@ public class RunningMapFragment extends QMUIFragment<RunningMapFragmentView, Run | @@ -197,7 +197,19 @@ public class RunningMapFragment extends QMUIFragment<RunningMapFragmentView, Run | ||
| 197 | } | 197 | } |
| 198 | //超出范围 | 198 | //超出范围 |
| 199 | else if (messageEvent.getMessageType() == Constant.EXIT_RANGE) { | 199 | else if (messageEvent.getMessageType() == Constant.EXIT_RANGE) { |
| 200 | - ChineseToSpeechUtil.speech(getActivity().getApplicationContext(), "您已偏离预定轨迹!"); | 200 | + ChineseToSpeechUtil.speech(getActivity().getApplicationContext(), getString(R.string.exit_range_tip)); |
| 201 | + if (mVibrator != null) { | ||
| 202 | + //设置震动周期,数组表示时间:等待+执行,单位是毫秒,下面操作代表:等待100,执行100,等待100,执行1000, | ||
| 203 | + //后面的数字如果为-1代表不重复,之执行一次,其他代表会重复,0代表从数组的第0个位置开始 | ||
| 204 | + mVibrator.vibrate(new long[]{100, 1000, 100, 1000}, -1); | ||
| 205 | + } | ||
| 206 | + if (tipDialog != null) { | ||
| 207 | + tipDialog.show(); | ||
| 208 | + } | ||
| 209 | + } | ||
| 210 | + //进入范围 | ||
| 211 | + else if (messageEvent.getMessageType() == Constant.ENTER_RANGE) { | ||
| 212 | + ChineseToSpeechUtil.speech(getActivity().getApplicationContext(), getString(R.string.enter_range_tip)); | ||
| 201 | if (mVibrator != null) { | 213 | if (mVibrator != null) { |
| 202 | //设置震动周期,数组表示时间:等待+执行,单位是毫秒,下面操作代表:等待100,执行100,等待100,执行1000, | 214 | //设置震动周期,数组表示时间:等待+执行,单位是毫秒,下面操作代表:等待100,执行100,等待100,执行1000, |
| 203 | //后面的数字如果为-1代表不重复,之执行一次,其他代表会重复,0代表从数组的第0个位置开始 | 215 | //后面的数字如果为-1代表不重复,之执行一次,其他代表会重复,0代表从数组的第0个位置开始 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/TimeUtil.java
| 1 | package com.cnlive.moudle.pedometer.utils; | 1 | package com.cnlive.moudle.pedometer.utils; |
| 2 | 2 | ||
| 3 | +import android.widget.Chronometer; | ||
| 4 | + | ||
| 3 | import java.text.ParseException; | 5 | import java.text.ParseException; |
| 4 | import java.text.SimpleDateFormat; | 6 | import java.text.SimpleDateFormat; |
| 5 | import java.util.Date; | 7 | import java.util.Date; |
| @@ -95,4 +97,40 @@ public class TimeUtil { | @@ -95,4 +97,40 @@ public class TimeUtil { | ||
| 95 | SimpleDateFormat df = new SimpleDateFormat(formate); | 97 | SimpleDateFormat df = new SimpleDateFormat(formate); |
| 96 | return df.format(new Date()); | 98 | return df.format(new Date()); |
| 97 | } | 99 | } |
| 100 | + | ||
| 101 | + | ||
| 102 | + /** | ||
| 103 | + * @param cmt Chronometer控件 | ||
| 104 | + * @return 小时+分钟+秒数 的所有秒数 | ||
| 105 | + */ | ||
| 106 | + public static String getChronometerSeconds(Chronometer cmt) { | ||
| 107 | + int totalss = 0; | ||
| 108 | + String string = cmt.getText().toString(); | ||
| 109 | + if (string.length() == 7) { | ||
| 110 | + | ||
| 111 | + String[] split = string.split(":"); | ||
| 112 | + String string2 = split[0]; | ||
| 113 | + int hour = Integer.parseInt(string2); | ||
| 114 | + int Hours = hour * 3600; | ||
| 115 | + String string3 = split[1]; | ||
| 116 | + int min = Integer.parseInt(string3); | ||
| 117 | + int Mins = min * 60; | ||
| 118 | + int SS = Integer.parseInt(split[2]); | ||
| 119 | + totalss = Hours + Mins + SS; | ||
| 120 | + return String.valueOf(totalss); | ||
| 121 | + } else if (string.length() == 5) { | ||
| 122 | + | ||
| 123 | + String[] split = string.split(":"); | ||
| 124 | + String string3 = split[0]; | ||
| 125 | + int min = Integer.parseInt(string3); | ||
| 126 | + int Mins = min * 60; | ||
| 127 | + int SS = Integer.parseInt(split[1]); | ||
| 128 | + | ||
| 129 | + totalss = Mins + SS; | ||
| 130 | + return String.valueOf(totalss); | ||
| 131 | + } | ||
| 132 | + return String.valueOf(totalss); | ||
| 133 | + | ||
| 134 | + | ||
| 135 | + } | ||
| 98 | } | 136 | } |
moudle_pedometer/src/main/res/layout/layout_run_detail_rank.xml
| @@ -36,6 +36,7 @@ | @@ -36,6 +36,7 @@ | ||
| 36 | android:textStyle="bold" /> | 36 | android:textStyle="bold" /> |
| 37 | 37 | ||
| 38 | <TextView | 38 | <TextView |
| 39 | + android:id="@+id/tv_cat_all_rank" | ||
| 39 | android:layout_width="wrap_content" | 40 | android:layout_width="wrap_content" |
| 40 | android:layout_height="wrap_content" | 41 | android:layout_height="wrap_content" |
| 41 | android:layout_marginRight="10dp" | 42 | android:layout_marginRight="10dp" |
moudle_pedometer/src/main/res/values/strings.xml
| @@ -81,6 +81,8 @@ | @@ -81,6 +81,8 @@ | ||
| 81 | <string name="again_up">重新上传</string> | 81 | <string name="again_up">重新上传</string> |
| 82 | <string name="myrecord">我的记录</string> | 82 | <string name="myrecord">我的记录</string> |
| 83 | <string name="up_fail">上传失败</string> | 83 | <string name="up_fail">上传失败</string> |
| 84 | + <string name="enter_range_tip">您已回归轨迹 继续参与运动吧</string> | ||
| 85 | + <string name="exit_range_tip">您已偏离路径轨迹 请您计时回归路径!</string> | ||
| 84 | 86 | ||
| 85 | 87 | ||
| 86 | </resources> | 88 | </resources> |