Commit 72e6704226c9a01f335862f4a5ee5315e1d06fd3
1 parent
14c61e0f
1 修复用户开始运动后,点击返回按钮,赛事详情页按钮无法及时刷新问题
Showing
3 changed files
with
29 additions
and
30 deletions
config.gradle
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunRaceDetailFragmentView.java
| ... | ... | @@ -87,7 +87,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 87 | 87 | private MarkerOptions endMark; |
| 88 | 88 | private MarkerOptions startMark; |
| 89 | 89 | |
| 90 | - private LatLng firstLatLng; | |
| 90 | + private LatLng userCurrentLatLng; | |
| 91 | 91 | private Double lastX = 0.0; |
| 92 | 92 | private int mCurrentDirection = 0; |
| 93 | 93 | // private double mCurrentLat = 0.0; |
| ... | ... | @@ -432,7 +432,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 432 | 432 | fragment.binding.includeRank.tvFirstTime.setText(TimeUtil.stampToChronometer(Long.parseLong(runRaceDetailInfo.getFirstEmployTime()))); |
| 433 | 433 | } |
| 434 | 434 | //设置完成人数 |
| 435 | - if (!TextUtils.isEmpty(runRaceDetailInfo.getFinishNum())){ | |
| 435 | + if (!TextUtils.isEmpty(runRaceDetailInfo.getFinishNum())) { | |
| 436 | 436 | fragment.binding.includeRank.tvFinishPerson.setText(runRaceDetailInfo.getFinishNum()); |
| 437 | 437 | } |
| 438 | 438 | } else { |
| ... | ... | @@ -481,8 +481,8 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 481 | 481 | // RegistrationInfoActivity.newInstance(fragment.getActivity(), 1001); |
| 482 | 482 | // } else { |
| 483 | 483 | // //计算当前位置与起点坐标距离 |
| 484 | -// if (firstLatLng != null && trackPoints != null && trackPoints.size() > 0) { | |
| 485 | -// double distance = DistanceUtil.getDistance(firstLatLng, trackPoints.get(0)); | |
| 484 | +// if (userCurrentLatLng != null && trackPoints != null && trackPoints.size() > 0) { | |
| 485 | +// double distance = DistanceUtil.getDistance(userCurrentLatLng, trackPoints.get(0)); | |
| 486 | 486 | // if (distance < 20) { |
| 487 | 487 | // //开始运动 |
| 488 | 488 | // fragment.binding.includeStreet.rlStartBtn.setTag("0"); |
| ... | ... | @@ -521,8 +521,8 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 521 | 521 | //先判断是否从百度查询到赛事轨迹 |
| 522 | 522 | if (null != endLatLng && null != startLatLng) { |
| 523 | 523 | //开始比较距离 |
| 524 | - if (null != firstLatLng) { | |
| 525 | - double currentDiatance = DistanceUtil.getDistance(firstLatLng, startLatLng); | |
| 524 | + if (null != userCurrentLatLng) { | |
| 525 | + double currentDiatance = DistanceUtil.getDistance(userCurrentLatLng, startLatLng); | |
| 526 | 526 | if (currentDiatance < Constant.LOCA_START_POINT_ACCURACY) { |
| 527 | 527 | //设置终点坐标 |
| 528 | 528 | runRaceDetailInfo.setEndLatLng(GsonUtil.GsonString(endLatLng)); |
| ... | ... | @@ -945,12 +945,12 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 945 | 945 | double x = sensorEvent.values[SensorManager.DATA_X]; |
| 946 | 946 | if (Math.abs(x - lastX) > 1.0) { |
| 947 | 947 | mCurrentDirection = (int) x; |
| 948 | - if (firstLatLng != null) { | |
| 948 | + if (userCurrentLatLng != null) { | |
| 949 | 949 | followMyLocation = new MyLocationData.Builder() |
| 950 | 950 | .accuracy(mCurrentAccracy) |
| 951 | 951 | // 此处设置开发者获取到的方向信息,顺时针0-360 |
| 952 | - .direction(mCurrentDirection).latitude(firstLatLng.latitude) | |
| 953 | - .longitude(firstLatLng.longitude).build(); | |
| 952 | + .direction(mCurrentDirection).latitude(userCurrentLatLng.latitude) | |
| 953 | + .longitude(userCurrentLatLng.longitude).build(); | |
| 954 | 954 | baiduMap.setMyLocationData(followMyLocation); |
| 955 | 955 | } |
| 956 | 956 | } |
| ... | ... | @@ -1031,23 +1031,23 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 1031 | 1031 | else { |
| 1032 | 1032 | isDifferentStreet = true; |
| 1033 | 1033 | } |
| 1034 | - | |
| 1035 | - } | |
| 1036 | - | |
| 1037 | - if (null == runRaceDetailInfo) { | |
| 1038 | - return; | |
| 1039 | - } | |
| 1040 | - if (runRaceDetailInfo.isSignResult()) { | |
| 1041 | - fragment.binding.rlScrollViewStartBtn.setTag("1"); | |
| 1042 | - fragment.binding.tvRunNow.setText("现在开始"); | |
| 1043 | - fragment.binding.tvGoTip.setVisibility(View.VISIBLE); | |
| 1034 | + //判断赛事是否已经结束 | |
| 1035 | + checkTheRaceIsEnd(); | |
| 1044 | 1036 | } else { |
| 1045 | - fragment.binding.rlScrollViewStartBtn.setTag("0"); | |
| 1046 | - fragment.binding.tvRunNow.setText("立即报名"); | |
| 1047 | - fragment.binding.tvGoTip.setVisibility(View.GONE); | |
| 1037 | + if (null == runRaceDetailInfo) { | |
| 1038 | + return; | |
| 1039 | + } | |
| 1040 | + if (runRaceDetailInfo.isSignResult()) { | |
| 1041 | + fragment.binding.rlScrollViewStartBtn.setTag("1"); | |
| 1042 | + fragment.binding.tvRunNow.setText("现在开始"); | |
| 1043 | + fragment.binding.tvGoTip.setVisibility(View.VISIBLE); | |
| 1044 | + } else { | |
| 1045 | + fragment.binding.rlScrollViewStartBtn.setTag("0"); | |
| 1046 | + fragment.binding.tvRunNow.setText("立即报名"); | |
| 1047 | + fragment.binding.tvGoTip.setVisibility(View.GONE); | |
| 1048 | + } | |
| 1048 | 1049 | } |
| 1049 | - //判断赛事是否已经结束 | |
| 1050 | - checkTheRaceIsEnd(); | |
| 1050 | + | |
| 1051 | 1051 | |
| 1052 | 1052 | } |
| 1053 | 1053 | |
| ... | ... | @@ -1150,19 +1150,19 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 1150 | 1150 | } |
| 1151 | 1151 | |
| 1152 | 1152 | MapStatus.Builder builder = new MapStatus.Builder(); |
| 1153 | - firstLatLng = new LatLng(location.getLatitude(), | |
| 1153 | + userCurrentLatLng = new LatLng(location.getLatitude(), | |
| 1154 | 1154 | location.getLongitude()); |
| 1155 | 1155 | baiduMap.setMyLocationData(followMyLocation); |
| 1156 | 1156 | //没有获取到轨迹 |
| 1157 | - if ((null == queryResultPoints || queryResultPoints.size() < 1) && null != firstLatLng) { | |
| 1158 | - builder.target(firstLatLng).zoom(DEFULT_ZOOM); | |
| 1157 | + if ((null == queryResultPoints || queryResultPoints.size() < 1) && null != userCurrentLatLng) { | |
| 1158 | + builder.target(userCurrentLatLng).zoom(DEFULT_ZOOM); | |
| 1159 | 1159 | baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build())); |
| 1160 | 1160 | } |
| 1161 | 1161 | // |
| 1162 | 1162 | |
| 1163 | 1163 | // //显示当前位置图标 |
| 1164 | 1164 | // Bitmap pointBitmap = BitmapUtil.getBitmapFromDp(getContext(), BitmapFactory.decodeResource(getContext().getResources(), R.drawable.rt_ic_location), 40, 40); |
| 1165 | -// currentMark = new MarkerOptions().position(firstLatLng).icon(BitmapDescriptorFactory.fromBitmap(pointBitmap)); | |
| 1165 | +// currentMark = new MarkerOptions().position(userCurrentLatLng).icon(BitmapDescriptorFactory.fromBitmap(pointBitmap)); | |
| 1166 | 1166 | // baiduMap.addOverlay(currentMark); |
| 1167 | 1167 | |
| 1168 | 1168 | //根据几个关键点进行步行路径规划 | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/service/KeepLiveService.java