Commit 71171791ca440e928830acac15fd472bcd244ffd

Authored by 杨帅
1 parent 769423bb

1 修复"线上赛事列表页"和"我的活动页列表页"显示参与人数头像异常问题

2 修复当轨迹列表相关数据没有起点和终点名称时,进入轨迹详情页,打点列表显示错误的问题
3 修复路径工具-轨迹上传成功后,轨迹列表没有刷新的问题
4 修复在我的活动界面,顶部文字展示不全的问题
5 修改路径工具打点时获取当前位置逻辑
Showing 25 changed files with 648 additions and 335 deletions
app/src/main/java/com/example/modulepedometer/MainActivity.java
... ... @@ -3,6 +3,7 @@ package com.example.modulepedometer;
3 3 import android.content.Intent;
4 4 import android.os.Bundle;
5 5 import android.support.v7.app.AppCompatActivity;
  6 +import android.text.TextUtils;
6 7 import android.view.View;
7 8  
8 9 import com.baidu.mapapi.model.LatLng;
... ... @@ -20,6 +21,7 @@ import com.cnlive.moudle.pedometer.model.Constant;
20 21 import com.cnlive.moudle.pedometer.ui.activity.MyRecordActivity;
21 22 import com.cnlive.moudle.pedometer.ui.activity.RunLineActivity;
22 23 import com.cnlive.moudle.pedometer.ui.activity.SelfRecordActivity;
  24 +import com.cnlive.moudle.pedometer.utils.MyMapUtil;
23 25  
24 26  
25 27 public class MainActivity extends AppCompatActivity {
... ... @@ -29,6 +31,7 @@ public class MainActivity extends AppCompatActivity {
29 31 super.onCreate(savedInstanceState);
30 32 setContentView(R.layout.activity_main);
31 33  
  34 +// String uid = "10535072";
32 35 String uid = "358916";
33 36 // String uid = "358689";
34 37  
... ... @@ -51,25 +54,14 @@ public class MainActivity extends AppCompatActivity {
51 54 }
52 55 });
53 56  
54   -// GeoCoder mSearch = null; // 搜索模块,也可去掉地图模块独立使用
55   -// mSearch = GeoCoder.newInstance();
56   -// mSearch.setOnGetGeoCodeResultListener(new OnGetGeoCoderResultListener() {
  57 +// MyMapUtil.getGeoCoderResult(new LatLng(39.934805, 116.308686), new MyMapUtil.GeoCodeResult() {
57 58 // @Override
58   -// public void onGetGeoCodeResult(GeoCodeResult geoCodeResult) {
59   -// AlertUtil.showDeftToast(getApplicationContext(),geoCodeResult.getAddress());
60   -// }
61   -//
62   -// @Override
63   -// public void onGetReverseGeoCodeResult(ReverseGeoCodeResult reverseGeoCodeResult) {
64   -// AlertUtil.showDeftToast(getApplicationContext(),reverseGeoCodeResult.getAddress());
65   -//
  59 +// public void success(String address) {
  60 +// if (null != address && !TextUtils.isEmpty(address)) {
  61 +// AlertUtil.showDeftToast(MainActivity.this, address);
  62 +// }
66 63 // }
67 64 // });
68   -// mSearch.reverseGeoCode(new ReverseGeoCodeOption()
69   -// .location(new LatLng(39.933946, 116.309374))
70   -// .pageSize(1)
71   -// .pageNum(100)
72   -// .radius(10));
73 65  
74 66 }
75 67 }
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/presenter/CollRunningFinishFragmetPresenter.java
... ... @@ -16,6 +16,8 @@ import com.cnlive.moudle.collectionTrace.frame.view.CollRunningFinishFragmentVie
16 16 import com.cnlive.moudle.collectionTrace.model.CollectPoint;
17 17 import com.cnlive.moudle.collectionTrace.utils.CollStepUtil;
18 18 import com.cnlive.moudle.pedometer.commonInfo.CommonInfo;
  19 +import com.cnlive.moudle.pedometer.model.Constant;
  20 +import com.cnlive.moudle.pedometer.model.MessageEvent;
19 21 import com.cnlive.moudle.pedometer.net.ApiServiceRunLin;
20 22 import com.cnlive.moudle.pedometer.net.SubscriptionRequest;
21 23 import com.cnlive.moudle.pedometer.net.bean.BaseInfo;
... ... @@ -30,6 +32,8 @@ import com.cnlive.moudle.pedometer.utils.StepUtil;
30 32 import com.example.moudle_pedometer.R;
31 33 import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter;
32 34  
  35 +import org.greenrobot.eventbus.EventBus;
  36 +
33 37 import java.util.HashMap;
34 38 import java.util.List;
35 39 import java.util.Map;
... ... @@ -144,6 +148,7 @@ public class CollRunningFinishFragmetPresenter extends MvpBasePresenter<CollRunn
144 148 if (getView() == null) {
145 149 return;
146 150 }
  151 + EventBus.getDefault().post(new MessageEvent(Constant.UPDATA_COLL_TRACE_LIST, ""));
147 152 QMUITipDialogUtil.dismessDialog();
148 153 QMUITipDialogUtil.successDialog(context, "数据上传成功", 1);
149 154 //清空数据
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollRunningMapFragmentView.java
... ... @@ -52,6 +52,7 @@ import com.cnlive.moudle.pedometer.utils.ButtonAnimUtil;
52 52 import com.cnlive.moudle.collectionTrace.utils.CollStepUtil;
53 53 import com.cnlive.moudle.pedometer.utils.GsonUtil;
54 54 import com.cnlive.moudle.pedometer.utils.MyMapUtil;
  55 +import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil;
55 56 import com.cnlive.moudle.pedometer.utils.TimeUtil;
56 57 import com.example.moudle_pedometer.R;
57 58 import com.hannesdorfmann.mosby3.mvp.MvpView;
... ... @@ -258,15 +259,36 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener
258 259 //更新可打点数量
259 260 int remainNum = updataCanTakePointCount();
260 261 if (remainNum != 0) {
  262 +// if (null != followMyLocation) {
  263 +// currentImportLatLng = new LatLng(followMyLocation.latitude, followMyLocation.longitude);
  264 +// }
  265 +// //获取当前地点
  266 +// if (!TextUtils.isEmpty(currentAddress)) {
  267 +// selectDialog.setTipMessage("确定在" + "\"" + currentAddress + "\"" + "打点?");
  268 +// selectDialog.show();
  269 +// } else {
  270 +// isShowFollowAddress = true;
  271 +// Toast.makeText(getContext(), "正在获取当前地点信息,请稍后", Toast.LENGTH_SHORT).show();
  272 +// }
  273 +
261 274 if (null != followMyLocation) {
262 275 currentImportLatLng = new LatLng(followMyLocation.latitude, followMyLocation.longitude);
263   - }
264   - //获取当前地点
265   - if (!TextUtils.isEmpty(currentAddress)) {
266   - selectDialog.setTipMessage("确定在" + "\"" + currentAddress + "\"" + "打点?");
267   - selectDialog.show();
  276 + QMUITipDialogUtil.loadingDialog(getContext(), "正在获取位置信息...", false);
  277 + MyMapUtil.getGeoCoderResult(new LatLng(followMyLocation.latitude, followMyLocation.longitude), new MyMapUtil.GeoCodeResult() {
  278 + @Override
  279 + public void success(String address) {
  280 + if (null == getContext()) {
  281 + return;
  282 + }
  283 + QMUITipDialogUtil.dismessDialog();
  284 + if (null != address && !TextUtils.isEmpty(address)) {
  285 + currentAddress = address;
  286 + selectDialog.setTipMessage("确定在" + "\"" + currentAddress + "\"" + "打点?");
  287 + selectDialog.show();
  288 + }
  289 + }
  290 + });
268 291 } else {
269   - isShowFollowAddress = true;
270 292 Toast.makeText(getContext(), "正在获取当前地点信息,请稍后", Toast.LENGTH_SHORT).show();
271 293 }
272 294 } else {
... ... @@ -286,14 +308,29 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener
286 308 } else {
287 309 if (null != followMyLocation) {
288 310 currentImportLatLng = new LatLng(followMyLocation.latitude, followMyLocation.longitude);
289   - //获取当前地点
290   - if (!TextUtils.isEmpty(currentAddress)) {
291   - endSelectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设为结束地点?");
292   - endSelectDialog.show();
293   - } else {
294   - isShowEndFollowAddress = true;
295   - Toast.makeText(getContext(), "正在获取当前地点信息,请稍后", Toast.LENGTH_SHORT).show();
296   - }
  311 +// //获取当前地点
  312 +// if (!TextUtils.isEmpty(currentAddress)) {
  313 +// endSelectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设为结束地点?");
  314 +// endSelectDialog.show();
  315 +// } else {
  316 +// isShowEndFollowAddress = true;
  317 +// Toast.makeText(getContext(), "正在获取当前地点信息,请稍后", Toast.LENGTH_SHORT).show();
  318 +// }
  319 + QMUITipDialogUtil.loadingDialog(getContext(), "正在获取位置信息...", false);
  320 + MyMapUtil.getGeoCoderResult(new LatLng(followMyLocation.latitude, followMyLocation.longitude), new MyMapUtil.GeoCodeResult() {
  321 + @Override
  322 + public void success(String address) {
  323 + if (null == getContext()) {
  324 + return;
  325 + }
  326 + QMUITipDialogUtil.dismessDialog();
  327 + if (null != address && !TextUtils.isEmpty(address)) {
  328 + currentAddress = address;
  329 + endSelectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设为结束地点?");
  330 + endSelectDialog.show();
  331 + }
  332 + }
  333 + });
297 334 } else {
298 335 isShowEndFollowAddress = true;
299 336 Toast.makeText(getContext(), "正在获取当前地点信息,请稍后", Toast.LENGTH_SHORT).show();
... ... @@ -567,93 +604,6 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener
567 604 if (location == null || mMapView == null || getContext() == null) {
568 605 return;
569 606 }
570   -
571   -// if (followMyLocation == null || followMyLocation.latitude == 0 || followMyLocation.longitude == 0) {
572   -// return;
573   -// }
574   - MapStatus.Builder builder = new MapStatus.Builder();
575   - //第一次定位
576   - if (isFirstLoc) {
577   - isFirstLoc = false;
578   - mCurrentAccracy = location.getRadius();
579   - followMyLocation = new MyLocationData.Builder()
580   - .accuracy(location.getRadius())
581   - // 此处设置开发者获取到的方向信息,顺时针0-360
582   - .direction(mCurrentDirection).latitude(location.getLatitude())
583   - .longitude(location.getLongitude()).build();
584   -
585   - baiduMap.setMyLocationData(followMyLocation);
586   - builder.target(new LatLng(followMyLocation.latitude, followMyLocation.longitude)).zoom(DEFULT_ZOOM);
587   - baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
588   - } else {
589   - //不是第一次定位状态
590   - //过滤定位精度
591   - if (location.getRadius() > Constant.LOCA_ACCURACY) {
592   - return;
593   - }
594   - mCurrentAccracy = location.getRadius();
595   - followMyLocation = new MyLocationData.Builder()
596   - .accuracy(location.getRadius())
597   - // 此处设置开发者获取到的方向信息,顺时针0-360
598   - .direction(mCurrentDirection).latitude(location.getLatitude())
599   - .longitude(location.getLongitude()).build();
600   - if (null != currentWalkPoints && currentWalkPoints.size() > 0) {
601   - //进行判断
602   - LatLng lastLatLng = currentWalkPoints.get(currentWalkPoints.size() - 1);
603   - LatLng curLatLng = new LatLng(location.getLatitude(),
604   - location.getLongitude());
605   - if (DistanceUtil.getDistance(lastLatLng, curLatLng) > 0.5) {
606   - currentWalkPoints.add(curLatLng);
607   - }
608   - } else {
609   - currentWalkPoints.add(new LatLng(location.getLatitude(),
610   - location.getLongitude()));
611   - }
612   -
613   - //判断当前集合列表是否可以划线(至少两个点)
614   - if (currentWalkPoints != null && currentWalkPoints.size() > 1) {
615   - //判断当前是否已经在地图上画点
616   - if (currentLine != null) {
617   - currentLine.remove();
618   - }
619   - currentLine = MyMapUtil.drawMapLine(getContext(), baiduMap, currentWalkPoints, R.color.green_round);
620   - }
621   - }
622   - if (location.hasAddr()) {
623   - if (!TextUtils.isEmpty(location.getAddress().address)) {
624   - currentAddress = location.getAddress().address;
625   - }
626   - }
627   - if (TextUtils.isEmpty(currentAddress)) {
628   - if (null != location.getAddress()) {
629   - currentAddress = location.getAddress().address;
630   - }
631   - }
632   -
633   - if (isShowFollowAddress && !TextUtils.isEmpty(currentAddress)) {
634   - if (isShowFollowAddress && selectDialog != null && !selectDialog.isShowing()) {
635   - if (!TextUtils.isEmpty(currentAddress)) {
636   - selectDialog.setTipMessage("确定在" + "\"" + currentAddress + "\"" + "打点?");
637   - if (!selectDialog.isShowing()) {
638   - selectDialog.show();
639   - }
640   - isShowFollowAddress = false;
641   - }
642   - }
643   - }
644   - //结束按钮
645   - if (isShowEndFollowAddress && !TextUtils.isEmpty(currentAddress)) {
646   - if (isShowEndFollowAddress && endSelectDialog != null && !endSelectDialog.isShowing()) {
647   - if (!TextUtils.isEmpty(currentAddress)) {
648   - endSelectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设为结束地点?");
649   - if (!endSelectDialog.isShowing()) {
650   - endSelectDialog.show();
651   - }
652   - isShowEndFollowAddress = false;
653   - }
654   - }
655   - }
656   -
657 607 //正在搜索GPS信号
658 608 if (location.getGpsAccuracyStatus() == BDLocation.GPS_ACCURACY_UNKNOWN) {
659 609 if (fragment.binding.tvGpsPopBg.getVisibility() != View.VISIBLE) {
... ... @@ -703,6 +653,88 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener
703 653 fragment.binding.ivGpsState.setBackground(getContext().getResources().getDrawable(R.drawable.rt_training_gps_3));
704 654 }
705 655 }
  656 +// if (followMyLocation == null || followMyLocation.latitude == 0 || followMyLocation.longitude == 0) {
  657 +// return;
  658 +// }
  659 + MapStatus.Builder builder = new MapStatus.Builder();
  660 + mCurrentAccracy = location.getRadius();
  661 + followMyLocation = new MyLocationData.Builder()
  662 + .accuracy(location.getRadius())
  663 + // 此处设置开发者获取到的方向信息,顺时针0-360
  664 + .direction(mCurrentDirection).latitude(location.getLatitude())
  665 + .longitude(location.getLongitude()).build();
  666 + //第一次定位
  667 + if (isFirstLoc) {
  668 + isFirstLoc = false;
  669 + baiduMap.setMyLocationData(followMyLocation);
  670 + builder.target(new LatLng(followMyLocation.latitude, followMyLocation.longitude)).zoom(DEFULT_ZOOM);
  671 + baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
  672 + } else {
  673 + //不是第一次定位状态
  674 + //过滤定位精度
  675 + if (location.getRadius() > Constant.LOCA_ACCURACY) {
  676 + return;
  677 + }
  678 + if (null != currentWalkPoints) {
  679 + if (currentWalkPoints.size() > 0) {
  680 + //进行判断
  681 + LatLng lastLatLng = currentWalkPoints.get(currentWalkPoints.size() - 1);
  682 + LatLng curLatLng = new LatLng(location.getLatitude(),
  683 + location.getLongitude());
  684 + if (DistanceUtil.getDistance(lastLatLng, curLatLng) > 0.5) {
  685 + currentWalkPoints.add(curLatLng);
  686 + }
  687 + }
  688 + } else {
  689 + currentWalkPoints.add(new LatLng(location.getLatitude(),
  690 + location.getLongitude()));
  691 + }
  692 +
  693 + //判断当前集合列表是否可以划线(至少两个点)
  694 + if (currentWalkPoints != null && currentWalkPoints.size() > 1) {
  695 + //判断当前是否已经在地图上画点
  696 + if (currentLine != null) {
  697 + currentLine.remove();
  698 + }
  699 + currentLine = MyMapUtil.drawMapLine(getContext(), baiduMap, currentWalkPoints, R.color.green_round);
  700 + }
  701 + }
  702 +// if (location.hasAddr()) {
  703 +// if (!TextUtils.isEmpty(location.getAddress().address)) {
  704 +// currentAddress = location.getAddress().address;
  705 +// }
  706 +// }
  707 +// if (TextUtils.isEmpty(currentAddress)) {
  708 +// if (null != location.getAddress()) {
  709 +// currentAddress = location.getAddress().address;
  710 +// }
  711 +// }
  712 +//
  713 +// if (isShowFollowAddress && !TextUtils.isEmpty(currentAddress)) {
  714 +// if (isShowFollowAddress && selectDialog != null && !selectDialog.isShowing()) {
  715 +// if (!TextUtils.isEmpty(currentAddress)) {
  716 +// selectDialog.setTipMessage("确定在" + "\"" + currentAddress + "\"" + "打点?");
  717 +// if (!selectDialog.isShowing()) {
  718 +// selectDialog.show();
  719 +// }
  720 +// isShowFollowAddress = false;
  721 +// }
  722 +// }
  723 +// }
  724 +// //结束按钮
  725 +// if (isShowEndFollowAddress && !TextUtils.isEmpty(currentAddress)) {
  726 +// if (isShowEndFollowAddress && endSelectDialog != null && !endSelectDialog.isShowing()) {
  727 +// if (!TextUtils.isEmpty(currentAddress)) {
  728 +// endSelectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设为结束地点?");
  729 +// if (!endSelectDialog.isShowing()) {
  730 +// endSelectDialog.show();
  731 +// }
  732 +// isShowEndFollowAddress = false;
  733 +// }
  734 +// }
  735 +// }
  736 +
  737 +
706 738 }
707 739  
708 740  
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollTraceListDetailFragmentView.java
... ... @@ -204,6 +204,11 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener
204 204 startLocation.setPointName(eventShoeLinesBean.getStartLocation());
205 205 startLocation.setLatitude(0);
206 206 startLocation.setLongitude(0);
  207 + }else {
  208 + startLocation = new CollectPoint();
  209 + startLocation.setPointName("");
  210 + startLocation.setLatitude(0);
  211 + startLocation.setLongitude(0);
207 212 }
208 213 //设置终点
209 214 CollectPoint endLocation = null;
... ... @@ -212,6 +217,11 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener
212 217 endLocation.setPointName(eventShoeLinesBean.getEndLocation());
213 218 endLocation.setLatitude(0);
214 219 endLocation.setLongitude(0);
  220 + }else {
  221 + endLocation = new CollectPoint();
  222 + endLocation.setPointName("");
  223 + endLocation.setLatitude(0);
  224 + endLocation.setLongitude(0);
215 225 }
216 226 if (null != startLocation) {
217 227 if (null == allCollectPoints) {
... ... @@ -274,7 +284,7 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener
274 284 }
275 285 if (resultPoints.size() > 1) {
276 286 MyMapUtil.drawHistoryTrack(getContext(), baiduMap, resultPoints, SortType.asc, R.color.green_round, R.drawable.icon_start, R.drawable.icon_end);
277   - MyMapUtil.setMapAutoZoom(baiduMap, resultPoints, -1.5f);
  287 + MyMapUtil.setMapAutoZoom(baiduMap, resultPoints, -0.5f);
278 288  
279 289  
280 290 //获取打点不为空
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/StartTraceFragmentView.java
... ... @@ -44,6 +44,7 @@ import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity;
44 44 import com.cnlive.moudle.pedometer.ui.widget.SelectDialog;
45 45 import com.cnlive.moudle.pedometer.utils.BitmapUtil;
46 46 import com.cnlive.moudle.pedometer.utils.GsonUtil;
  47 +import com.cnlive.moudle.pedometer.utils.MyMapUtil;
47 48 import com.cnlive.moudle.pedometer.utils.NetUtil;
48 49 import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil;
49 50 import com.cnlive.moudle.pedometer.utils.ServiceUtils;
... ... @@ -61,7 +62,7 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener {
61 62 private BitmapDescriptor mCurrentMarker;//定位图标
62 63 private static int accuracyCircleFillColor;
63 64 private static int accuracyCircleStrokeColor;
64   - private static MyLocationData followMyLocation;
  65 + private MyLocationData followMyLocation;
65 66 private LatLng currentLatLng;
66 67 private Double lastX = 0.0;
67 68 private int mCurrentDirection = 0;
... ... @@ -117,17 +118,32 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener {
117 118 fragment.binding.btnIdentify.setOnClickListener(new View.OnClickListener() {
118 119 @Override
119 120 public void onClick(View view) {
120   -// if (!NetUtil.isNetworkConnected(getContext())) {
121   -// AlertUtil.showDeftToast(getContext(), "无法连接网络,请稍后重试");
122   -// } else {
123 121 //获取当前地点
124   - if (!TextUtils.isEmpty(currentAddress)) {
125   - selectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设置开始地点?");
126   - selectDialog.show();
  122 +// if (!TextUtils.isEmpty(currentAddress)) {
  123 +// selectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设置开始地点?");
  124 +// selectDialog.show();
  125 +// } else {
  126 +// isShowFollowAddress = true;
  127 +// Toast.makeText(getContext(), "正在获取当前地点信息,请稍后", Toast.LENGTH_SHORT).show();
  128 +// }
  129 + if (null != followMyLocation) {
  130 + QMUITipDialogUtil.loadingDialog(getContext(), "正在获取位置信息...", false);
  131 + MyMapUtil.getGeoCoderResult(new LatLng(followMyLocation.latitude, followMyLocation.longitude), new MyMapUtil.GeoCodeResult() {
  132 + @Override
  133 + public void success(String address) {
  134 + QMUITipDialogUtil.dismessDialog();
  135 + if (null != address && !TextUtils.isEmpty(address)) {
  136 + currentAddress = address;
  137 + selectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设置开始地点?");
  138 + selectDialog.show();
  139 + }
  140 + }
  141 + });
127 142 } else {
128   - isShowFollowAddress = true;
129 143 Toast.makeText(getContext(), "正在获取当前地点信息,请稍后", Toast.LENGTH_SHORT).show();
130 144 }
  145 +
  146 +
131 147 }
132 148 // }
133 149 });
... ... @@ -272,8 +288,10 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener {
272 288 }
273 289  
274 290 private void stopStepService() {
275   -
276   -
  291 + CollCommonInfo.setIsRunKeepAliveService(getContext(), false);
  292 + CollCommonInfo.setIsRunStepService(getContext(), false);
  293 + CollCommonInfo.setTsRunBaiduTraceService(getContext(), false);
  294 + CollCommonInfo.setIsWriteUserStep(getContext(), false);
277 295 if (CollStepService.mClient != null) {
278 296 CollStepService.mClient.stopGather(CollStepService.traceListener);
279 297 }
... ... @@ -405,51 +423,40 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener {
405 423 if (location == null || mMapView == null) {
406 424 return;
407 425 }
408   - if (isFirstLoc) {
409   - isFirstLoc = false;
410   - Toast.makeText(getContext(), "当前定位误差为:" + location.getRadius() + "米,请您移动至空旷地带!", Toast.LENGTH_SHORT).show();
411 426  
412   - }
413   -// if (location.getRadius() > Constant.LOCA_ACCURACY) {
414   -// Toast.makeText(getContext(), "当前定位精度为:" + location.getRadius() + "米,请您移动至空旷地带!", Toast.LENGTH_SHORT).show();
415   -// }
416   -// } else {
417 427 //过滤定位精度
418 428 if (location.getRadius() > Constant.LOCA_ACCURACY) {
419 429 return;
420 430 }
421   -// }
  431 + currentLatLng = new LatLng(location.getLatitude(),
  432 + location.getLongitude());
422 433 followMyLocation = new MyLocationData.Builder()
423 434 .accuracy(location.getRadius())
424 435 // 此处设置开发者获取到的方向信息,顺时针0-360
425 436 .direction(location.getDirection()).latitude(location.getLatitude())
426 437 .longitude(location.getLongitude()).build();
427   - if (location.hasAddr()) {
428   - if (!TextUtils.isEmpty(location.getAddress().address)) {
429   - currentAddress = location.getAddress().address;
430   - }
431   - }
432   - if (isShowFollowAddress && selectDialog != null && !selectDialog.isShowing()) {
433   - if (!TextUtils.isEmpty(currentAddress)) {
434   - selectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设置开始地点?");
435   - if (!selectDialog.isShowing()) {
436   - selectDialog.show();
437   - }
438   - }
439   - }
440   - if (followMyLocation == null || followMyLocation.latitude == 0 || followMyLocation.longitude == 0) {
441   - return;
  438 + if (isFirstLoc) {
  439 + isFirstLoc = false;
  440 + Toast.makeText(getContext(), "当前定位误差为:" + location.getRadius() + "米,请您移动至空旷地带!", Toast.LENGTH_SHORT).show();
  441 + baiduMap.setMyLocationData(followMyLocation);
  442 + MapStatus.Builder builder = new MapStatus.Builder();
  443 + builder.target(currentLatLng).zoom(DEFULT_ZOOM);
  444 + baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
442 445 }
  446 +// if (location.hasAddr()) {
  447 +// if (!TextUtils.isEmpty(location.getAddress().address)) {
  448 +// currentAddress = location.getAddress().address;
  449 +// }
  450 +// }
  451 +// if (isShowFollowAddress && selectDialog != null && !selectDialog.isShowing()) {
  452 +// if (!TextUtils.isEmpty(currentAddress)) {
  453 +// selectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设置开始地点?");
  454 +// if (!selectDialog.isShowing()) {
  455 +// selectDialog.show();
  456 +// }
  457 +// }
  458 +// }
443 459  
444   - MapStatus.Builder builder = new MapStatus.Builder();
445   -
446   -// if (isFirstLoc) {
447   -// isFirstLoc = false;
448   - currentLatLng = new LatLng(location.getLatitude(),
449   - location.getLongitude());
450   - baiduMap.setMyLocationData(followMyLocation);
451   - builder.target(currentLatLng).zoom(DEFULT_ZOOM);
452   - baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
453 460  
454 461 }
455 462 }
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/StartCollectTraceActivity.java
... ... @@ -4,9 +4,12 @@ import android.Manifest;
4 4 import android.app.Activity;
5 5 import android.content.Context;
6 6 import android.content.Intent;
  7 +import android.content.pm.PackageManager;
  8 +import android.net.Uri;
7 9 import android.os.Bundle;
8 10 import android.provider.Settings;
9 11 import android.support.annotation.NonNull;
  12 +import android.support.v4.app.ActivityCompat;
10 13 import android.util.Log;
11 14 import android.widget.Toast;
12 15  
... ... @@ -17,7 +20,11 @@ import com.cnlive.libs.base.util.StatusBarUtil2;
17 20 import com.cnlive.moudle.collectionTrace.commonInfo.CollCommonInfo;
18 21 import com.cnlive.moudle.collectionTrace.ui.fragment.StartTraceFragment;
19 22 import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo;
  23 +import com.cnlive.moudle.pedometer.ui.activity.RunRaceDetailActivity;
  24 +import com.cnlive.moudle.pedometer.ui.widget.SelectDialog;
  25 +import com.cnlive.moudle.pedometer.utils.CheckUtil;
20 26 import com.cnlive.moudle.pedometer.utils.MyMapUtil;
  27 +import com.cnlive.moudle.pedometer.utils.NotificationUtil;
21 28 import com.cnlive.moudle.pedometer.utils.lib_permisshelper.PermissionsListener;
22 29 import com.cnlive.moudle.pedometer.utils.lib_permisshelper.PermissionsUtils;
23 30 import com.example.moudle_pedometer.R;
... ... @@ -26,6 +33,8 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity {
26 33  
27 34 private PermissionsUtils mPermissionsUtils;//权限申请
28 35 private RunRaceDetailInfo runRaceDetailInfo;
  36 + private int permissionRequestCount = 0;//权限请求次数
  37 + private SelectDialog selectDialog;
29 38  
30 39 public static void newInstance(Context context, String eventId, RunRaceDetailInfo runRaceDetailInfo) {
31 40 CollCommonInfo.setStreetId(context, eventId);
... ... @@ -49,13 +58,29 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity {
49 58 if (null != getIntent().getExtras()) {
50 59 runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().getSerializable("runRaceDetailInfo");
51 60 }
52   -
  61 + initPermissionDefineTip();
53 62 }
54 63  
55 64 @Override
56 65 protected void onResume() {
57 66 super.onResume();
58   - getPermissionsWithTip();
  67 + boolean isOpen = NotificationUtil.isOpenNotification(this);
  68 + if (isOpen) {
  69 + //判断GPS是否开启
  70 + if (!MyMapUtil.isOPenGps(getApplicationContext())) {
  71 + Toast.makeText(getApplicationContext(), getString(R.string.open_gps_tip), Toast.LENGTH_LONG).show();
  72 + //开启GPS
  73 + Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
  74 + startActivityForResult(intent, 10);
  75 + } else {
  76 + boolean isSetBattery = CheckUtil.isIgnoringBatteryOptimizationss(StartCollectTraceActivity.this);
  77 + if (!isSetBattery) {
  78 + isSetBattery = CheckUtil.isIgnoringBatteryOptimizationss(StartCollectTraceActivity.this);
  79 + } else {
  80 + getPermissionsWithTip();
  81 + }
  82 + }
  83 + }
59 84 }
60 85  
61 86 private void addFragment(QMUIFragment fragment) {
... ... @@ -76,6 +101,9 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity {
76 101 * 一次申请一组权限(使用拒绝弹框)点击事件
77 102 */
78 103 public void getPermissionsWithTip() {
  104 + if (1 == permissionRequestCount) {
  105 + return;
  106 + }
79 107 mPermissionsUtils
80 108 .setPermissionsListener(new PermissionsListener() {
81 109 @Override
... ... @@ -121,6 +149,29 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity {
121 149 // , Manifest.permission.ACCESS_FINE_LOCATION);
122 150 }
123 151  
  152 + private void initPermissionDefineTip() {
  153 + selectDialog = new SelectDialog(StartCollectTraceActivity.this, "您尚未授予程序运行所需权限\n是否设置?",
  154 + "返回", new SelectDialog.DialogInterface() {
  155 + @Override
  156 + public void onClick(SelectDialog dialog) {
  157 + dialog.dismiss();
  158 + finish();
  159 + }
  160 + }, "设置", new SelectDialog.DialogInterface() {
  161 + @Override
  162 + public void onClick(SelectDialog dialog) {
  163 + dialog.dismiss();
  164 +// if (!ActivityCompat.shouldShowRequestPermissionRationale(this, permissions[i])) {
  165 +// showToast("点击权限,并打开全部权限");
  166 + Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
  167 + Uri uri = Uri.fromParts("package", getPackageName(), null);
  168 + intent.setData(uri);
  169 + startActivityForResult(intent, 0);
  170 + permissionRequestCount = 0;
  171 +// }
  172 + }
  173 + });
  174 + }
124 175  
125 176 /**
126 177 * 权限回调
... ... @@ -133,6 +184,31 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity {
133 184 public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
134 185 @NonNull int[] grantResults) {
135 186 super.onRequestPermissionsResult(requestCode, permissions, grantResults);
136   - mPermissionsUtils.dealResult(requestCode, permissions, grantResults);
  187 + if (1 == permissionRequestCount) {
  188 + return;
  189 + }
  190 + boolean isShowPermissionTip = true;
  191 + for (int i = 0; i < grantResults.length; i++) {//判断权限的结果,如果有被拒绝,就return
  192 + if (grantResults[i] == PackageManager.PERMISSION_DENIED) {
  193 + if (!ActivityCompat.shouldShowRequestPermissionRationale(this, permissions[i])) {
  194 + isShowPermissionTip = false;
  195 + break;
  196 + }
  197 + }
  198 + }
  199 + if (isShowPermissionTip) {
  200 + mPermissionsUtils.dealResult(requestCode, permissions, grantResults);
  201 + } else {
  202 + if (0 == permissionRequestCount) {
  203 + selectDialog.setCancelable(false);
  204 + selectDialog.setCanceledOnTouchOutside(false);
  205 + if (!selectDialog.isShowing()) {
  206 + selectDialog.show();
  207 + permissionRequestCount = 1;
  208 + }
  209 + } else {
  210 + return;
  211 + }
  212 + }
137 213 }
138 214 }
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/fragment/RaceNameListFragment.java
... ... @@ -98,5 +98,12 @@ public class RaceNameListFragment extends MvpBindingFragment&lt;RaceNameListView, R
98 98 getMvpView().delectShoeLine(Integer.parseInt(messageEvent.getMessageContent()+""));
99 99 }
100 100 }
  101 + //轨迹上传成功,更新轨迹列表
  102 + else if(messageEvent.getMessageType() == Constant.UPDATA_COLL_TRACE_LIST){
  103 + if (getMvpView() != null&&null!=getPresenter()) {
  104 + currentPage = 1;
  105 + getPresenter().setData(getActivity(), eventId, currentPage, pageSize);
  106 + }
  107 + }
101 108 }
102 109 }
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/RunningFinishFragmetPresenter.java
... ... @@ -17,6 +17,7 @@ import com.cnlive.libs.base.logic.callback.SuccessCallback;
17 17 import com.cnlive.moudle.pedometer.commonInfo.CommonInfo;
18 18 import com.cnlive.moudle.pedometer.frame.view.RunningFinishFragmentView;
19 19 import com.cnlive.moudle.pedometer.model.Constant;
  20 +import com.cnlive.moudle.pedometer.model.MessageEvent;
20 21 import com.cnlive.moudle.pedometer.model.RunningFinishBean;
21 22 import com.cnlive.moudle.pedometer.net.ApiServiceRunLin;
22 23 import com.cnlive.moudle.pedometer.net.SubscriptionRequest;
... ... @@ -32,6 +33,8 @@ import com.cnlive.moudle.pedometer.utils.StepUtil;
32 33 import com.example.moudle_pedometer.R;
33 34 import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter;
34 35  
  36 +import org.greenrobot.eventbus.EventBus;
  37 +
35 38 import java.util.ArrayList;
36 39 import java.util.HashMap;
37 40 import java.util.List;
... ... @@ -135,11 +138,12 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter&lt;RunningFinis
135 138 dialog.dismiss();
136 139 StepUtil.clearRunData(context, CommonInfo.getUserId(context));
137 140 CommonInfo.reset(context);
  141 + //用户跑完了,更新一下按钮
  142 + EventBus.getDefault().post(new MessageEvent(Constant.UPDATE_RACE_STATE_BTN, ""));
138 143 //跳转到上传失败列表
139 144 LineUpAgainActivity.newInstance(context);
140 145 //关闭当前窗口
141 146 context.finish();
142   -
143 147 }
144 148 });
145 149 uploadFailDialog.setCanceledOnTouchOutside(false);
... ... @@ -170,7 +174,8 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter&lt;RunningFinis
170 174 //删除当前跑步数据
171 175 StepUtil.clearRunData(context, CommonInfo.getUserId(context));
172 176 CommonInfo.reset(context);
173   -
  177 + //用户跑完了,更新一下按钮
  178 + EventBus.getDefault().post(new MessageEvent(Constant.UPDATE_RACE_STATE_BTN, ""));
174 179 }
175 180 }).start();
176 181 }
... ... @@ -346,11 +351,12 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter&lt;RunningFinis
346 351 dialog.dismiss();
347 352 StepUtil.clearRunData(context, CommonInfo.getUserId(context));
348 353 CommonInfo.reset(context);
  354 + //用户跑完了,更新一下按钮
  355 + EventBus.getDefault().post(new MessageEvent(Constant.UPDATE_RACE_STATE_BTN,""));
349 356 //跳转到上传失败列表
350 357 LineUpAgainActivity.newInstance(context);
351 358 //关闭当前窗口
352 359 context.finish();
353   -
354 360 }
355 361 });
356 362 failTraceDialog.setCanceledOnTouchOutside(false);
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/RunningMapFragmentPresenter.java
... ... @@ -336,14 +336,14 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter&lt;RunningMapFrag
336 336 }
337 337 }
338 338 if (importPoints != null && resultPoints != null) {
339   - boolean isFinish = MyMapUtil.checkIsFinishTrace(importPoints, resultPoints, 0.6);
340   - if (isFinish) {
341   - Toast.makeText(context, "已完成", Toast.LENGTH_LONG).show();
342   -
343   - } else {
344   - Toast.makeText(context, "没有完成", Toast.LENGTH_LONG).show();
345   -
346   - }
  339 +// boolean isFinish = MyMapUtil.checkIsFinishTrace(importPoints, resultPoints, 0.6);
  340 +// if (isFinish) {
  341 +// Toast.makeText(context, "已完成", Toast.LENGTH_LONG).show();
  342 +//
  343 +// } else {
  344 +// Toast.makeText(context, "没有完成", Toast.LENGTH_LONG).show();
  345 +//
  346 +// }
347 347 if (isPause) {
348 348 MyMapUtil.drawRealTimeTrack(context, getView().baiduMap, resultPoints, SortType.asc, R.color.red, R.drawable.icon_start);
349 349 } else {
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/OnGoingFragmentView.java
... ... @@ -238,7 +238,7 @@ public class OnGoingFragmentView implements MvpView {
238 238 fragment.binding.includeStreet.tvAddress.setText(runRaceDetailInfo.getAddress());
239 239 //设置活动距离
240 240 if (!TextUtils.isEmpty(runRaceDetailInfo.getMileage())) {
241   - fragment.binding.includeStreet.tvAddress.append("\t\t" + runRaceDetailInfo.getMileage());
  241 + fragment.binding.includeStreet.tvAddress.append("\t\t" + runRaceDetailInfo.getMileage()+"公里");
242 242 }
243 243 }
244 244  
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunRaceDetailFragmentView.java
... ... @@ -113,10 +113,14 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
113 113 private final float DEFAULT_MAP_AUTO_ZOOM = -0.8f;//根据点位,自动缩放的比例
114 114 private List<LatLng> queryResultPoints;//查询到的历史轨迹
115 115 private List<String> joinFaceIcon;//参与活动人数
116   - private final String REGIST_RACE = "0";//立即报名
117   - private final String START_RACE = "1";//立即开始
118   - private final String CONTINUE_RACE = "2";//继续运动
119   - private final String END_RACE = "3";//运动已结束
  116 + private final String BTN_REGIST_NOT_START = "1";//报名未开始
  117 + private final String BTN_REGIST_RACE = "2";//立即报名
  118 + private final String BTN_RACE_NOT_START = "3";//活动未开始
  119 + private final String BTN_REGIST_TIME_GONE = "4";//过了报名时间
  120 + private final String BTN_START_RACE = "5";//立即开始
  121 + private final String BTN_END_RACE = "6";//赛事已结束
  122 + private final String BTN_CONTINUE_RACE = "7";//继续运动
  123 +
120 124  
121 125 public RunRaceDetailFragmentView(RunRaceDetailFragment fragment) {
122 126 this.fragment = fragment;
... ... @@ -176,6 +180,10 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
176 180 // fragment.binding.includeStreet.rlStartBtn.setVisibility(View.VISIBLE);
177 181 //设置底部卡片第一次可滑动的位置
178 182 fragment.binding.slidingLayout.setAnchorPoint(0.6f);
  183 + LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
  184 + layoutParams.setMargins(ScreenUtil.dip2px(getContext(), 15), 0, ScreenUtil.dip2px(getContext(), 15), 0);
  185 + fragment.binding.includeStreet.llFirstPanelRoot.setLayoutParams(layoutParams);
  186 + fragment.binding.includeStreet.llBottomPanel.setLayoutParams(layoutParams);
179 187 fragment.binding.slidingLayout.addPanelSlideListener(new SlidingUpPanelLayout.PanelSlideListener() {
180 188 @Override
181 189 public void onPanelSlide(View panel, float slideOffset) {
... ... @@ -455,17 +463,20 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
455 463 GlideApp.with(getContext()).load(runRaceDetailInfo.getRoadmap()).into(fragment.binding.includeStreetIntroduce.ivRoadMao);
456 464  
457 465 }
458   - //判断用户是否报名
459   - if (runRaceDetailInfo.isSignResult()) {
460   - fragment.binding.rlScrollViewStartBtn.setTag(START_RACE);
461   - fragment.binding.tvRunNow.setText("现在开始");
462   - fragment.binding.tvGoTip.setVisibility(View.VISIBLE);
463   - checkStartBtnState();
464   - } else {
465   - fragment.binding.rlScrollViewStartBtn.setTag(REGIST_RACE);
466   - fragment.binding.tvRunNow.setText("立即报名");
467   - fragment.binding.tvGoTip.setVisibility(View.GONE);
468   - }
  466 + //判断按钮状态
  467 + initStartBtnState(runRaceDetailInfo);
  468 + checkStartBtnState();
  469 +// //判断用户是否报名
  470 +// if (runRaceDetailInfo.isSignResult()) {
  471 +// fragment.binding.rlScrollViewStartBtn.setTag(BTN_START_RACE);
  472 +// fragment.binding.tvRunNow.setText("现在开始");
  473 +// fragment.binding.tvGoTip.setVisibility(View.VISIBLE);
  474 +// checkStartBtnState();
  475 +// } else {
  476 +// fragment.binding.rlScrollViewStartBtn.setTag(BTN_REGIST_RACE);
  477 +// fragment.binding.tvRunNow.setText("立即报名");
  478 +// fragment.binding.tvGoTip.setVisibility(View.GONE);
  479 +// }
469 480  
470 481 // //开始按钮点击事件(未滑动)
471 482 // fragment.binding.includeStreet.rlStartBtn.setOnClickListener(new View.OnClickListener() {
... ... @@ -518,14 +529,27 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
518 529 fragment.binding.rlScrollViewStartBtn.setOnClickListener(new View.OnClickListener() {
519 530 @Override
520 531 public void onClick(View view) {
  532 + //-报名未开始
  533 + if (BTN_REGIST_NOT_START.equals(fragment.binding.rlScrollViewStartBtn.getTag())) {
  534 + return;
  535 + }
521 536 //立即报名
522   - if (REGIST_RACE.equals(fragment.binding.rlScrollViewStartBtn.getTag())) {
  537 + else if (BTN_REGIST_RACE.equals(fragment.binding.rlScrollViewStartBtn.getTag())) {
523 538 if (null != runRaceDetailInfo) {
524 539 RegistrationInfoActivity.newInstance(fragment.getActivity(), runRaceDetailInfo.getFenceId());
525 540 }
526 541 }
  542 + //活动未开始
  543 + else if (BTN_RACE_NOT_START.equals(fragment.binding.rlScrollViewStartBtn.getTag())) {
  544 + return;
  545 + }
  546 + //过了报名时间
  547 + else if (BTN_REGIST_TIME_GONE.equals(fragment.binding.rlScrollViewStartBtn.getTag())) {
  548 + return;
  549 + }
  550 + //
527 551 //现在开始
528   - else if (START_RACE.equals(fragment.binding.rlScrollViewStartBtn.getTag())) {
  552 + else if (BTN_START_RACE.equals(fragment.binding.rlScrollViewStartBtn.getTag())) {
529 553 //先判断是否从百度查询到赛事轨迹
530 554 if (null != endLatLng && null != startLatLng) {
531 555 //开始比较距离
... ... @@ -554,7 +578,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
554 578 }
555 579 }
556 580 //继续运动
557   - else if (CONTINUE_RACE.equals(fragment.binding.rlScrollViewStartBtn.getTag())) {
  581 + else if (BTN_CONTINUE_RACE.equals(fragment.binding.rlScrollViewStartBtn.getTag())) {
558 582 if (!isDifferentStreet) {
559 583 SelectDialog continueTipDialog = new SelectDialog(getContext(), "是否继续运动", "否", new SelectDialog.DialogInterface() {
560 584 @Override
... ... @@ -568,7 +592,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
568 592 dialog.dismiss();
569 593 //重置按钮
570 594 fragment.binding.tvRunNow.setText("立即开始");
571   - fragment.binding.rlScrollViewStartBtn.setTag(START_RACE);
  595 + fragment.binding.rlScrollViewStartBtn.setTag(BTN_START_RACE);
572 596 }
573 597 }, "是", new SelectDialog.DialogInterface() {
574 598 @Override
... ... @@ -597,7 +621,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
597 621 CommonInfo.resetRace(getContext());
598 622 //更改当前按钮
599 623 fragment.binding.tvRunNow.setText("立即开始");
600   - fragment.binding.rlScrollViewStartBtn.setTag(START_RACE);
  624 + fragment.binding.rlScrollViewStartBtn.setTag(BTN_START_RACE);
601 625  
602 626 }
603 627 }, "是", new SelectDialog.DialogInterface() {
... ... @@ -611,8 +635,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
611 635 selectDialog.setCancelable(false);
612 636 selectDialog.show();
613 637 }
614   - } else if (END_RACE.equals(fragment.binding.rlScrollViewStartBtn.getTag())) {
615   - AlertUtil.showDeftToast(getContext(), "赛事已结束");
  638 + } else if (BTN_END_RACE.equals(fragment.binding.rlScrollViewStartBtn.getTag())) {
616 639 return;
617 640 }
618 641 }
... ... @@ -648,6 +671,56 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
648 671 });
649 672 }
650 673  
  674 + /**
  675 + * 设置报名按钮状态
  676 + *
  677 + * @param runRaceDetailInfo
  678 + */
  679 + private void initStartBtnState(RunRaceDetailInfo runRaceDetailInfo) {
  680 + //报名未开始
  681 + if (BTN_REGIST_NOT_START.equals(runRaceDetailInfo.getEventState())) {
  682 + fragment.binding.rlScrollViewStartBtn.setTag(BTN_REGIST_NOT_START);
  683 + fragment.binding.tvRunNow.setText("报名未开始");
  684 + fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.gray_round));
  685 + fragment.binding.tvGoTip.setVisibility(View.GONE);
  686 + }
  687 + //立即报名
  688 + else if (BTN_REGIST_RACE.equals(runRaceDetailInfo.getEventState())) {
  689 + fragment.binding.rlScrollViewStartBtn.setTag(BTN_REGIST_RACE);
  690 + fragment.binding.tvRunNow.setText("立即报名");
  691 + fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.green_round));
  692 + fragment.binding.tvGoTip.setVisibility(View.GONE);
  693 + }
  694 + //活动未开始
  695 + else if (BTN_RACE_NOT_START.equals(runRaceDetailInfo.getEventState())) {
  696 + fragment.binding.rlScrollViewStartBtn.setTag(BTN_RACE_NOT_START);
  697 + fragment.binding.tvRunNow.setText("活动未开始");
  698 + fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.gray_round));
  699 + fragment.binding.tvGoTip.setVisibility(View.GONE);
  700 + }
  701 + //过了报名时间
  702 + else if (BTN_REGIST_TIME_GONE.equals(runRaceDetailInfo.getEventState())) {
  703 + fragment.binding.rlScrollViewStartBtn.setTag(BTN_REGIST_TIME_GONE);
  704 + fragment.binding.tvRunNow.setText("报名时间已过");
  705 + fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.gray_round));
  706 + fragment.binding.tvGoTip.setVisibility(View.GONE);
  707 + }
  708 + //立即开始活动
  709 + else if (BTN_START_RACE.equals(runRaceDetailInfo.getEventState())) {
  710 + fragment.binding.rlScrollViewStartBtn.setTag(BTN_START_RACE);
  711 + fragment.binding.tvRunNow.setText("立即开始");
  712 + fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.green_round));
  713 + fragment.binding.tvGoTip.setVisibility(View.VISIBLE);
  714 + }
  715 + //报名结束
  716 + else if (BTN_END_RACE.equals(runRaceDetailInfo.getEventState())) {
  717 + fragment.binding.rlScrollViewStartBtn.setTag(BTN_START_RACE);
  718 + fragment.binding.tvRunNow.setText("赛事已结束");
  719 + fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.gray_round));
  720 + fragment.binding.tvGoTip.setVisibility(View.VISIBLE);
  721 + }
  722 + }
  723 +
651 724 private void checkBaiduServiceState() {
652 725 CommonInfo.setIsRunKeepAliveService(getContext(), true);
653 726 CommonInfo.setIsRunStepService(getContext(), true);
... ... @@ -1027,15 +1100,16 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
1027 1100 if ((currnetTime - userPauseTime) <= (9 * 60 * 60 * 1000)) {
1028 1101 Log.e(TAG, "小于9小时");
1029 1102 fragment.binding.tvRunNow.setText("继续运动");
1030   - fragment.binding.rlScrollViewStartBtn.setTag(CONTINUE_RACE);
  1103 + fragment.binding.rlScrollViewStartBtn.setTag(BTN_CONTINUE_RACE);
1031 1104 } else {
1032 1105 Log.e(TAG, "大于9小时");
1033 1106 //重置数据
1034 1107 CommonInfo.resetRace(getContext());
1035 1108 //清空数据库
1036 1109 StepUtil.clearRunData(getContext(), CommonInfo.getUserId(getContext()));
1037   - fragment.binding.tvRunNow.setText("立即开始");
1038   - fragment.binding.rlScrollViewStartBtn.setTag(START_RACE);
  1110 + if (null != runRaceDetailInfo) {
  1111 + initStartBtnState(runRaceDetailInfo);
  1112 + }
1039 1113  
1040 1114 }
1041 1115  
... ... @@ -1047,19 +1121,10 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
1047 1121 isDifferentStreet = true;
1048 1122 }
1049 1123 //判断赛事是否已经结束
1050   - checkTheRaceIsEnd();
  1124 +// checkTheRaceIsEnd();
1051 1125 } else {
1052   - if (null == runRaceDetailInfo) {
1053   - return;
1054   - }
1055   - if (runRaceDetailInfo.isSignResult()) {
1056   - fragment.binding.rlScrollViewStartBtn.setTag(START_RACE);
1057   - fragment.binding.tvRunNow.setText("现在开始");
1058   - fragment.binding.tvGoTip.setVisibility(View.VISIBLE);
1059   - } else {
1060   - fragment.binding.rlScrollViewStartBtn.setTag(REGIST_RACE);
1061   - fragment.binding.tvRunNow.setText("立即报名");
1062   - fragment.binding.tvGoTip.setVisibility(View.GONE);
  1126 + if (null != runRaceDetailInfo) {
  1127 + initStartBtnState(runRaceDetailInfo);
1063 1128 }
1064 1129 }
1065 1130  
... ... @@ -1069,52 +1134,44 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
1069 1134 /**
1070 1135 * 判断赛事是否已经结束
1071 1136 */
1072   - private void checkTheRaceIsEnd() {
1073   - //判断赛事是否结束
1074   - if (null != userStepEntity) {
1075   - if (null != runRaceDetailInfo) {
1076   - //判断赛事id是否一致
1077   - if (!TextUtils.isEmpty(userStepEntity.getStreetId())) {
1078   - if (userStepEntity.getStreetId().equals(CommonInfo.getStreetId(getContext()))) {
1079   - //判断赛事是否结束
1080   - if (runRaceDetailInfo.isEndState()) {
1081   - //结束清除数据
1082   - //清空上次保存数据
1083   - StepUtil.clearRunData(getContext(), CommonInfo.getUserId(getContext()));
1084   - //停止服务
1085   - stopStepService();
1086   - //清除数据
1087   - CommonInfo.resetRace(getContext());
1088   - //设置按钮状态
1089   - fragment.binding.rlScrollViewStartBtn.setTag(END_RACE);
1090   - fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.red_round));
1091   - fragment.binding.tvRunNow.setText("赛事已结束");
1092   - fragment.binding.tvGoTip.setVisibility(View.GONE);
1093   - }
1094   - }
1095   - }
1096   - }
1097   - } else {
1098   - //如果数据库中没有数据,即,用户在当前赛事已经结束
1099   - if (null != runRaceDetailInfo) {
1100   - if (runRaceDetailInfo.isEndState()) {
1101   - //设置按钮状态
1102   - fragment.binding.rlScrollViewStartBtn.setTag(END_RACE);
1103   - fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.red_round));
1104   - fragment.binding.tvRunNow.setText("赛事已结束");
1105   - fragment.binding.tvGoTip.setVisibility(View.GONE);
1106   - }
1107   - }
1108   - }
1109   - }
1110   -
1111   - /**
1112   - * 赛事已经结束
1113   - */
1114   - private void raceHasEnd() {
1115   -
1116   - }
1117   -
  1137 +// private void checkTheRaceIsEnd() {
  1138 +// //判断赛事是否结束
  1139 +// if (null != userStepEntity) {
  1140 +// if (null != runRaceDetailInfo) {
  1141 +// //判断赛事id是否一致
  1142 +// if (!TextUtils.isEmpty(userStepEntity.getStreetId())) {
  1143 +// if (userStepEntity.getStreetId().equals(CommonInfo.getStreetId(getContext()))) {
  1144 +// //判断赛事是否结束
  1145 +// if (runRaceDetailInfo.isEndState()) {
  1146 +// //结束清除数据
  1147 +// //清空上次保存数据
  1148 +// StepUtil.clearRunData(getContext(), CommonInfo.getUserId(getContext()));
  1149 +// //停止服务
  1150 +// stopStepService();
  1151 +// //清除数据
  1152 +// CommonInfo.resetRace(getContext());
  1153 +// //设置按钮状态
  1154 +// fragment.binding.rlScrollViewStartBtn.setTag(BTN_END_RACE);
  1155 +// fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.red_round));
  1156 +// fragment.binding.tvRunNow.setText("赛事已结束");
  1157 +// fragment.binding.tvGoTip.setVisibility(View.GONE);
  1158 +// }
  1159 +// }
  1160 +// }
  1161 +// }
  1162 +// } else {
  1163 +// //如果数据库中没有数据,即,用户在当前赛事已经结束
  1164 +// if (null != runRaceDetailInfo) {
  1165 +// if (runRaceDetailInfo.isEndState()) {
  1166 +// //设置按钮状态
  1167 +// fragment.binding.rlScrollViewStartBtn.setTag(BTN_END_RACE);
  1168 +// fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.red_round));
  1169 +// fragment.binding.tvRunNow.setText("赛事已结束");
  1170 +// fragment.binding.tvGoTip.setVisibility(View.GONE);
  1171 +// }
  1172 +// }
  1173 +// }
  1174 +// }
1118 1175 public void onPause() {
1119 1176 if (mMapView != null) {
1120 1177 mMapView.onPause();
... ... @@ -1271,55 +1328,56 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
1271 1328 if (getContext() == null) {
1272 1329 return;
1273 1330 }
1274   - //更新用户头像
1275   - if (null != joinFaceIcon) {
1276   - //获取用户头像
1277   - if (TextUtils.isEmpty(CommonInfo.getUserIcon(getContext()))) {
1278   - //添加默认头像
1279   - joinFaceIcon.add(0, "http://wjj.ys1.cnliveimg.com/769/img/2018/0416/head_c.png");
1280   - } else {
1281   - //添加用户本身头像
1282   - joinFaceIcon.add(0, CommonInfo.getUserIcon(getContext()));
1283   -
1284   - }
1285   - }
1286   - //没有一个用户头像
1287   - else {
1288   - joinFaceIcon = new ArrayList<>();
1289   - //获取用户头像
1290   - if (TextUtils.isEmpty(CommonInfo.getUserIcon(getContext()))) {
1291   - //添加默认头像
1292   - joinFaceIcon.add("http://wjj.ys1.cnliveimg.com/769/img/2018/0416/head_c.png");
1293   - } else {
1294   - //添加用户本身头像
1295   - joinFaceIcon.add(CommonInfo.getUserIcon(getContext()));
1296   -
1297   - }
1298   - }
1299   -
1300   - //开始更新头像
1301   - if (null != joinFaceIcon) {
1302   - fragment.binding.includeStreet.fiveJoinPerson.setVisibility(View.VISIBLE);
1303   - //设置头像数据
1304   - fragment.binding.includeStreet.fiveJoinPerson.initIconData(joinFaceIcon);
1305   - }
1306   - //更新参与人数
1307   - if (!TextUtils.isEmpty(fragment.binding.includeStreet.tvSignPerson.getText().toString())) {
1308   - if ("--".equals(fragment.binding.includeStreet.tvSignPerson.getText().toString())) {
1309   - fragment.binding.includeStreet.tvSignPerson.setText("1");
1310   - }
1311   - if (null != runRaceDetailInfo) {
1312   - fragment.binding.includeStreet.tvSignPerson.setText((runRaceDetailInfo.getSignupNum() + 1) + "");
1313   - }
1314   - } else {
1315   - fragment.binding.includeStreet.tvSignPerson.setText("1");
1316   - }
1317   - fragment.binding.rlScrollViewStartBtn.setTag(START_RACE);
1318   - fragment.binding.tvRunNow.setText("现在开始");
1319   - fragment.binding.tvGoTip.setVisibility(View.VISIBLE);
1320   - if (null != runRaceDetailInfo) {
1321   - runRaceDetailInfo.setSignResult(true);
1322   - }
  1331 + fragment.getPresenter().getRunRaceDetailInfo(getContext(), CommonInfo.getStreetId(getContext()), CommonInfo.getUserId(getContext()), "0");
  1332 +// //更新用户头像
  1333 +// if (null != joinFaceIcon) {
  1334 +// //获取用户头像
  1335 +// if (TextUtils.isEmpty(CommonInfo.getUserIcon(getContext()))) {
  1336 +// //添加默认头像
  1337 +// joinFaceIcon.add(0, "http://wjj.ys1.cnliveimg.com/769/img/2018/0416/head_c.png");
  1338 +// } else {
  1339 +// //添加用户本身头像
  1340 +// joinFaceIcon.add(0, CommonInfo.getUserIcon(getContext()));
  1341 +//
  1342 +// }
  1343 +// }
  1344 +// //没有一个用户头像
  1345 +// else {
  1346 +// joinFaceIcon = new ArrayList<>();
  1347 +// //获取用户头像
  1348 +// if (TextUtils.isEmpty(CommonInfo.getUserIcon(getContext()))) {
  1349 +// //添加默认头像
  1350 +// joinFaceIcon.add("http://wjj.ys1.cnliveimg.com/769/img/2018/0416/head_c.png");
  1351 +// } else {
  1352 +// //添加用户本身头像
  1353 +// joinFaceIcon.add(CommonInfo.getUserIcon(getContext()));
  1354 +//
  1355 +// }
  1356 +// }
  1357 +//
  1358 +// //开始更新头像
  1359 +// if (null != joinFaceIcon) {
  1360 +// fragment.binding.includeStreet.fiveJoinPerson.setVisibility(View.VISIBLE);
  1361 +// //设置头像数据
  1362 +// fragment.binding.includeStreet.fiveJoinPerson.initIconData(joinFaceIcon);
  1363 +// }
  1364 +// //更新参与人数
  1365 +// if (!TextUtils.isEmpty(fragment.binding.includeStreet.tvSignPerson.getText().toString())) {
  1366 +// if ("--".equals(fragment.binding.includeStreet.tvSignPerson.getText().toString())) {
  1367 +// fragment.binding.includeStreet.tvSignPerson.setText("1");
  1368 +// }
  1369 +// if (null != runRaceDetailInfo) {
  1370 +// fragment.binding.includeStreet.tvSignPerson.setText((runRaceDetailInfo.getSignupNum() + 1) + "");
  1371 +// }
  1372 +// } else {
  1373 +// fragment.binding.includeStreet.tvSignPerson.setText("1");
  1374 +// }
  1375 +// if (null != runRaceDetailInfo) {
  1376 +// runRaceDetailInfo.setSignResult(true);
  1377 +// fragment.binding.rlScrollViewStartBtn.setTag(BTN_START_RACE);
  1378 +// fragment.binding.tvRunNow.setText("现在开始");
  1379 +// fragment.binding.tvGoTip.setVisibility(View.VISIBLE);
  1380 +// }
1323 1381 }
1324 1382  
1325 1383 }
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/model/Constant.java
... ... @@ -22,10 +22,10 @@ public class Constant {
22 22 public static final int DELECT_COLL_BIND_TRACE_LIST = 13;//删除已绑定列表
23 23 public static final int SERVICE_STEP_COUNT_ONRESUME = 14;//用户从后台回到前台,更新步数
24 24 public static final int COLL_SERVICE_STEP_COUNT_ONRESUME = 15;//运营从后台回到前台,更新步数
25   -
26   -
  25 + public static final int UPDATA_COLL_TRACE_LIST = 16;//更新轨迹列表
  26 + public static final int UPDATE_RACE_STATE_BTN = 17;//更新赛事详情页按钮数据
27 27 /*************************************用户其他值,非标志位************************************************************/
28   - public static long SERVICE_ID = 0;//公司账号
  28 + public static long SERVICE_ID = 0;//公司账号
29 29 // public static final long SERVICE_ID = 213553;
30 30 public static final int TAG = 1;
31 31 public static final int GATHER_INTERVAL = 2;//位置采集周期
... ... @@ -42,4 +42,5 @@ public class Constant {
42 42 public static final int FENCE_OFFSET = 50;//围栏偏离距离
43 43 public static final int FENCE_DENOISE = 20;//围栏去噪精度
44 44 public static final int TAKE_POINT_MAX_SIZE = 100;//最大打点数量
  45 + public static final int COLL_GEORESULT_RADIUS = 20;//打点逆地理半径
45 46 }
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/net/bean/RunRaceDetailInfo.java
... ... @@ -86,12 +86,21 @@ public class RunRaceDetailInfo implements Serializable {
86 86 private String userMileage;
87 87 private List<String> faceUrl;
88 88 private List<String> finishFaceUrl;
  89 + private String eventState;//1-报名未开始 2-立即报名 3-活动未开始 4-过了报名时间 5-立即开始活动
89 90 /*********************************后加的,非接口返回,用于*******************************************/
90 91 private String endLatLng;//终点坐标,后加的,不是后台返回,这是从百度历史轨迹查出来的
91 92 private boolean endState;//活动是否结束(true 结束 false 未结束 )
92 93 private String collStartLatLng;//运营打的点
93 94 private String collStartLntLngName;//运营打点名称
94 95  
  96 + public String getEventState() {
  97 + return eventState;
  98 + }
  99 +
  100 + public void setEventState(String eventState) {
  101 + this.eventState = eventState;
  102 + }
  103 +
95 104 public String getCollStartLatLng() {
96 105 return collStartLatLng;
97 106 }
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/RunRaceDetailActivity.java
... ... @@ -231,11 +231,6 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity {
231 231 if (!ActivityCompat.shouldShowRequestPermissionRationale(this, permissions[i])) {
232 232 isShowPermissionTip = false;
233 233 break;
234   -//// showToast("点击权限,并打开全部权限");
235   -// Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
236   -// Uri uri = Uri.fromParts("package", getPackageName(), null);
237   -// intent.setData(uri);
238   -// startActivityForResult(intent, 0);
239 234 }
240 235 }
241 236 }
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/adapter/MyRecordAdapter.java
... ... @@ -8,6 +8,7 @@ import android.view.LayoutInflater;
8 8 import android.view.View;
9 9 import android.view.ViewGroup;
10 10 import android.widget.ImageView;
  11 +import android.widget.LinearLayout;
11 12 import android.widget.RelativeLayout;
12 13 import android.widget.TextView;
13 14  
... ... @@ -18,6 +19,7 @@ import com.cnlive.moudle.pedometer.commonInfo.CommonInfo;
18 19 import com.cnlive.moudle.pedometer.net.bean.MyRecordInfo;
19 20 import com.cnlive.moudle.pedometer.ui.activity.RaceRecordActivity;
20 21 import com.cnlive.moudle.pedometer.ui.widget.FivePersonIconView;
  22 +import com.cnlive.moudle.pedometer.utils.ScreenUtil;
21 23 import com.cnlive.moudle.pedometer.utils.TimeUtil;
22 24 import com.example.moudle_pedometer.R;
23 25  
... ... @@ -70,7 +72,17 @@ public class MyRecordAdapter extends RecyclerView.Adapter&lt;MyRecordAdapter.MyView
70 72 myViewHolder.line_address.setText(list.get(i).getAddress());
71 73 }
72 74 myViewHolder.people_part.setText(list.get(i).getSignupNum() + "");
73   - myViewHolder.join_person.initIconData(list.get(i).getFaceUrl());
  75 + if (null != list.get(i).getFaceUrl() && list.get(i).getFaceUrl().size() > 0) {
  76 + myViewHolder.join_person.initIconData(list.get(i).getFaceUrl());
  77 + LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ScreenUtil.dip2px(context, 150), ViewGroup.LayoutParams.WRAP_CONTENT);
  78 + if (list.get(i).getFaceUrl().size() < 5) {
  79 + params.rightMargin = -ScreenUtil.dip2px(context, 28 * (5 - list.get(i).getFaceUrl().size()));
  80 + }
  81 + myViewHolder.join_person.setLayoutParams(params);
  82 + myViewHolder.join_person.setVisibility(View.VISIBLE);
  83 + } else {
  84 + myViewHolder.join_person.setVisibility(View.GONE);
  85 + }
74 86 if(state.equals("0")){
75 87 myViewHolder.day_num.setVisibility(View.VISIBLE);
76 88 myViewHolder.after_finish.setVisibility(View.GONE);
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/adapter/RunLineAdapter.java
... ... @@ -8,11 +8,13 @@ import android.view.LayoutInflater;
8 8 import android.view.View;
9 9 import android.view.ViewGroup;
10 10 import android.widget.ImageView;
  11 +import android.widget.LinearLayout;
11 12 import android.widget.RelativeLayout;
12 13 import android.widget.TextView;
13 14  
14 15 import com.cnlive.moudle.pedometer.net.bean.RunLineInfo;
15 16 import com.cnlive.moudle.pedometer.ui.widget.FivePersonIconView;
  17 +import com.cnlive.moudle.pedometer.utils.ScreenUtil;
16 18 import com.cnlive.moudle.pedometer.utils.TimeUtil;
17 19 import com.example.moudle_pedometer.R;
18 20  
... ... @@ -67,6 +69,11 @@ public class RunLineAdapter extends RecyclerView.Adapter&lt;RunLineAdapter.MyViewHo
67 69 myViewHolder.people_part.setText(list.get(i).getSignupNum() + "");
68 70 if (null != list.get(i).getFaceUrl() && list.get(i).getFaceUrl().size() > 0) {
69 71 myViewHolder.join_person.initIconData(list.get(i).getFaceUrl());
  72 + LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ScreenUtil.dip2px(context, 150), ViewGroup.LayoutParams.WRAP_CONTENT);
  73 + if (list.get(i).getFaceUrl().size() < 5) {
  74 + params.rightMargin = -ScreenUtil.dip2px(context, 28 * (5 - list.get(i).getFaceUrl().size()));
  75 + }
  76 + myViewHolder.join_person.setLayoutParams(params);
70 77 myViewHolder.join_person.setVisibility(View.VISIBLE);
71 78 } else {
72 79 myViewHolder.join_person.setVisibility(View.GONE);
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RunRaceDetailFragment.java
... ... @@ -196,5 +196,14 @@ public class RunRaceDetailFragment extends QMUIFragment&lt;RunRaceDetailFragmentVie
196 196 getMvpView().setRegistrationBtn();
197 197 }
198 198 }
  199 + //用户跑完了,更新一下按钮
  200 + else if (messageEvent.getMessageType() == Constant.UPDATE_RACE_STATE_BTN) {
  201 + if (getMvpView() != null && null != getPresenter()) {
  202 + if (!TextUtils.isEmpty(CommonInfo.getStreetId(getActivity()))) {
  203 + getPresenter().getRunRaceDetailInfo(getActivity(), CommonInfo.getStreetId(getActivity()), CommonInfo.getUserId(getActivity()), "0");
  204 + }
  205 + }
  206 + }
  207 +
199 208 }
200 209 }
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/widget/FivePersonIconView.java
... ... @@ -52,6 +52,17 @@ public class FivePersonIconView extends LinearLayout {
52 52 qr4 = findViewById(R.id.qm_iv4);
53 53 qr5 = findViewById(R.id.qm_iv5);
54 54 iv_right = findViewById(R.id.iv_right);
  55 + qr1.setVisibility(GONE);
  56 + qr2.setVisibility(GONE);
  57 + qr3.setVisibility(GONE);
  58 + qr4.setVisibility(GONE);
  59 + qr5.setVisibility(GONE);
  60 + //设置默认显示图片
  61 + GlideApp.with(context).load(getResources().getDrawable(R.drawable.tc_ic_workout_level_adjust_coach)).into(qr1);
  62 + GlideApp.with(context).load(getResources().getDrawable(R.drawable.tc_ic_workout_level_adjust_coach)).into(qr2);
  63 + GlideApp.with(context).load(getResources().getDrawable(R.drawable.tc_ic_workout_level_adjust_coach)).into(qr3);
  64 + GlideApp.with(context).load(getResources().getDrawable(R.drawable.tc_ic_workout_level_adjust_coach)).into(qr4);
  65 + GlideApp.with(context).load(getResources().getDrawable(R.drawable.tc_ic_workout_level_adjust_coach)).into(qr5);
55 66 //获取自定义属性
56 67 TypedArray attributes = context.obtainStyledAttributes(attrs, R.styleable.FivePersonIconView);
57 68 isShowRight = attributes.getBoolean(R.styleable.FivePersonIconView_showRightFlag, true);
... ... @@ -72,12 +83,6 @@ public class FivePersonIconView extends LinearLayout {
72 83 if (qr1 == null || qr2 == null || qr3 == null || qr4 == null || qr5 == null) {
73 84 return;
74 85 }
75   - //设置默认显示图片
76   - GlideApp.with(context).load(getResources().getDrawable(R.drawable.tc_ic_workout_level_adjust_coach)).into(qr1);
77   - GlideApp.with(context).load(getResources().getDrawable(R.drawable.tc_ic_workout_level_adjust_coach)).into(qr2);
78   - GlideApp.with(context).load(getResources().getDrawable(R.drawable.tc_ic_workout_level_adjust_coach)).into(qr3);
79   - GlideApp.with(context).load(getResources().getDrawable(R.drawable.tc_ic_workout_level_adjust_coach)).into(qr4);
80   - GlideApp.with(context).load(getResources().getDrawable(R.drawable.tc_ic_workout_level_adjust_coach)).into(qr5);
81 86 //开始设置集合里面的图片
82 87 if (iconList != null && iconList.size() > 0) {
83 88 for (int i = 0; i < iconList.size(); i++) {
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/MyMapUtil.java
... ... @@ -5,6 +5,7 @@ import android.graphics.Bitmap;
5 5 import android.graphics.BitmapFactory;
6 6 import android.location.LocationManager;
7 7 import android.os.Handler;
  8 +import android.text.TextUtils;
8 9 import android.util.Log;
9 10 import android.widget.Toast;
10 11  
... ... @@ -18,6 +19,12 @@ import com.baidu.mapapi.map.OverlayOptions;
18 19 import com.baidu.mapapi.map.PolylineOptions;
19 20 import com.baidu.mapapi.model.LatLng;
20 21 import com.baidu.mapapi.model.LatLngBounds;
  22 +import com.baidu.mapapi.search.core.PoiInfo;
  23 +import com.baidu.mapapi.search.geocode.GeoCodeResult;
  24 +import com.baidu.mapapi.search.geocode.GeoCoder;
  25 +import com.baidu.mapapi.search.geocode.OnGetGeoCoderResultListener;
  26 +import com.baidu.mapapi.search.geocode.ReverseGeoCodeOption;
  27 +import com.baidu.mapapi.search.geocode.ReverseGeoCodeResult;
21 28 import com.baidu.mapapi.utils.DistanceUtil;
22 29 import com.baidu.trace.LBSTraceClient;
23 30 import com.baidu.trace.api.track.DistanceRequest;
... ... @@ -52,7 +59,83 @@ public class MyMapUtil {
52 59 //分页索引
53 60 private static int pageIndex = 1;
54 61 private static List<LatLng> trackPoints;
  62 + private static GeoCoder mSearch = null; // 搜索模块,也可去掉地图模块独立使用
  63 + private static int queryGeoCount = 0;
55 64  
  65 + /**
  66 + * 进行逆地理查询
  67 + *
  68 + * @param latLng
  69 + * @param geoCodeResult
  70 + */
  71 + public static void getGeoCoderResult(LatLng latLng, GeoCodeResult geoCodeResult) {
  72 + if (null == mSearch) {
  73 + mSearch = GeoCoder.newInstance();
  74 + }
  75 + mSearch.setOnGetGeoCodeResultListener(new OnGetGeoCoderResultListener() {
  76 +
  77 + @Override
  78 + public void onGetGeoCodeResult(com.baidu.mapapi.search.geocode.GeoCodeResult geoCodeResult) {
  79 +
  80 + }
  81 +
  82 + @Override
  83 + public void onGetReverseGeoCodeResult(ReverseGeoCodeResult reverseGeoCodeResult) {
  84 +// Log.e(TAG, "status:" + reverseGeoCodeResult.status + ",error" + reverseGeoCodeResult.error);
  85 + //成功
  86 + if (0 == reverseGeoCodeResult.status) {
  87 + queryGeoCount = 0;
  88 + if (null != geoCodeResult) {
  89 + List<PoiInfo> pois = reverseGeoCodeResult.getPoiList();
  90 + if (null != pois&&pois.size()>0) {
  91 + if (!TextUtils.isEmpty(pois.get(0).name)){
  92 + geoCodeResult.success(pois.get(0).name);
  93 + }else {
  94 + geoCodeResult.success(null);
  95 + }
  96 + } else {
  97 + //如果街道号或者街道为空
  98 + if ((null==reverseGeoCodeResult.getAddressDetail().street||TextUtils.isEmpty(reverseGeoCodeResult.getAddressDetail().street)) && (null==reverseGeoCodeResult.getAddressDetail().streetNumber||TextUtils.isEmpty(reverseGeoCodeResult.getAddressDetail().streetNumber))) {
  99 + if (!TextUtils.isEmpty(reverseGeoCodeResult.getAddress()) && !TextUtils.isEmpty(reverseGeoCodeResult.getSematicDescription())) {
  100 + geoCodeResult.success(reverseGeoCodeResult.getAddress() + "," + reverseGeoCodeResult.getSematicDescription());
  101 + } else if (!TextUtils.isEmpty(reverseGeoCodeResult.getAddress())) {
  102 + geoCodeResult.success(reverseGeoCodeResult.getAddress());
  103 + } else {
  104 + geoCodeResult.success(null);
  105 + }
  106 + } else {
  107 + if (!TextUtils.isEmpty(reverseGeoCodeResult.getAddress())) {
  108 + geoCodeResult.success(reverseGeoCodeResult.getAddress());
  109 + } else {
  110 + geoCodeResult.success(null);
  111 + }
  112 + }
  113 + }
  114 + }
  115 + } else if (104 == reverseGeoCodeResult.status) {
  116 + if (0 == queryGeoCount) {
  117 + queryGeoCount = 1;
  118 + new Handler().postDelayed(new Runnable() {
  119 + @Override
  120 + public void run() {
  121 + getGeoCoderResult(latLng, geoCodeResult);
  122 + }
  123 + }, 1000);
  124 + }
  125 + }
  126 + //失败
  127 + else {
  128 + queryGeoCount = 0;
  129 + if (null != geoCodeResult) {
  130 + geoCodeResult.success(null);
  131 + }
  132 + }
  133 + }
  134 + });
  135 + mSearch.reverseGeoCode(new ReverseGeoCodeOption()
  136 + .location(latLng)
  137 + .radius(Constant.COLL_GEORESULT_RADIUS));
  138 + }
56 139  
57 140 /**
58 141 * 在地图上进行打点
... ... @@ -1085,4 +1168,8 @@ public class MyMapUtil {
1085 1168 public interface CallBack {
1086 1169 public void success(List<LatLng> resultPoints);
1087 1170 }
  1171 +
  1172 + public interface GeoCodeResult {
  1173 + void success(String address);
  1174 + }
1088 1175 }
... ...
moudle_pedometer/src/main/res/layout/activity_my_record.xml
... ... @@ -11,7 +11,7 @@
11 11 <com.qmuiteam.qmui.widget.QMUITopBar
12 12 android:id="@+id/topbar"
13 13 android:layout_width="match_parent"
14   - android:layout_height="?attr/qmui_topbar_height" />
  14 + android:layout_height="48dp" />
15 15  
16 16 <android.support.design.widget.TabLayout
17 17 android:id="@+id/tabs"
... ...
moudle_pedometer/src/main/res/layout/five_persion_icon.xml
1 1 <?xml version="1.0" encoding="utf-8"?>
2 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 3 xmlns:app="http://schemas.android.com/apk/res-auto"
4   - android:layout_width="match_parent"
  4 + android:layout_width="wrap_content"
5 5 android:layout_height="wrap_content"
6   - android:gravity="center_vertical|right">
  6 + android:gravity="center_vertical">
7 7  
8 8  
9 9 <com.qmuiteam.qmui.widget.QMUIRadiusImageView
... ... @@ -11,7 +11,6 @@
11 11 android:layout_width="40dp"
12 12 android:layout_height="40dp"
13 13 android:layout_marginLeft="10dp"
14   - android:background="@drawable/tc_ic_workout_level_adjust_coach"
15 14 app:qmui_corner_radius="100dp" />
16 15  
17 16 <com.qmuiteam.qmui.widget.QMUIRadiusImageView
... ... @@ -19,7 +18,6 @@
19 18 android:layout_width="40dp"
20 19 android:layout_height="40dp"
21 20 android:layout_marginLeft="-10dp"
22   - android:background="@drawable/tc_ic_workout_level_adjust_coach"
23 21 app:qmui_corner_radius="100dp" />
24 22  
25 23 <com.qmuiteam.qmui.widget.QMUIRadiusImageView
... ... @@ -27,7 +25,6 @@
27 25 android:layout_width="40dp"
28 26 android:layout_height="40dp"
29 27 android:layout_marginLeft="-10dp"
30   - android:background="@drawable/tc_ic_workout_level_adjust_coach"
31 28 app:qmui_corner_radius="100dp" />
32 29  
33 30 <com.qmuiteam.qmui.widget.QMUIRadiusImageView
... ... @@ -35,7 +32,6 @@
35 32 android:layout_width="40dp"
36 33 android:layout_height="40dp"
37 34 android:layout_marginLeft="-10dp"
38   - android:background="@drawable/tc_ic_workout_level_adjust_coach"
39 35 app:qmui_corner_radius="100dp" />
40 36  
41 37 <com.qmuiteam.qmui.widget.QMUIRadiusImageView
... ... @@ -43,7 +39,6 @@
43 39 android:layout_width="40dp"
44 40 android:layout_height="40dp"
45 41 android:layout_marginLeft="-10dp"
46   - android:background="@drawable/tc_ic_workout_level_adjust_coach"
47 42 app:qmui_corner_radius="100dp" />
48 43  
49 44 <ImageView
... ...
moudle_pedometer/src/main/res/layout/fragment_run_main.xml
... ... @@ -2,6 +2,7 @@
2 2 <layout xmlns:android="http://schemas.android.com/apk/res/android">
3 3  
4 4 <LinearLayout
  5 + android:id="@+id/ll_root"
5 6 android:layout_width="match_parent"
6 7 android:layout_height="match_parent"
7 8 android:background="@color/run_main_bg"
... ... @@ -9,14 +10,12 @@
9 10  
10 11 <FrameLayout
11 12 android:layout_width="match_parent"
12   - android:background="@color/run_main_bg"
13 13 android:layout_height="match_parent">
14 14  
15 15 <LinearLayout
16 16 android:id="@+id/ll_run_main_root"
17 17 android:layout_width="match_parent"
18 18 android:layout_height="match_parent"
19   - android:background="@color/run_main_bg"
20 19 android:orientation="vertical">
21 20  
22 21 <RelativeLayout
... ...
moudle_pedometer/src/main/res/layout/fragment_run_race_detail.xml
... ... @@ -117,7 +117,7 @@
117 117 android:layout_height="40sp"
118 118 android:layout_gravity="bottom"
119 119 android:background="@color/green_round"
120   - android:tag="0">
  120 + android:tag="1">
121 121  
122 122 <TextView
123 123 android:id="@+id/tv_run_now"
... ...
moudle_pedometer/src/main/res/layout/item_my_record.xml
... ... @@ -82,7 +82,7 @@
82 82 android:id="@+id/join_person"
83 83 android:layout_width="150dp"
84 84 android:layout_height="40dp"
85   - android:layout_marginRight="10dp"
  85 + android:gravity="left"
86 86 FivePersonIconView:showRightFlag="false" />
87 87  
88 88 <TextView
... ...
moudle_pedometer/src/main/res/layout/layout_run_detail_street.xml
... ... @@ -446,6 +446,7 @@
446 446 android:id="@+id/five_join_person"
447 447 android:layout_width="180dp"
448 448 android:layout_height="40dp"
  449 + android:gravity="right"
449 450 android:layout_marginRight="10dp"
450 451 FivePersonIconView:showRightFlag="true" />
451 452  
... ...