Commit 5adb3b78b0c2f4eade47af0cece0b99063ea8fdf
1 parent
89208832
1.修改计步结束逻辑
Showing
17 changed files
with
136 additions
and
89 deletions
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/fragment/CollRunRaceDetailFragment.java
| @@ -5,6 +5,7 @@ import android.hardware.Sensor; | @@ -5,6 +5,7 @@ import android.hardware.Sensor; | ||
| 5 | import android.hardware.SensorManager; | 5 | import android.hardware.SensorManager; |
| 6 | import android.os.Bundle; | 6 | import android.os.Bundle; |
| 7 | import android.support.annotation.Nullable; | 7 | import android.support.annotation.Nullable; |
| 8 | +import android.util.Log; | ||
| 8 | import android.view.View; | 9 | import android.view.View; |
| 9 | import android.widget.Button; | 10 | import android.widget.Button; |
| 10 | 11 | ||
| @@ -28,7 +29,7 @@ import static android.content.Context.SENSOR_SERVICE; | @@ -28,7 +29,7 @@ import static android.content.Context.SENSOR_SERVICE; | ||
| 28 | * @author ShinnyYang | 29 | * @author ShinnyYang |
| 29 | */ | 30 | */ |
| 30 | public class CollRunRaceDetailFragment extends QMUIFragment<CollRunRaceDetailFragmentView, CollRunRaceDetailFragmentPresenter, FragmentCollectRunRaceDetailBinding> { | 31 | public class CollRunRaceDetailFragment extends QMUIFragment<CollRunRaceDetailFragmentView, CollRunRaceDetailFragmentPresenter, FragmentCollectRunRaceDetailBinding> { |
| 31 | - private static final String TAG = "CollRunRaceDetailFragment"; | 32 | + private static final String TAG = "CollRunRaceDetail"; |
| 32 | private SensorManager mSensorManager; | 33 | private SensorManager mSensorManager; |
| 33 | 34 | ||
| 34 | @Override | 35 | @Override |
| @@ -55,6 +56,7 @@ public class CollRunRaceDetailFragment extends QMUIFragment<CollRunRaceDetailFra | @@ -55,6 +56,7 @@ public class CollRunRaceDetailFragment extends QMUIFragment<CollRunRaceDetailFra | ||
| 55 | @Override | 56 | @Override |
| 56 | public void onClick(View view) { | 57 | public void onClick(View view) { |
| 57 | //todo 自己测试用 | 58 | //todo 自己测试用 |
| 59 | + getActivity().finish(); | ||
| 58 | getActivity().startActivity(new Intent(getActivity(), RunLineActivity.class)); | 60 | getActivity().startActivity(new Intent(getActivity(), RunLineActivity.class)); |
| 59 | } | 61 | } |
| 60 | }); | 62 | }); |
| @@ -108,6 +110,7 @@ public class CollRunRaceDetailFragment extends QMUIFragment<CollRunRaceDetailFra | @@ -108,6 +110,7 @@ public class CollRunRaceDetailFragment extends QMUIFragment<CollRunRaceDetailFra | ||
| 108 | @Override | 110 | @Override |
| 109 | public void onDestroy() { | 111 | public void onDestroy() { |
| 110 | super.onDestroy(); | 112 | super.onDestroy(); |
| 113 | + | ||
| 111 | if (getMvpView() != null) { | 114 | if (getMvpView() != null) { |
| 112 | getMvpView().onDestroy(); | 115 | getMvpView().onDestroy(); |
| 113 | } | 116 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/fragment/StartTraceFragment.java
| @@ -4,6 +4,7 @@ import android.hardware.Sensor; | @@ -4,6 +4,7 @@ import android.hardware.Sensor; | ||
| 4 | import android.hardware.SensorManager; | 4 | import android.hardware.SensorManager; |
| 5 | import android.os.Bundle; | 5 | import android.os.Bundle; |
| 6 | import android.support.annotation.Nullable; | 6 | import android.support.annotation.Nullable; |
| 7 | +import android.util.Log; | ||
| 7 | import android.view.View; | 8 | import android.view.View; |
| 8 | 9 | ||
| 9 | import com.cnlive.libs.base.ui.QMUIFragment; | 10 | import com.cnlive.libs.base.ui.QMUIFragment; |
| @@ -15,6 +16,7 @@ import com.example.moudle_pedometer.databinding.FragmentStartCollectTraceBinding | @@ -15,6 +16,7 @@ import com.example.moudle_pedometer.databinding.FragmentStartCollectTraceBinding | ||
| 15 | import static android.content.Context.SENSOR_SERVICE; | 16 | import static android.content.Context.SENSOR_SERVICE; |
| 16 | 17 | ||
| 17 | public class StartTraceFragment extends QMUIFragment<StartTraceFragmentView, StartTraceFragmentPresenter, FragmentStartCollectTraceBinding> { | 18 | public class StartTraceFragment extends QMUIFragment<StartTraceFragmentView, StartTraceFragmentPresenter, FragmentStartCollectTraceBinding> { |
| 19 | + private static final String TAG = "StartTraceFragment"; | ||
| 18 | private SensorManager mSensorManager; | 20 | private SensorManager mSensorManager; |
| 19 | 21 | ||
| 20 | @Override | 22 | @Override |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/commonInfo/CommonInfo.java
| @@ -143,6 +143,10 @@ public class CommonInfo { | @@ -143,6 +143,10 @@ public class CommonInfo { | ||
| 143 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("writeUserStep"); | 143 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("writeUserStep"); |
| 144 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("stepStartTime"); | 144 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("stepStartTime"); |
| 145 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("runStepService"); | 145 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("runStepService"); |
| 146 | + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("stepStartTime"); | ||
| 147 | + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("KeepAliveService"); | ||
| 148 | + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("RunBaiduTraceService"); | ||
| 149 | + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("streetId"); | ||
| 146 | 150 | ||
| 147 | } | 151 | } |
| 148 | 152 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/RunningMapFragmentPresenter.java
| @@ -228,7 +228,11 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | @@ -228,7 +228,11 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | ||
| 228 | queryHistoryTrace(context, entityName, startTime, endTime); | 228 | queryHistoryTrace(context, entityName, startTime, endTime); |
| 229 | } else { | 229 | } else { |
| 230 | if (getView() != null) { | 230 | if (getView() != null) { |
| 231 | - | 231 | + if (trackPoints.size() == 1) { |
| 232 | + getView().setHistoryLastPoint(trackPoints.get(0)); | ||
| 233 | + } else if (trackPoints.size() > 1) { | ||
| 234 | + getView().setHistoryLastPoint(trackPoints.get(trackPoints.size() - 1)); | ||
| 235 | + } | ||
| 232 | //开始比较(杨帅的思路) | 236 | //开始比较(杨帅的思路) |
| 233 | // for (int i = 0; i < trackPoints.size(); i++) { | 237 | // for (int i = 0; i < trackPoints.size(); i++) { |
| 234 | // if (matchIndex < importPoints.size() - 1) { | 238 | // if (matchIndex < importPoints.size() - 1) { |
| @@ -262,9 +266,9 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | @@ -262,9 +266,9 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | ||
| 262 | LatLng importLatLng = importPoints.get(i); | 266 | LatLng importLatLng = importPoints.get(i); |
| 263 | for (int j = index; j < trackPoints.size(); j++) { | 267 | for (int j = index; j < trackPoints.size(); j++) { |
| 264 | double distance = DistanceUtil.getDistance(importLatLng, trackPoints.get(j)); | 268 | double distance = DistanceUtil.getDistance(importLatLng, trackPoints.get(j)); |
| 265 | - if (distance<100){ | ||
| 266 | - importHash.put(i,true); | ||
| 267 | - index=j; | 269 | + if (distance < 50) { |
| 270 | + importHash.put(i, true); | ||
| 271 | + index = j; | ||
| 268 | } | 272 | } |
| 269 | } | 273 | } |
| 270 | } | 274 | } |
| @@ -284,6 +288,7 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | @@ -284,6 +288,7 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter<RunningMapFrag | ||
| 284 | } | 288 | } |
| 285 | Log.e(TAG, "结果: " + result); | 289 | Log.e(TAG, "结果: " + result); |
| 286 | Log.e(TAG, "onHistoryTrackCallback: 轨迹点:" + trackPoints.size() + ",详情" + GsonUtil.GsonString(trackPoints)); | 290 | Log.e(TAG, "onHistoryTrackCallback: 轨迹点:" + trackPoints.size() + ",详情" + GsonUtil.GsonString(trackPoints)); |
| 291 | + | ||
| 287 | MyMapUtil.drawHistoryTrack(context, getView().baiduMap, trackPoints, SortType.asc, R.color.red, R.drawable.icon_start, R.drawable.icon_end); | 292 | MyMapUtil.drawHistoryTrack(context, getView().baiduMap, trackPoints, SortType.asc, R.color.red, R.drawable.icon_start, R.drawable.icon_end); |
| 288 | // MyMapUtil.drawMapLineRoutePoint(context, getView().baiduMap, MyMapUtil.optimizePoints(routePoints), R.color.red); | 293 | // MyMapUtil.drawMapLineRoutePoint(context, getView().baiduMap, MyMapUtil.optimizePoints(routePoints), R.color.red); |
| 289 | } | 294 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunMainFragmentView.java
| @@ -25,6 +25,7 @@ import com.cnlive.moudle.pedometer.model.RunningFinishBean; | @@ -25,6 +25,7 @@ import com.cnlive.moudle.pedometer.model.RunningFinishBean; | ||
| 25 | import com.cnlive.moudle.pedometer.model.RunningMapBean; | 25 | import com.cnlive.moudle.pedometer.model.RunningMapBean; |
| 26 | import com.cnlive.moudle.pedometer.model.Constant; | 26 | import com.cnlive.moudle.pedometer.model.Constant; |
| 27 | import com.cnlive.moudle.pedometer.model.MessageEvent; | 27 | import com.cnlive.moudle.pedometer.model.MessageEvent; |
| 28 | +import com.cnlive.moudle.pedometer.service.KeepLiveService; | ||
| 28 | import com.cnlive.moudle.pedometer.service.StepService; | 29 | import com.cnlive.moudle.pedometer.service.StepService; |
| 29 | import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; | 30 | import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; |
| 30 | import com.cnlive.moudle.pedometer.ui.activity.RunRaceDetailActivity; | 31 | import com.cnlive.moudle.pedometer.ui.activity.RunRaceDetailActivity; |
| @@ -236,6 +237,7 @@ public class RunMainFragmentView implements MvpView { | @@ -236,6 +237,7 @@ public class RunMainFragmentView implements MvpView { | ||
| 236 | public void onClick(View view) { | 237 | public void onClick(View view) { |
| 237 | //继续记录轨迹 | 238 | //继续记录轨迹 |
| 238 | if (StepService.mClient != null && StepService.traceListener != null) { | 239 | if (StepService.mClient != null && StepService.traceListener != null) { |
| 240 | + CommonInfo.setTsRunBaiduTraceService(getContext(), true); | ||
| 239 | StepService.mClient.startTrace(StepService.mTrace, StepService.traceListener); | 241 | StepService.mClient.startTrace(StepService.mTrace, StepService.traceListener); |
| 240 | } | 242 | } |
| 241 | needWriteDataFlag = true; | 243 | needWriteDataFlag = true; |
| @@ -301,6 +303,7 @@ public class RunMainFragmentView implements MvpView { | @@ -301,6 +303,7 @@ public class RunMainFragmentView implements MvpView { | ||
| 301 | SelectDialog selectDialog = new SelectDialog(fragment.getActivity(), "确定结束运动吗?", "确定", new SelectDialog.DialogInterface() { | 303 | SelectDialog selectDialog = new SelectDialog(fragment.getActivity(), "确定结束运动吗?", "确定", new SelectDialog.DialogInterface() { |
| 302 | @Override | 304 | @Override |
| 303 | public void onClick(SelectDialog dialog) { | 305 | public void onClick(SelectDialog dialog) { |
| 306 | + CommonInfo.setIsRunKeepAliveService(getContext(), false); | ||
| 304 | CommonInfo.setIsWriteUserStep(getContext(), false); | 307 | CommonInfo.setIsWriteUserStep(getContext(), false); |
| 305 | fragment.binding.cpCurrent.setVisibility(View.GONE); | 308 | fragment.binding.cpCurrent.setVisibility(View.GONE); |
| 306 | ButtonAnimUtil.setViewDefault(fragment.binding.flStop); | 309 | ButtonAnimUtil.setViewDefault(fragment.binding.flStop); |
| @@ -374,6 +377,7 @@ public class RunMainFragmentView implements MvpView { | @@ -374,6 +377,7 @@ public class RunMainFragmentView implements MvpView { | ||
| 374 | public void onClick(View view) { | 377 | public void onClick(View view) { |
| 375 | //暂停轨迹记录 | 378 | //暂停轨迹记录 |
| 376 | if (StepService.mClient != null && StepService.traceListener != null) { | 379 | if (StepService.mClient != null && StepService.traceListener != null) { |
| 380 | + CommonInfo.setTsRunBaiduTraceService(getContext(), false); | ||
| 377 | StepService.mClient.stopGather(StepService.traceListener); | 381 | StepService.mClient.stopGather(StepService.traceListener); |
| 378 | } | 382 | } |
| 379 | //将当前计时器时间戳写入数据库 | 383 | //将当前计时器时间戳写入数据库 |
| @@ -457,8 +461,11 @@ public class RunMainFragmentView implements MvpView { | @@ -457,8 +461,11 @@ public class RunMainFragmentView implements MvpView { | ||
| 457 | if (CommonInfo.getStepStartTime(context) == 0) { | 461 | if (CommonInfo.getStepStartTime(context) == 0) { |
| 458 | CommonInfo.setStepStartTime(context, TimeUtil.getNowTimeStamp()); | 462 | CommonInfo.setStepStartTime(context, TimeUtil.getNowTimeStamp()); |
| 459 | } | 463 | } |
| 460 | - Intent intent = new Intent(fragment.getActivity(), StepService.class); | ||
| 461 | - intent.putExtra("userId", userId); | 464 | + CommonInfo.setIsRunKeepAliveService(context, true); |
| 465 | + CommonInfo.setIsRunStepService(context, true); | ||
| 466 | + CommonInfo.setTsRunBaiduTraceService(context, true); | ||
| 467 | + CommonInfo.setIsWriteUserStep(context, true); | ||
| 468 | + Intent intent = new Intent(fragment.getActivity(), KeepLiveService.class); | ||
| 462 | ContextCompat.startForegroundService(fragment.getActivity(), intent); | 469 | ContextCompat.startForegroundService(fragment.getActivity(), intent); |
| 463 | 470 | ||
| 464 | } | 471 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunRaceDetailFragmentView.java
| @@ -244,7 +244,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -244,7 +244,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 244 | } | 244 | } |
| 245 | 245 | ||
| 246 | //判断是否显示个人排行榜 | 246 | //判断是否显示个人排行榜 |
| 247 | - if (!TextUtils.isEmpty(runRaceDetailInfo.getUserMileage())) { | 247 | + if (runRaceDetailInfo.isIndividualAchievement()) { |
| 248 | //显示 | 248 | //显示 |
| 249 | fragment.binding.includePersonScore.llPersonScoreRoot.setVisibility(View.VISIBLE); | 249 | fragment.binding.includePersonScore.llPersonScoreRoot.setVisibility(View.VISIBLE); |
| 250 | //设置完成人数 | 250 | //设置完成人数 |
| @@ -272,7 +272,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -272,7 +272,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 272 | fragment.binding.includePersonScore.llPersonScoreRoot.setVisibility(View.GONE); | 272 | fragment.binding.includePersonScore.llPersonScoreRoot.setVisibility(View.GONE); |
| 273 | } | 273 | } |
| 274 | //设置是否显示排行榜 | 274 | //设置是否显示排行榜 |
| 275 | - if (!TextUtils.isEmpty(runRaceDetailInfo.getFirstFaceUrl())) { | 275 | + if (runRaceDetailInfo.isRanking()) { |
| 276 | fragment.binding.includeRank.llRankRoot.setVisibility(View.VISIBLE); | 276 | fragment.binding.includeRank.llRankRoot.setVisibility(View.VISIBLE); |
| 277 | //设置第一名头像 | 277 | //设置第一名头像 |
| 278 | GlideApp.with(getContext()).load(runRaceDetailInfo.getFirstFaceUrl()).into(fragment.binding.includeRank.ivFirstPersonUrl); | 278 | GlideApp.with(getContext()).load(runRaceDetailInfo.getFirstFaceUrl()).into(fragment.binding.includeRank.ivFirstPersonUrl); |
| @@ -299,53 +299,64 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -299,53 +299,64 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 299 | GlideApp.with(getContext()).load(runRaceDetailInfo.getRoadmap()).into(fragment.binding.includeStreetIntroduce.ivRoadMao); | 299 | GlideApp.with(getContext()).load(runRaceDetailInfo.getRoadmap()).into(fragment.binding.includeStreetIntroduce.ivRoadMao); |
| 300 | 300 | ||
| 301 | } | 301 | } |
| 302 | - //开始按钮点击事件(未滑动) | ||
| 303 | - fragment.binding.includeStreet.rlStartBtn.setOnClickListener(new View.OnClickListener() { | ||
| 304 | - @Override | ||
| 305 | - public void onClick(View view) { | ||
| 306 | - if (fragment.getActivity() == null) { | ||
| 307 | - return; | ||
| 308 | - } | ||
| 309 | - //立即报名 | ||
| 310 | - if ("0".equals(fragment.binding.includeStreet.rlStartBtn.getTag())) { | ||
| 311 | - fragment.binding.includeStreet.rlStartBtn.setTag("1"); | ||
| 312 | - fragment.binding.includeStreet.tvRunNow.setText(getContext().getResources().getString(R.string.run_race_btn_start_now)); | ||
| 313 | - fragment.binding.includeStreet.tvGoTip.setVisibility(View.VISIBLE); | 302 | + //判断用户是否报名 |
| 303 | + if (runRaceDetailInfo.isSignResult()){ | ||
| 304 | + fragment.binding.rlScrollViewStartBtn.setTag("1"); | ||
| 305 | + fragment.binding.tvRunNow.setText("现在开始"); | ||
| 306 | + fragment.binding.tvGoTip.setVisibility(View.VISIBLE); | ||
| 307 | + }else { | ||
| 308 | + fragment.binding.rlScrollViewStartBtn.setTag("0"); | ||
| 309 | + fragment.binding.tvRunNow.setText("立即报名"); | ||
| 310 | + fragment.binding.tvGoTip.setVisibility(View.GONE); | ||
| 311 | + } | ||
| 314 | 312 | ||
| 315 | - //设置滑动 | ||
| 316 | - fragment.binding.rlScrollViewStartBtn.setTag("1"); | ||
| 317 | - fragment.binding.tvRunNow.setText(getContext().getResources().getString(R.string.run_race_btn_start_now)); | ||
| 318 | - fragment.binding.tvGoTip.setVisibility(View.VISIBLE); | ||
| 319 | - RegistrationInfoActivity.newInstance(fragment.getActivity(), 1001); | ||
| 320 | - } else { | ||
| 321 | - //计算当前位置与起点坐标距离 | ||
| 322 | - if (firstLatLng != null && trackPoints != null && trackPoints.size() > 0) { | ||
| 323 | - double distance = DistanceUtil.getDistance(firstLatLng, trackPoints.get(0)); | ||
| 324 | - if (distance < 20) { | ||
| 325 | - //开始运动 | ||
| 326 | - fragment.binding.includeStreet.rlStartBtn.setTag("0"); | ||
| 327 | - fragment.binding.includeStreet.tvRunNow.setText(getContext().getResources().getString(R.string.run_race_btn_sign_up)); | ||
| 328 | - fragment.binding.includeStreet.tvGoTip.setVisibility(View.GONE); | ||
| 329 | - fragment.getActivity().startActivity(new Intent(getContext(), PedometerMainActivity.class)); | ||
| 330 | - //设置滑动 | ||
| 331 | - fragment.binding.rlScrollViewStartBtn.setTag("0"); | ||
| 332 | - fragment.binding.tvRunNow.setText(getContext().getResources().getString(R.string.run_race_btn_sign_up)); | ||
| 333 | - fragment.binding.tvGoTip.setVisibility(View.GONE); | ||
| 334 | - } else { | ||
| 335 | - TipDialog tipDialog = new TipDialog(getContext(), getContext().getResources().getString(R.string.run_race_far_tip), "我知道了", R.color.green_round, new TipDialog.DialogInterface() { | ||
| 336 | - @Override | ||
| 337 | - public void onClick(TipDialog dialog) { | ||
| 338 | - dialog.dismiss(); | ||
| 339 | - } | ||
| 340 | - }); | ||
| 341 | - tipDialog.show(); | ||
| 342 | - tipDialog.setCancelable(false); | ||
| 343 | - tipDialog.setCanceledOnTouchOutside(false); | ||
| 344 | - } | ||
| 345 | - } | ||
| 346 | - } | ||
| 347 | - } | ||
| 348 | - }); | 313 | +// //开始按钮点击事件(未滑动) |
| 314 | +// fragment.binding.includeStreet.rlStartBtn.setOnClickListener(new View.OnClickListener() { | ||
| 315 | +// @Override | ||
| 316 | +// public void onClick(View view) { | ||
| 317 | +// if (fragment.getActivity() == null) { | ||
| 318 | +// return; | ||
| 319 | +// } | ||
| 320 | +// //立即报名 | ||
| 321 | +// if ("0".equals(fragment.binding.includeStreet.rlStartBtn.getTag())) { | ||
| 322 | +// fragment.binding.includeStreet.rlStartBtn.setTag("1"); | ||
| 323 | +// fragment.binding.includeStreet.tvRunNow.setText(getContext().getResources().getString(R.string.run_race_btn_start_now)); | ||
| 324 | +// fragment.binding.includeStreet.tvGoTip.setVisibility(View.VISIBLE); | ||
| 325 | +// | ||
| 326 | +// //设置滑动 | ||
| 327 | +// fragment.binding.rlScrollViewStartBtn.setTag("1"); | ||
| 328 | +// fragment.binding.tvRunNow.setText(getContext().getResources().getString(R.string.run_race_btn_start_now)); | ||
| 329 | +// fragment.binding.tvGoTip.setVisibility(View.VISIBLE); | ||
| 330 | +// RegistrationInfoActivity.newInstance(fragment.getActivity(), 1001); | ||
| 331 | +// } else { | ||
| 332 | +// //计算当前位置与起点坐标距离 | ||
| 333 | +// if (firstLatLng != null && trackPoints != null && trackPoints.size() > 0) { | ||
| 334 | +// double distance = DistanceUtil.getDistance(firstLatLng, trackPoints.get(0)); | ||
| 335 | +// if (distance < 20) { | ||
| 336 | +// //开始运动 | ||
| 337 | +// fragment.binding.includeStreet.rlStartBtn.setTag("0"); | ||
| 338 | +// fragment.binding.includeStreet.tvRunNow.setText(getContext().getResources().getString(R.string.run_race_btn_sign_up)); | ||
| 339 | +// fragment.binding.includeStreet.tvGoTip.setVisibility(View.GONE); | ||
| 340 | +// fragment.getActivity().startActivity(new Intent(getContext(), PedometerMainActivity.class)); | ||
| 341 | +// //设置滑动 | ||
| 342 | +// fragment.binding.rlScrollViewStartBtn.setTag("0"); | ||
| 343 | +// fragment.binding.tvRunNow.setText(getContext().getResources().getString(R.string.run_race_btn_sign_up)); | ||
| 344 | +// fragment.binding.tvGoTip.setVisibility(View.GONE); | ||
| 345 | +// } else { | ||
| 346 | +// TipDialog tipDialog = new TipDialog(getContext(), getContext().getResources().getString(R.string.run_race_far_tip), "我知道了", R.color.green_round, new TipDialog.DialogInterface() { | ||
| 347 | +// @Override | ||
| 348 | +// public void onClick(TipDialog dialog) { | ||
| 349 | +// dialog.dismiss(); | ||
| 350 | +// } | ||
| 351 | +// }); | ||
| 352 | +// tipDialog.show(); | ||
| 353 | +// tipDialog.setCancelable(false); | ||
| 354 | +// tipDialog.setCanceledOnTouchOutside(false); | ||
| 355 | +// } | ||
| 356 | +// } | ||
| 357 | +// } | ||
| 358 | +// } | ||
| 359 | +// }); | ||
| 349 | //开始按钮点击事件(用户进行滑动滑动) | 360 | //开始按钮点击事件(用户进行滑动滑动) |
| 350 | fragment.binding.rlScrollViewStartBtn.setOnClickListener(new View.OnClickListener() { | 361 | fragment.binding.rlScrollViewStartBtn.setOnClickListener(new View.OnClickListener() { |
| 351 | @Override | 362 | @Override |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunningMapFragmentView.java
| @@ -441,6 +441,21 @@ public class RunningMapFragmentView implements MvpView, SensorEventListener { | @@ -441,6 +441,21 @@ public class RunningMapFragmentView implements MvpView, SensorEventListener { | ||
| 441 | 441 | ||
| 442 | } | 442 | } |
| 443 | 443 | ||
| 444 | + /** | ||
| 445 | + * 设置从历史轨迹中查询到的最新点 | ||
| 446 | + * | ||
| 447 | + * @param lastPoint | ||
| 448 | + */ | ||
| 449 | + public void setHistoryLastPoint(LatLng lastPoint) { | ||
| 450 | + if (currentPoints != null) { | ||
| 451 | + currentPoints.clear(); | ||
| 452 | + currentPoints.add(lastPoint); | ||
| 453 | + } else { | ||
| 454 | + currentPoints = new ArrayList<>(); | ||
| 455 | + currentPoints.add(lastPoint); | ||
| 456 | + } | ||
| 457 | + } | ||
| 458 | + | ||
| 444 | 459 | ||
| 445 | public void onResume() { | 460 | public void onResume() { |
| 446 | if (mMapView != null) { | 461 | if (mMapView != null) { |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/service/KeepLiveService.java
| @@ -64,9 +64,6 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion | @@ -64,9 +64,6 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion | ||
| 64 | public void onCreate() { | 64 | public void onCreate() { |
| 65 | super.onCreate(); | 65 | super.onCreate(); |
| 66 | instance = this; | 66 | instance = this; |
| 67 | -// if (!ServiceUtils.isServiceRunning(getApplicationContext(), "com.cnlive.moudle.pedometer.service.StepService")) { | ||
| 68 | -// startService(new Intent(getApplicationContext(), StepService.class)); | ||
| 69 | -// } | ||
| 70 | init(); | 67 | init(); |
| 71 | initBroadCastReceiver(); | 68 | initBroadCastReceiver(); |
| 72 | handler = new Handler(); | 69 | handler = new Handler(); |
| @@ -78,13 +75,13 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion | @@ -78,13 +75,13 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion | ||
| 78 | if (isRun) { | 75 | if (isRun) { |
| 79 | handler.postDelayed(this, 5000); | 76 | handler.postDelayed(this, 5000); |
| 80 | } else { | 77 | } else { |
| 81 | -// try { | ||
| 82 | -// if (myReceiver != null) { | ||
| 83 | -// unregisterReceiver(myReceiver); | ||
| 84 | -// } | ||
| 85 | -// } catch (Exception e) { | ||
| 86 | -// Log.e(TAG, "run: "); | ||
| 87 | -// } | 78 | + try { |
| 79 | + if (myReceiver != null) { | ||
| 80 | + unregisterReceiver(myReceiver); | ||
| 81 | + } | ||
| 82 | + } catch (Exception e) { | ||
| 83 | + Log.e(TAG, "run: "); | ||
| 84 | + } | ||
| 88 | stopPlaySong(); | 85 | stopPlaySong(); |
| 89 | stopForeground(true); | 86 | stopForeground(true); |
| 90 | } | 87 | } |
| @@ -94,11 +91,6 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion | @@ -94,11 +91,6 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion | ||
| 94 | 91 | ||
| 95 | } | 92 | } |
| 96 | 93 | ||
| 97 | - @Override | ||
| 98 | - public void onTaskRemoved(Intent rootIntent) { | ||
| 99 | - super.onTaskRemoved(rootIntent); | ||
| 100 | - Log.e("onTaskRemoved", "onTaskRemoved"); | ||
| 101 | - } | ||
| 102 | 94 | ||
| 103 | /** | 95 | /** |
| 104 | * 初始化广播 | 96 | * 初始化广播 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/service/StepService.java
| @@ -48,6 +48,7 @@ import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; | @@ -48,6 +48,7 @@ import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; | ||
| 48 | import com.cnlive.moudle.pedometer.ui.activity.PedometerMainActivity; | 48 | import com.cnlive.moudle.pedometer.ui.activity.PedometerMainActivity; |
| 49 | import com.cnlive.moudle.pedometer.utils.MySpHelper; | 49 | import com.cnlive.moudle.pedometer.utils.MySpHelper; |
| 50 | import com.cnlive.moudle.pedometer.utils.ServiceUtils; | 50 | import com.cnlive.moudle.pedometer.utils.ServiceUtils; |
| 51 | +import com.cnlive.moudle.pedometer.utils.TimeUtil; | ||
| 51 | import com.example.moudle_pedometer.R; | 52 | import com.example.moudle_pedometer.R; |
| 52 | 53 | ||
| 53 | import org.greenrobot.eventbus.EventBus; | 54 | import org.greenrobot.eventbus.EventBus; |
| @@ -168,9 +169,7 @@ public class StepService extends Service implements SensorEventListener { | @@ -168,9 +169,7 @@ public class StepService extends Service implements SensorEventListener { | ||
| 168 | public void onCreate() { | 169 | public void onCreate() { |
| 169 | super.onCreate(); | 170 | super.onCreate(); |
| 170 | init(); | 171 | init(); |
| 171 | - showStartForegroundNotification(); | ||
| 172 | initBroadcastReceiver(); | 172 | initBroadcastReceiver(); |
| 173 | - CommonInfo.setIsRunKeepAliveService(getApplicationContext(), true); | ||
| 174 | if (!ServiceUtils.isServiceRunning(getApplicationContext(), "com.cnlive.moudle.pedometer.service.KeepLiveService")) { | 173 | if (!ServiceUtils.isServiceRunning(getApplicationContext(), "com.cnlive.moudle.pedometer.service.KeepLiveService")) { |
| 175 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | 174 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { |
| 176 | startForegroundService(new Intent(getApplicationContext(), KeepLiveService.class)); | 175 | startForegroundService(new Intent(getApplicationContext(), KeepLiveService.class)); |
| @@ -178,6 +177,7 @@ public class StepService extends Service implements SensorEventListener { | @@ -178,6 +177,7 @@ public class StepService extends Service implements SensorEventListener { | ||
| 178 | startService(new Intent(getApplicationContext(), KeepLiveService.class)); | 177 | startService(new Intent(getApplicationContext(), KeepLiveService.class)); |
| 179 | } | 178 | } |
| 180 | } | 179 | } |
| 180 | + showStartForegroundNotification(); | ||
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | private void initTrace() { | 183 | private void initTrace() { |
| @@ -281,8 +281,6 @@ public class StepService extends Service implements SensorEventListener { | @@ -281,8 +281,6 @@ public class StepService extends Service implements SensorEventListener { | ||
| 281 | public void onStartGatherCallback(int errorNo, String message) { | 281 | public void onStartGatherCallback(int errorNo, String message) { |
| 282 | if (StatusCodes.SUCCESS == errorNo || StatusCodes.GATHER_STARTED == errorNo) { | 282 | if (StatusCodes.SUCCESS == errorNo || StatusCodes.GATHER_STARTED == errorNo) { |
| 283 | Toast.makeText(getApplicationContext(), "开始采集", Toast.LENGTH_LONG).show(); | 283 | Toast.makeText(getApplicationContext(), "开始采集", Toast.LENGTH_LONG).show(); |
| 284 | - CommonInfo.setTsRunBaiduTraceService(getApplicationContext(), true); | ||
| 285 | - | ||
| 286 | } | 284 | } |
| 287 | } | 285 | } |
| 288 | 286 | ||
| @@ -302,7 +300,6 @@ public class StepService extends Service implements SensorEventListener { | @@ -302,7 +300,6 @@ public class StepService extends Service implements SensorEventListener { | ||
| 302 | Toast.makeText(getApplicationContext(), "停止采集", Toast.LENGTH_LONG).show(); | 300 | Toast.makeText(getApplicationContext(), "停止采集", Toast.LENGTH_LONG).show(); |
| 303 | if (mClient != null) { | 301 | if (mClient != null) { |
| 304 | mClient.stopTrace(mTrace, traceListener); | 302 | mClient.stopTrace(mTrace, traceListener); |
| 305 | - CommonInfo.setTsRunBaiduTraceService(getApplicationContext(), false); | ||
| 306 | } | 303 | } |
| 307 | } | 304 | } |
| 308 | } | 305 | } |
| @@ -353,7 +350,7 @@ public class StepService extends Service implements SensorEventListener { | @@ -353,7 +350,7 @@ public class StepService extends Service implements SensorEventListener { | ||
| 353 | mClient.startTrace(mTrace, traceListener); | 350 | mClient.startTrace(mTrace, traceListener); |
| 354 | long stepStartTime = CommonInfo.getStepStartTime(getApplicationContext()); | 351 | long stepStartTime = CommonInfo.getStepStartTime(getApplicationContext()); |
| 355 | if (stepStartTime == 0) { | 352 | if (stepStartTime == 0) { |
| 356 | - CommonInfo.getStepStartTime(getApplicationContext()); | 353 | + CommonInfo.setStepStartTime(getApplicationContext(), TimeUtil.getCurrentTime()); |
| 357 | } | 354 | } |
| 358 | } | 355 | } |
| 359 | 356 | ||
| @@ -372,7 +369,7 @@ public class StepService extends Service implements SensorEventListener { | @@ -372,7 +369,7 @@ public class StepService extends Service implements SensorEventListener { | ||
| 372 | if (!EventBus.getDefault().isRegistered(this)) { | 369 | if (!EventBus.getDefault().isRegistered(this)) { |
| 373 | EventBus.getDefault().register(this); | 370 | EventBus.getDefault().register(this); |
| 374 | } | 371 | } |
| 375 | - CommonInfo.setIsWriteUserStep(getApplicationContext(), true); | 372 | + |
| 376 | entityName = userId; | 373 | entityName = userId; |
| 377 | initTodayData(userId); | 374 | initTodayData(userId); |
| 378 | initTrace(); | 375 | initTrace(); |
| @@ -449,7 +446,7 @@ public class StepService extends Service implements SensorEventListener { | @@ -449,7 +446,7 @@ public class StepService extends Service implements SensorEventListener { | ||
| 449 | .setSmallIcon(R.mipmap.ic_launcher) | 446 | .setSmallIcon(R.mipmap.ic_launcher) |
| 450 | // .setCustomContentView(remoteViews) | 447 | // .setCustomContentView(remoteViews) |
| 451 | .setContentTitle(getResources().getString(R.string.app_name)) | 448 | .setContentTitle(getResources().getString(R.string.app_name)) |
| 452 | - .setContentText("正在记录你的运动") | 449 | + .setContentText("正在记录您的运动") |
| 453 | .setCategory(Notification.CATEGORY_SERVICE) | 450 | .setCategory(Notification.CATEGORY_SERVICE) |
| 454 | .setSound(null) | 451 | .setSound(null) |
| 455 | .setWhen(System.currentTimeMillis()) | 452 | .setWhen(System.currentTimeMillis()) |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/PedometerMainActivity.java
| @@ -22,6 +22,7 @@ import com.baidu.mapapi.CoordType; | @@ -22,6 +22,7 @@ import com.baidu.mapapi.CoordType; | ||
| 22 | import com.baidu.mapapi.SDKInitializer; | 22 | import com.baidu.mapapi.SDKInitializer; |
| 23 | import com.cnlive.libs.base.ui.QMUIFragment; | 23 | import com.cnlive.libs.base.ui.QMUIFragment; |
| 24 | import com.cnlive.libs.base.ui.QMUIFragmentActivity; | 24 | import com.cnlive.libs.base.ui.QMUIFragmentActivity; |
| 25 | +import com.cnlive.libs.base.util.StatusBarUtil; | ||
| 25 | import com.cnlive.libs.base.util.StatusBarUtil2; | 26 | import com.cnlive.libs.base.util.StatusBarUtil2; |
| 26 | import com.cnlive.moudle.pedometer.ui.fragment.RunMainFragment; | 27 | import com.cnlive.moudle.pedometer.ui.fragment.RunMainFragment; |
| 27 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; | 28 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; |
| @@ -53,7 +54,6 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | @@ -53,7 +54,6 @@ public class PedometerMainActivity extends QMUIFragmentActivity { | ||
| 53 | @Override | 54 | @Override |
| 54 | protected void onCreate(Bundle savedInstanceState) { | 55 | protected void onCreate(Bundle savedInstanceState) { |
| 55 | super.onCreate(savedInstanceState); | 56 | super.onCreate(savedInstanceState); |
| 56 | - StatusBarUtil2.setColor(this, getResources().getColor(R.color.run_main_bg), 0); | ||
| 57 | // setContentView(R.layout.activity_pedometer_main); | 57 | // setContentView(R.layout.activity_pedometer_main); |
| 58 | 58 | ||
| 59 | } | 59 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/RunRaceDetailActivity.java
| @@ -14,6 +14,7 @@ import com.baidu.mapapi.CoordType; | @@ -14,6 +14,7 @@ import com.baidu.mapapi.CoordType; | ||
| 14 | import com.baidu.mapapi.SDKInitializer; | 14 | import com.baidu.mapapi.SDKInitializer; |
| 15 | import com.cnlive.libs.base.ui.QMUIFragment; | 15 | import com.cnlive.libs.base.ui.QMUIFragment; |
| 16 | import com.cnlive.libs.base.ui.QMUIFragmentActivity; | 16 | import com.cnlive.libs.base.ui.QMUIFragmentActivity; |
| 17 | +import com.cnlive.libs.base.util.StatusBarUtil; | ||
| 17 | import com.cnlive.libs.base.util.StatusBarUtil2; | 18 | import com.cnlive.libs.base.util.StatusBarUtil2; |
| 18 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | 19 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| 19 | import com.cnlive.moudle.pedometer.model.RunningMapBean; | 20 | import com.cnlive.moudle.pedometer.model.RunningMapBean; |
| @@ -52,7 +53,6 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | @@ -52,7 +53,6 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | ||
| 52 | @Override | 53 | @Override |
| 53 | protected void onCreate(Bundle savedInstanceState) { | 54 | protected void onCreate(Bundle savedInstanceState) { |
| 54 | super.onCreate(savedInstanceState); | 55 | super.onCreate(savedInstanceState); |
| 55 | - StatusBarUtil2.setColor(this, getResources().getColor(R.color.run_main_bg), 0); | ||
| 56 | //判断用户是否结束运动 | 56 | //判断用户是否结束运动 |
| 57 | boolean isRunStep = CommonInfo.getIsRunStepService(this); | 57 | boolean isRunStep = CommonInfo.getIsRunStepService(this); |
| 58 | //没有找到相关记录 | 58 | //没有找到相关记录 |
| @@ -86,8 +86,8 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | @@ -86,8 +86,8 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity { | ||
| 86 | @Override | 86 | @Override |
| 87 | public void onBackPressed() { | 87 | public void onBackPressed() { |
| 88 | super.onBackPressed(); | 88 | super.onBackPressed(); |
| 89 | - if (fragment != null) { | ||
| 90 | - if (fragment instanceof RunMainFragment) { | 89 | + if (getCurrentFragment()!=null) { |
| 90 | + if (getCurrentFragment() instanceof RunMainFragment) { | ||
| 91 | return; | 91 | return; |
| 92 | } | 92 | } |
| 93 | } | 93 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RunMainFragment.java
| @@ -8,6 +8,7 @@ import android.util.Log; | @@ -8,6 +8,7 @@ import android.util.Log; | ||
| 8 | import android.view.View; | 8 | import android.view.View; |
| 9 | 9 | ||
| 10 | import com.cnlive.libs.base.ui.QMUIFragment; | 10 | import com.cnlive.libs.base.ui.QMUIFragment; |
| 11 | +import com.cnlive.libs.base.util.StatusBarUtil; | ||
| 11 | import com.cnlive.libs.base.util.StatusBarUtil2; | 12 | import com.cnlive.libs.base.util.StatusBarUtil2; |
| 12 | import com.cnlive.moudle.pedometer.frame.presenter.RunMainFragmentPresenter; | 13 | import com.cnlive.moudle.pedometer.frame.presenter.RunMainFragmentPresenter; |
| 13 | import com.cnlive.moudle.pedometer.frame.view.RunMainFragmentView; | 14 | import com.cnlive.moudle.pedometer.frame.view.RunMainFragmentView; |
| @@ -17,6 +18,7 @@ import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; | @@ -17,6 +18,7 @@ import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; | ||
| 17 | import com.cnlive.moudle.pedometer.utils.StepUtil; | 18 | import com.cnlive.moudle.pedometer.utils.StepUtil; |
| 18 | import com.example.moudle_pedometer.R; | 19 | import com.example.moudle_pedometer.R; |
| 19 | import com.example.moudle_pedometer.databinding.FragmentRunMainBinding; | 20 | import com.example.moudle_pedometer.databinding.FragmentRunMainBinding; |
| 21 | +import com.qmuiteam.qmui.util.QMUIStatusBarHelper; | ||
| 20 | 22 | ||
| 21 | import org.greenrobot.eventbus.EventBus; | 23 | import org.greenrobot.eventbus.EventBus; |
| 22 | import org.greenrobot.eventbus.Subscribe; | 24 | import org.greenrobot.eventbus.Subscribe; |
| @@ -29,6 +31,8 @@ public class RunMainFragment extends QMUIFragment<RunMainFragmentView, RunMainFr | @@ -29,6 +31,8 @@ public class RunMainFragment extends QMUIFragment<RunMainFragmentView, RunMainFr | ||
| 29 | @Override | 31 | @Override |
| 30 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | 32 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 31 | super.onViewCreated(view, savedInstanceState); | 33 | super.onViewCreated(view, savedInstanceState); |
| 34 | + QMUIStatusBarHelper.setStatusBarDarkMode(getActivity()); | ||
| 35 | + StatusBarUtil2.setColor(getActivity(), getResources().getColor(R.color.run_main_bg), 0); | ||
| 32 | EventBus.getDefault().register(this); | 36 | EventBus.getDefault().register(this); |
| 33 | if (getMvpView() != null) { | 37 | if (getMvpView() != null) { |
| 34 | new Handler().postDelayed(new Runnable() { | 38 | new Handler().postDelayed(new Runnable() { |
| @@ -103,6 +107,7 @@ public class RunMainFragment extends QMUIFragment<RunMainFragmentView, RunMainFr | @@ -103,6 +107,7 @@ public class RunMainFragment extends QMUIFragment<RunMainFragmentView, RunMainFr | ||
| 103 | } | 107 | } |
| 104 | } | 108 | } |
| 105 | } | 109 | } |
| 110 | + | ||
| 106 | /** | 111 | /** |
| 107 | * 屏蔽边缘返回 | 112 | * 屏蔽边缘返回 |
| 108 | * 杨帅 | 113 | * 杨帅 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RunRaceDetailFragment.java
| @@ -14,6 +14,7 @@ import android.widget.FrameLayout; | @@ -14,6 +14,7 @@ import android.widget.FrameLayout; | ||
| 14 | import android.widget.LinearLayout; | 14 | import android.widget.LinearLayout; |
| 15 | 15 | ||
| 16 | import com.cnlive.libs.base.ui.QMUIFragment; | 16 | import com.cnlive.libs.base.ui.QMUIFragment; |
| 17 | +import com.cnlive.libs.base.util.StatusBarUtil2; | ||
| 17 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | 18 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| 18 | import com.cnlive.moudle.pedometer.frame.presenter.RunRaceDetailFragmentPresenter; | 19 | import com.cnlive.moudle.pedometer.frame.presenter.RunRaceDetailFragmentPresenter; |
| 19 | import com.cnlive.moudle.pedometer.frame.view.RunRaceDetailFragmentView; | 20 | import com.cnlive.moudle.pedometer.frame.view.RunRaceDetailFragmentView; |
| @@ -24,6 +25,7 @@ import com.cnlive.moudle.pedometer.utils.ScreenUtil; | @@ -24,6 +25,7 @@ import com.cnlive.moudle.pedometer.utils.ScreenUtil; | ||
| 24 | import com.cnlive.moudle.pedometer.utils.StepUtil; | 25 | import com.cnlive.moudle.pedometer.utils.StepUtil; |
| 25 | import com.example.moudle_pedometer.R; | 26 | import com.example.moudle_pedometer.R; |
| 26 | import com.example.moudle_pedometer.databinding.FragmentRunRaceDetailBinding; | 27 | import com.example.moudle_pedometer.databinding.FragmentRunRaceDetailBinding; |
| 28 | +import com.qmuiteam.qmui.util.QMUIStatusBarHelper; | ||
| 27 | import com.sothree.slidinguppanel.SlidingUpPanelLayout; | 29 | import com.sothree.slidinguppanel.SlidingUpPanelLayout; |
| 28 | 30 | ||
| 29 | import org.greenrobot.eventbus.EventBus; | 31 | import org.greenrobot.eventbus.EventBus; |
| @@ -60,7 +62,8 @@ public class RunRaceDetailFragment extends QMUIFragment<RunRaceDetailFragmentVie | @@ -60,7 +62,8 @@ public class RunRaceDetailFragment extends QMUIFragment<RunRaceDetailFragmentVie | ||
| 60 | @Override | 62 | @Override |
| 61 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | 63 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 62 | super.onViewCreated(view, savedInstanceState); | 64 | super.onViewCreated(view, savedInstanceState); |
| 63 | - | 65 | + QMUIStatusBarHelper.setStatusBarLightMode(getActivity()); |
| 66 | + StatusBarUtil2.setColor(getActivity(), getResources().getColor(R.color.white), 0); | ||
| 64 | mSensorManager = (SensorManager) getActivity().getSystemService(SENSOR_SERVICE);//获取传感器管理服务 | 67 | mSensorManager = (SensorManager) getActivity().getSystemService(SENSOR_SERVICE);//获取传感器管理服务 |
| 65 | if (getMvpView() != null) { | 68 | if (getMvpView() != null) { |
| 66 | getMvpView().initMap(); | 69 | getMvpView().initMap(); |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RunningFinishFragment.java
| @@ -46,6 +46,8 @@ public class RunningFinishFragment extends QMUIFragment<RunningFinishFragmentVie | @@ -46,6 +46,8 @@ public class RunningFinishFragment extends QMUIFragment<RunningFinishFragmentVie | ||
| 46 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | 46 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 47 | super.onViewCreated(view, savedInstanceState); | 47 | super.onViewCreated(view, savedInstanceState); |
| 48 | StepUtil.clearRunData(getActivity(), CommonInfo.getUserId(getActivity())); | 48 | StepUtil.clearRunData(getActivity(), CommonInfo.getUserId(getActivity())); |
| 49 | + //todo测试用 | ||
| 50 | + CommonInfo.reset(getActivity()); | ||
| 49 | if (getArguments() != null) { | 51 | if (getArguments() != null) { |
| 50 | runningFinishBean = (RunningFinishBean) getArguments().getSerializable("runningFinishBean"); | 52 | runningFinishBean = (RunningFinishBean) getArguments().getSerializable("runningFinishBean"); |
| 51 | if (runningFinishBean != null) { | 53 | if (runningFinishBean != null) { |
| @@ -55,6 +57,7 @@ public class RunningFinishFragment extends QMUIFragment<RunningFinishFragmentVie | @@ -55,6 +57,7 @@ public class RunningFinishFragment extends QMUIFragment<RunningFinishFragmentVie | ||
| 55 | } | 57 | } |
| 56 | } | 58 | } |
| 57 | } | 59 | } |
| 60 | + | ||
| 58 | /** | 61 | /** |
| 59 | * 屏蔽边缘返回 | 62 | * 屏蔽边缘返回 |
| 60 | * 杨帅 | 63 | * 杨帅 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RunningMapFragment.java
| @@ -121,7 +121,7 @@ public class RunningMapFragment extends QMUIFragment<RunningMapFragmentView, Run | @@ -121,7 +121,7 @@ public class RunningMapFragment extends QMUIFragment<RunningMapFragmentView, Run | ||
| 121 | // long startTime = current - hour * 3600 * 1000 - minute * 60 * 1000 - second * 1000; | 121 | // long startTime = current - hour * 3600 * 1000 - minute * 60 * 1000 - second * 1000; |
| 122 | long endTime = current; | 122 | long endTime = current; |
| 123 | // Log.e(TAG, "onViewCreated: " + "hour:" + hour + ",minute" + minute + ",second:" + second); | 123 | // Log.e(TAG, "onViewCreated: " + "hour:" + hour + ",minute" + minute + ",second:" + second); |
| 124 | - getPresenter().queryHistoryTrace(getActivity(), StepService.entityName, startTime, endTime); | 124 | + getPresenter().queryHistoryTrace(getActivity(), StepService.entityName, 1560859257, endTime); |
| 125 | //查询实时轨迹 | 125 | //查询实时轨迹 |
| 126 | getPresenter().queryRealTimeTrace(getActivity(), StepService.entityName, startTime); | 126 | getPresenter().queryRealTimeTrace(getActivity(), StepService.entityName, startTime); |
| 127 | 127 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/TimeUtil.java
| @@ -14,7 +14,7 @@ public class TimeUtil { | @@ -14,7 +14,7 @@ public class TimeUtil { | ||
| 14 | * @return | 14 | * @return |
| 15 | */ | 15 | */ |
| 16 | public static long getCurrentTime() { | 16 | public static long getCurrentTime() { |
| 17 | - return System.currentTimeMillis() / 1000; | 17 | + return System.currentTimeMillis(); |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | /** | 20 | /** |
| @@ -73,7 +73,7 @@ public class TimeUtil { | @@ -73,7 +73,7 @@ public class TimeUtil { | ||
| 73 | * | 73 | * |
| 74 | * @return 格式化后的日期 | 74 | * @return 格式化后的日期 |
| 75 | */ | 75 | */ |
| 76 | - public static String getStampToTime(long time,String pattern) { | 76 | + public static String getStampToTime(long time, String pattern) { |
| 77 | SimpleDateFormat sdf = new SimpleDateFormat(pattern); | 77 | SimpleDateFormat sdf = new SimpleDateFormat(pattern); |
| 78 | Date date = new Date(time); | 78 | Date date = new Date(time); |
| 79 | return sdf.format(date); | 79 | return sdf.format(date); |
moudle_pedometer/src/main/res/layout/fragment_running_map.xml
| @@ -56,7 +56,7 @@ | @@ -56,7 +56,7 @@ | ||
| 56 | <TextView | 56 | <TextView |
| 57 | android:layout_width="wrap_content" | 57 | android:layout_width="wrap_content" |
| 58 | android:layout_height="wrap_content" | 58 | android:layout_height="wrap_content" |
| 59 | - android:layout_marginBottom="3dp" | 59 | + android:layout_marginBottom="4dp" |
| 60 | android:text="GPS" | 60 | android:text="GPS" |
| 61 | android:textColor="@color/text_black" | 61 | android:textColor="@color/text_black" |
| 62 | android:textSize="12sp" | 62 | android:textSize="12sp" |
| @@ -67,7 +67,7 @@ | @@ -67,7 +67,7 @@ | ||
| 67 | android:layout_width="18dp" | 67 | android:layout_width="18dp" |
| 68 | android:layout_height="5dp" | 68 | android:layout_height="5dp" |
| 69 | android:layout_marginLeft="5dp" | 69 | android:layout_marginLeft="5dp" |
| 70 | - android:layout_marginBottom="3dp" /> | 70 | + android:layout_marginBottom="4dp" /> |
| 71 | </LinearLayout> | 71 | </LinearLayout> |
| 72 | <!----> | 72 | <!----> |
| 73 | <TextView | 73 | <TextView |
| @@ -104,7 +104,7 @@ | @@ -104,7 +104,7 @@ | ||
| 104 | android:layout_width="20dp" | 104 | android:layout_width="20dp" |
| 105 | android:layout_height="20dp" | 105 | android:layout_height="20dp" |
| 106 | android:layout_gravity="center" | 106 | android:layout_gravity="center" |
| 107 | - android:layout_marginBottom="3dp" | 107 | + android:layout_marginBottom="4dp" |
| 108 | android:background="@drawable/rt_ic_location_blank" | 108 | android:background="@drawable/rt_ic_location_blank" |
| 109 | android:focusable="false" /> | 109 | android:focusable="false" /> |
| 110 | </FrameLayout> | 110 | </FrameLayout> |