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,6 +3,7 @@ package com.example.modulepedometer;
3 import android.content.Intent; 3 import android.content.Intent;
4 import android.os.Bundle; 4 import android.os.Bundle;
5 import android.support.v7.app.AppCompatActivity; 5 import android.support.v7.app.AppCompatActivity;
  6 +import android.text.TextUtils;
6 import android.view.View; 7 import android.view.View;
7 8
8 import com.baidu.mapapi.model.LatLng; 9 import com.baidu.mapapi.model.LatLng;
@@ -20,6 +21,7 @@ import com.cnlive.moudle.pedometer.model.Constant; @@ -20,6 +21,7 @@ import com.cnlive.moudle.pedometer.model.Constant;
20 import com.cnlive.moudle.pedometer.ui.activity.MyRecordActivity; 21 import com.cnlive.moudle.pedometer.ui.activity.MyRecordActivity;
21 import com.cnlive.moudle.pedometer.ui.activity.RunLineActivity; 22 import com.cnlive.moudle.pedometer.ui.activity.RunLineActivity;
22 import com.cnlive.moudle.pedometer.ui.activity.SelfRecordActivity; 23 import com.cnlive.moudle.pedometer.ui.activity.SelfRecordActivity;
  24 +import com.cnlive.moudle.pedometer.utils.MyMapUtil;
23 25
24 26
25 public class MainActivity extends AppCompatActivity { 27 public class MainActivity extends AppCompatActivity {
@@ -29,6 +31,7 @@ public class MainActivity extends AppCompatActivity { @@ -29,6 +31,7 @@ public class MainActivity extends AppCompatActivity {
29 super.onCreate(savedInstanceState); 31 super.onCreate(savedInstanceState);
30 setContentView(R.layout.activity_main); 32 setContentView(R.layout.activity_main);
31 33
  34 +// String uid = "10535072";
32 String uid = "358916"; 35 String uid = "358916";
33 // String uid = "358689"; 36 // String uid = "358689";
34 37
@@ -51,25 +54,14 @@ public class MainActivity extends AppCompatActivity { @@ -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 // @Override 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,6 +16,8 @@ import com.cnlive.moudle.collectionTrace.frame.view.CollRunningFinishFragmentVie
16 import com.cnlive.moudle.collectionTrace.model.CollectPoint; 16 import com.cnlive.moudle.collectionTrace.model.CollectPoint;
17 import com.cnlive.moudle.collectionTrace.utils.CollStepUtil; 17 import com.cnlive.moudle.collectionTrace.utils.CollStepUtil;
18 import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; 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 import com.cnlive.moudle.pedometer.net.ApiServiceRunLin; 21 import com.cnlive.moudle.pedometer.net.ApiServiceRunLin;
20 import com.cnlive.moudle.pedometer.net.SubscriptionRequest; 22 import com.cnlive.moudle.pedometer.net.SubscriptionRequest;
21 import com.cnlive.moudle.pedometer.net.bean.BaseInfo; 23 import com.cnlive.moudle.pedometer.net.bean.BaseInfo;
@@ -30,6 +32,8 @@ import com.cnlive.moudle.pedometer.utils.StepUtil; @@ -30,6 +32,8 @@ import com.cnlive.moudle.pedometer.utils.StepUtil;
30 import com.example.moudle_pedometer.R; 32 import com.example.moudle_pedometer.R;
31 import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; 33 import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter;
32 34
  35 +import org.greenrobot.eventbus.EventBus;
  36 +
33 import java.util.HashMap; 37 import java.util.HashMap;
34 import java.util.List; 38 import java.util.List;
35 import java.util.Map; 39 import java.util.Map;
@@ -144,6 +148,7 @@ public class CollRunningFinishFragmetPresenter extends MvpBasePresenter<CollRunn @@ -144,6 +148,7 @@ public class CollRunningFinishFragmetPresenter extends MvpBasePresenter<CollRunn
144 if (getView() == null) { 148 if (getView() == null) {
145 return; 149 return;
146 } 150 }
  151 + EventBus.getDefault().post(new MessageEvent(Constant.UPDATA_COLL_TRACE_LIST, ""));
147 QMUITipDialogUtil.dismessDialog(); 152 QMUITipDialogUtil.dismessDialog();
148 QMUITipDialogUtil.successDialog(context, "数据上传成功", 1); 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,6 +52,7 @@ import com.cnlive.moudle.pedometer.utils.ButtonAnimUtil;
52 import com.cnlive.moudle.collectionTrace.utils.CollStepUtil; 52 import com.cnlive.moudle.collectionTrace.utils.CollStepUtil;
53 import com.cnlive.moudle.pedometer.utils.GsonUtil; 53 import com.cnlive.moudle.pedometer.utils.GsonUtil;
54 import com.cnlive.moudle.pedometer.utils.MyMapUtil; 54 import com.cnlive.moudle.pedometer.utils.MyMapUtil;
  55 +import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil;
55 import com.cnlive.moudle.pedometer.utils.TimeUtil; 56 import com.cnlive.moudle.pedometer.utils.TimeUtil;
56 import com.example.moudle_pedometer.R; 57 import com.example.moudle_pedometer.R;
57 import com.hannesdorfmann.mosby3.mvp.MvpView; 58 import com.hannesdorfmann.mosby3.mvp.MvpView;
@@ -258,15 +259,36 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener @@ -258,15 +259,36 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener
258 //更新可打点数量 259 //更新可打点数量
259 int remainNum = updataCanTakePointCount(); 260 int remainNum = updataCanTakePointCount();
260 if (remainNum != 0) { 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 if (null != followMyLocation) { 274 if (null != followMyLocation) {
262 currentImportLatLng = new LatLng(followMyLocation.latitude, followMyLocation.longitude); 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 } else { 291 } else {
269 - isShowFollowAddress = true;  
270 Toast.makeText(getContext(), "正在获取当前地点信息,请稍后", Toast.LENGTH_SHORT).show(); 292 Toast.makeText(getContext(), "正在获取当前地点信息,请稍后", Toast.LENGTH_SHORT).show();
271 } 293 }
272 } else { 294 } else {
@@ -286,14 +308,29 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener @@ -286,14 +308,29 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener
286 } else { 308 } else {
287 if (null != followMyLocation) { 309 if (null != followMyLocation) {
288 currentImportLatLng = new LatLng(followMyLocation.latitude, followMyLocation.longitude); 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 } else { 334 } else {
298 isShowEndFollowAddress = true; 335 isShowEndFollowAddress = true;
299 Toast.makeText(getContext(), "正在获取当前地点信息,请稍后", Toast.LENGTH_SHORT).show(); 336 Toast.makeText(getContext(), "正在获取当前地点信息,请稍后", Toast.LENGTH_SHORT).show();
@@ -567,93 +604,6 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener @@ -567,93 +604,6 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener
567 if (location == null || mMapView == null || getContext() == null) { 604 if (location == null || mMapView == null || getContext() == null) {
568 return; 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 //正在搜索GPS信号 607 //正在搜索GPS信号
658 if (location.getGpsAccuracyStatus() == BDLocation.GPS_ACCURACY_UNKNOWN) { 608 if (location.getGpsAccuracyStatus() == BDLocation.GPS_ACCURACY_UNKNOWN) {
659 if (fragment.binding.tvGpsPopBg.getVisibility() != View.VISIBLE) { 609 if (fragment.binding.tvGpsPopBg.getVisibility() != View.VISIBLE) {
@@ -703,6 +653,88 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener @@ -703,6 +653,88 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener
703 fragment.binding.ivGpsState.setBackground(getContext().getResources().getDrawable(R.drawable.rt_training_gps_3)); 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,6 +204,11 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener
204 startLocation.setPointName(eventShoeLinesBean.getStartLocation()); 204 startLocation.setPointName(eventShoeLinesBean.getStartLocation());
205 startLocation.setLatitude(0); 205 startLocation.setLatitude(0);
206 startLocation.setLongitude(0); 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 CollectPoint endLocation = null; 214 CollectPoint endLocation = null;
@@ -212,6 +217,11 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener @@ -212,6 +217,11 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener
212 endLocation.setPointName(eventShoeLinesBean.getEndLocation()); 217 endLocation.setPointName(eventShoeLinesBean.getEndLocation());
213 endLocation.setLatitude(0); 218 endLocation.setLatitude(0);
214 endLocation.setLongitude(0); 219 endLocation.setLongitude(0);
  220 + }else {
  221 + endLocation = new CollectPoint();
  222 + endLocation.setPointName("");
  223 + endLocation.setLatitude(0);
  224 + endLocation.setLongitude(0);
215 } 225 }
216 if (null != startLocation) { 226 if (null != startLocation) {
217 if (null == allCollectPoints) { 227 if (null == allCollectPoints) {
@@ -274,7 +284,7 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener @@ -274,7 +284,7 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener
274 } 284 }
275 if (resultPoints.size() > 1) { 285 if (resultPoints.size() > 1) {
276 MyMapUtil.drawHistoryTrack(getContext(), baiduMap, resultPoints, SortType.asc, R.color.green_round, R.drawable.icon_start, R.drawable.icon_end); 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,6 +44,7 @@ import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity;
44 import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; 44 import com.cnlive.moudle.pedometer.ui.widget.SelectDialog;
45 import com.cnlive.moudle.pedometer.utils.BitmapUtil; 45 import com.cnlive.moudle.pedometer.utils.BitmapUtil;
46 import com.cnlive.moudle.pedometer.utils.GsonUtil; 46 import com.cnlive.moudle.pedometer.utils.GsonUtil;
  47 +import com.cnlive.moudle.pedometer.utils.MyMapUtil;
47 import com.cnlive.moudle.pedometer.utils.NetUtil; 48 import com.cnlive.moudle.pedometer.utils.NetUtil;
48 import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil; 49 import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil;
49 import com.cnlive.moudle.pedometer.utils.ServiceUtils; 50 import com.cnlive.moudle.pedometer.utils.ServiceUtils;
@@ -61,7 +62,7 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { @@ -61,7 +62,7 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener {
61 private BitmapDescriptor mCurrentMarker;//定位图标 62 private BitmapDescriptor mCurrentMarker;//定位图标
62 private static int accuracyCircleFillColor; 63 private static int accuracyCircleFillColor;
63 private static int accuracyCircleStrokeColor; 64 private static int accuracyCircleStrokeColor;
64 - private static MyLocationData followMyLocation; 65 + private MyLocationData followMyLocation;
65 private LatLng currentLatLng; 66 private LatLng currentLatLng;
66 private Double lastX = 0.0; 67 private Double lastX = 0.0;
67 private int mCurrentDirection = 0; 68 private int mCurrentDirection = 0;
@@ -117,17 +118,32 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { @@ -117,17 +118,32 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener {
117 fragment.binding.btnIdentify.setOnClickListener(new View.OnClickListener() { 118 fragment.binding.btnIdentify.setOnClickListener(new View.OnClickListener() {
118 @Override 119 @Override
119 public void onClick(View view) { 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 } else { 142 } else {
128 - isShowFollowAddress = true;  
129 Toast.makeText(getContext(), "正在获取当前地点信息,请稍后", Toast.LENGTH_SHORT).show(); 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,8 +288,10 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener {
272 } 288 }
273 289
274 private void stopStepService() { 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 if (CollStepService.mClient != null) { 295 if (CollStepService.mClient != null) {
278 CollStepService.mClient.stopGather(CollStepService.traceListener); 296 CollStepService.mClient.stopGather(CollStepService.traceListener);
279 } 297 }
@@ -405,51 +423,40 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { @@ -405,51 +423,40 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener {
405 if (location == null || mMapView == null) { 423 if (location == null || mMapView == null) {
406 return; 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 if (location.getRadius() > Constant.LOCA_ACCURACY) { 428 if (location.getRadius() > Constant.LOCA_ACCURACY) {
419 return; 429 return;
420 } 430 }
421 -// } 431 + currentLatLng = new LatLng(location.getLatitude(),
  432 + location.getLongitude());
422 followMyLocation = new MyLocationData.Builder() 433 followMyLocation = new MyLocationData.Builder()
423 .accuracy(location.getRadius()) 434 .accuracy(location.getRadius())
424 // 此处设置开发者获取到的方向信息,顺时针0-360 435 // 此处设置开发者获取到的方向信息,顺时针0-360
425 .direction(location.getDirection()).latitude(location.getLatitude()) 436 .direction(location.getDirection()).latitude(location.getLatitude())
426 .longitude(location.getLongitude()).build(); 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,9 +4,12 @@ import android.Manifest;
4 import android.app.Activity; 4 import android.app.Activity;
5 import android.content.Context; 5 import android.content.Context;
6 import android.content.Intent; 6 import android.content.Intent;
  7 +import android.content.pm.PackageManager;
  8 +import android.net.Uri;
7 import android.os.Bundle; 9 import android.os.Bundle;
8 import android.provider.Settings; 10 import android.provider.Settings;
9 import android.support.annotation.NonNull; 11 import android.support.annotation.NonNull;
  12 +import android.support.v4.app.ActivityCompat;
10 import android.util.Log; 13 import android.util.Log;
11 import android.widget.Toast; 14 import android.widget.Toast;
12 15
@@ -17,7 +20,11 @@ import com.cnlive.libs.base.util.StatusBarUtil2; @@ -17,7 +20,11 @@ import com.cnlive.libs.base.util.StatusBarUtil2;
17 import com.cnlive.moudle.collectionTrace.commonInfo.CollCommonInfo; 20 import com.cnlive.moudle.collectionTrace.commonInfo.CollCommonInfo;
18 import com.cnlive.moudle.collectionTrace.ui.fragment.StartTraceFragment; 21 import com.cnlive.moudle.collectionTrace.ui.fragment.StartTraceFragment;
19 import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; 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 import com.cnlive.moudle.pedometer.utils.MyMapUtil; 26 import com.cnlive.moudle.pedometer.utils.MyMapUtil;
  27 +import com.cnlive.moudle.pedometer.utils.NotificationUtil;
21 import com.cnlive.moudle.pedometer.utils.lib_permisshelper.PermissionsListener; 28 import com.cnlive.moudle.pedometer.utils.lib_permisshelper.PermissionsListener;
22 import com.cnlive.moudle.pedometer.utils.lib_permisshelper.PermissionsUtils; 29 import com.cnlive.moudle.pedometer.utils.lib_permisshelper.PermissionsUtils;
23 import com.example.moudle_pedometer.R; 30 import com.example.moudle_pedometer.R;
@@ -26,6 +33,8 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity { @@ -26,6 +33,8 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity {
26 33
27 private PermissionsUtils mPermissionsUtils;//权限申请 34 private PermissionsUtils mPermissionsUtils;//权限申请
28 private RunRaceDetailInfo runRaceDetailInfo; 35 private RunRaceDetailInfo runRaceDetailInfo;
  36 + private int permissionRequestCount = 0;//权限请求次数
  37 + private SelectDialog selectDialog;
29 38
30 public static void newInstance(Context context, String eventId, RunRaceDetailInfo runRaceDetailInfo) { 39 public static void newInstance(Context context, String eventId, RunRaceDetailInfo runRaceDetailInfo) {
31 CollCommonInfo.setStreetId(context, eventId); 40 CollCommonInfo.setStreetId(context, eventId);
@@ -49,13 +58,29 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity { @@ -49,13 +58,29 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity {
49 if (null != getIntent().getExtras()) { 58 if (null != getIntent().getExtras()) {
50 runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().getSerializable("runRaceDetailInfo"); 59 runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().getSerializable("runRaceDetailInfo");
51 } 60 }
52 - 61 + initPermissionDefineTip();
53 } 62 }
54 63
55 @Override 64 @Override
56 protected void onResume() { 65 protected void onResume() {
57 super.onResume(); 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 private void addFragment(QMUIFragment fragment) { 86 private void addFragment(QMUIFragment fragment) {
@@ -76,6 +101,9 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity { @@ -76,6 +101,9 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity {
76 * 一次申请一组权限(使用拒绝弹框)点击事件 101 * 一次申请一组权限(使用拒绝弹框)点击事件
77 */ 102 */
78 public void getPermissionsWithTip() { 103 public void getPermissionsWithTip() {
  104 + if (1 == permissionRequestCount) {
  105 + return;
  106 + }
79 mPermissionsUtils 107 mPermissionsUtils
80 .setPermissionsListener(new PermissionsListener() { 108 .setPermissionsListener(new PermissionsListener() {
81 @Override 109 @Override
@@ -121,6 +149,29 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity { @@ -121,6 +149,29 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity {
121 // , Manifest.permission.ACCESS_FINE_LOCATION); 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,6 +184,31 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity {
133 public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, 184 public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
134 @NonNull int[] grantResults) { 185 @NonNull int[] grantResults) {
135 super.onRequestPermissionsResult(requestCode, permissions, grantResults); 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,5 +98,12 @@ public class RaceNameListFragment extends MvpBindingFragment&lt;RaceNameListView, R
98 getMvpView().delectShoeLine(Integer.parseInt(messageEvent.getMessageContent()+"")); 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,6 +17,7 @@ import com.cnlive.libs.base.logic.callback.SuccessCallback;
17 import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; 17 import com.cnlive.moudle.pedometer.commonInfo.CommonInfo;
18 import com.cnlive.moudle.pedometer.frame.view.RunningFinishFragmentView; 18 import com.cnlive.moudle.pedometer.frame.view.RunningFinishFragmentView;
19 import com.cnlive.moudle.pedometer.model.Constant; 19 import com.cnlive.moudle.pedometer.model.Constant;
  20 +import com.cnlive.moudle.pedometer.model.MessageEvent;
20 import com.cnlive.moudle.pedometer.model.RunningFinishBean; 21 import com.cnlive.moudle.pedometer.model.RunningFinishBean;
21 import com.cnlive.moudle.pedometer.net.ApiServiceRunLin; 22 import com.cnlive.moudle.pedometer.net.ApiServiceRunLin;
22 import com.cnlive.moudle.pedometer.net.SubscriptionRequest; 23 import com.cnlive.moudle.pedometer.net.SubscriptionRequest;
@@ -32,6 +33,8 @@ import com.cnlive.moudle.pedometer.utils.StepUtil; @@ -32,6 +33,8 @@ import com.cnlive.moudle.pedometer.utils.StepUtil;
32 import com.example.moudle_pedometer.R; 33 import com.example.moudle_pedometer.R;
33 import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; 34 import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter;
34 35
  36 +import org.greenrobot.eventbus.EventBus;
  37 +
35 import java.util.ArrayList; 38 import java.util.ArrayList;
36 import java.util.HashMap; 39 import java.util.HashMap;
37 import java.util.List; 40 import java.util.List;
@@ -135,11 +138,12 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter&lt;RunningFinis @@ -135,11 +138,12 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter&lt;RunningFinis
135 dialog.dismiss(); 138 dialog.dismiss();
136 StepUtil.clearRunData(context, CommonInfo.getUserId(context)); 139 StepUtil.clearRunData(context, CommonInfo.getUserId(context));
137 CommonInfo.reset(context); 140 CommonInfo.reset(context);
  141 + //用户跑完了,更新一下按钮
  142 + EventBus.getDefault().post(new MessageEvent(Constant.UPDATE_RACE_STATE_BTN, ""));
138 //跳转到上传失败列表 143 //跳转到上传失败列表
139 LineUpAgainActivity.newInstance(context); 144 LineUpAgainActivity.newInstance(context);
140 //关闭当前窗口 145 //关闭当前窗口
141 context.finish(); 146 context.finish();
142 -  
143 } 147 }
144 }); 148 });
145 uploadFailDialog.setCanceledOnTouchOutside(false); 149 uploadFailDialog.setCanceledOnTouchOutside(false);
@@ -170,7 +174,8 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter&lt;RunningFinis @@ -170,7 +174,8 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter&lt;RunningFinis
170 //删除当前跑步数据 174 //删除当前跑步数据
171 StepUtil.clearRunData(context, CommonInfo.getUserId(context)); 175 StepUtil.clearRunData(context, CommonInfo.getUserId(context));
172 CommonInfo.reset(context); 176 CommonInfo.reset(context);
173 - 177 + //用户跑完了,更新一下按钮
  178 + EventBus.getDefault().post(new MessageEvent(Constant.UPDATE_RACE_STATE_BTN, ""));
174 } 179 }
175 }).start(); 180 }).start();
176 } 181 }
@@ -346,11 +351,12 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter&lt;RunningFinis @@ -346,11 +351,12 @@ public class RunningFinishFragmetPresenter extends MvpBasePresenter&lt;RunningFinis
346 dialog.dismiss(); 351 dialog.dismiss();
347 StepUtil.clearRunData(context, CommonInfo.getUserId(context)); 352 StepUtil.clearRunData(context, CommonInfo.getUserId(context));
348 CommonInfo.reset(context); 353 CommonInfo.reset(context);
  354 + //用户跑完了,更新一下按钮
  355 + EventBus.getDefault().post(new MessageEvent(Constant.UPDATE_RACE_STATE_BTN,""));
349 //跳转到上传失败列表 356 //跳转到上传失败列表
350 LineUpAgainActivity.newInstance(context); 357 LineUpAgainActivity.newInstance(context);
351 //关闭当前窗口 358 //关闭当前窗口
352 context.finish(); 359 context.finish();
353 -  
354 } 360 }
355 }); 361 });
356 failTraceDialog.setCanceledOnTouchOutside(false); 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,14 +336,14 @@ public class RunningMapFragmentPresenter extends MvpBasePresenter&lt;RunningMapFrag
336 } 336 }
337 } 337 }
338 if (importPoints != null && resultPoints != null) { 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 if (isPause) { 347 if (isPause) {
348 MyMapUtil.drawRealTimeTrack(context, getView().baiduMap, resultPoints, SortType.asc, R.color.red, R.drawable.icon_start); 348 MyMapUtil.drawRealTimeTrack(context, getView().baiduMap, resultPoints, SortType.asc, R.color.red, R.drawable.icon_start);
349 } else { 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,7 +238,7 @@ public class OnGoingFragmentView implements MvpView {
238 fragment.binding.includeStreet.tvAddress.setText(runRaceDetailInfo.getAddress()); 238 fragment.binding.includeStreet.tvAddress.setText(runRaceDetailInfo.getAddress());
239 //设置活动距离 239 //设置活动距离
240 if (!TextUtils.isEmpty(runRaceDetailInfo.getMileage())) { 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,10 +113,14 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
113 private final float DEFAULT_MAP_AUTO_ZOOM = -0.8f;//根据点位,自动缩放的比例 113 private final float DEFAULT_MAP_AUTO_ZOOM = -0.8f;//根据点位,自动缩放的比例
114 private List<LatLng> queryResultPoints;//查询到的历史轨迹 114 private List<LatLng> queryResultPoints;//查询到的历史轨迹
115 private List<String> joinFaceIcon;//参与活动人数 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 public RunRaceDetailFragmentView(RunRaceDetailFragment fragment) { 125 public RunRaceDetailFragmentView(RunRaceDetailFragment fragment) {
122 this.fragment = fragment; 126 this.fragment = fragment;
@@ -176,6 +180,10 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { @@ -176,6 +180,10 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
176 // fragment.binding.includeStreet.rlStartBtn.setVisibility(View.VISIBLE); 180 // fragment.binding.includeStreet.rlStartBtn.setVisibility(View.VISIBLE);
177 //设置底部卡片第一次可滑动的位置 181 //设置底部卡片第一次可滑动的位置
178 fragment.binding.slidingLayout.setAnchorPoint(0.6f); 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 fragment.binding.slidingLayout.addPanelSlideListener(new SlidingUpPanelLayout.PanelSlideListener() { 187 fragment.binding.slidingLayout.addPanelSlideListener(new SlidingUpPanelLayout.PanelSlideListener() {
180 @Override 188 @Override
181 public void onPanelSlide(View panel, float slideOffset) { 189 public void onPanelSlide(View panel, float slideOffset) {
@@ -455,17 +463,20 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { @@ -455,17 +463,20 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
455 GlideApp.with(getContext()).load(runRaceDetailInfo.getRoadmap()).into(fragment.binding.includeStreetIntroduce.ivRoadMao); 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 // fragment.binding.includeStreet.rlStartBtn.setOnClickListener(new View.OnClickListener() { 482 // fragment.binding.includeStreet.rlStartBtn.setOnClickListener(new View.OnClickListener() {
@@ -518,14 +529,27 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { @@ -518,14 +529,27 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
518 fragment.binding.rlScrollViewStartBtn.setOnClickListener(new View.OnClickListener() { 529 fragment.binding.rlScrollViewStartBtn.setOnClickListener(new View.OnClickListener() {
519 @Override 530 @Override
520 public void onClick(View view) { 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 if (null != runRaceDetailInfo) { 538 if (null != runRaceDetailInfo) {
524 RegistrationInfoActivity.newInstance(fragment.getActivity(), runRaceDetailInfo.getFenceId()); 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 if (null != endLatLng && null != startLatLng) { 554 if (null != endLatLng && null != startLatLng) {
531 //开始比较距离 555 //开始比较距离
@@ -554,7 +578,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { @@ -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 if (!isDifferentStreet) { 582 if (!isDifferentStreet) {
559 SelectDialog continueTipDialog = new SelectDialog(getContext(), "是否继续运动", "否", new SelectDialog.DialogInterface() { 583 SelectDialog continueTipDialog = new SelectDialog(getContext(), "是否继续运动", "否", new SelectDialog.DialogInterface() {
560 @Override 584 @Override
@@ -568,7 +592,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { @@ -568,7 +592,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
568 dialog.dismiss(); 592 dialog.dismiss();
569 //重置按钮 593 //重置按钮
570 fragment.binding.tvRunNow.setText("立即开始"); 594 fragment.binding.tvRunNow.setText("立即开始");
571 - fragment.binding.rlScrollViewStartBtn.setTag(START_RACE); 595 + fragment.binding.rlScrollViewStartBtn.setTag(BTN_START_RACE);
572 } 596 }
573 }, "是", new SelectDialog.DialogInterface() { 597 }, "是", new SelectDialog.DialogInterface() {
574 @Override 598 @Override
@@ -597,7 +621,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { @@ -597,7 +621,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
597 CommonInfo.resetRace(getContext()); 621 CommonInfo.resetRace(getContext());
598 //更改当前按钮 622 //更改当前按钮
599 fragment.binding.tvRunNow.setText("立即开始"); 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 }, "是", new SelectDialog.DialogInterface() { 627 }, "是", new SelectDialog.DialogInterface() {
@@ -611,8 +635,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { @@ -611,8 +635,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
611 selectDialog.setCancelable(false); 635 selectDialog.setCancelable(false);
612 selectDialog.show(); 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 return; 639 return;
617 } 640 }
618 } 641 }
@@ -648,6 +671,56 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { @@ -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 private void checkBaiduServiceState() { 724 private void checkBaiduServiceState() {
652 CommonInfo.setIsRunKeepAliveService(getContext(), true); 725 CommonInfo.setIsRunKeepAliveService(getContext(), true);
653 CommonInfo.setIsRunStepService(getContext(), true); 726 CommonInfo.setIsRunStepService(getContext(), true);
@@ -1027,15 +1100,16 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { @@ -1027,15 +1100,16 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
1027 if ((currnetTime - userPauseTime) <= (9 * 60 * 60 * 1000)) { 1100 if ((currnetTime - userPauseTime) <= (9 * 60 * 60 * 1000)) {
1028 Log.e(TAG, "小于9小时"); 1101 Log.e(TAG, "小于9小时");
1029 fragment.binding.tvRunNow.setText("继续运动"); 1102 fragment.binding.tvRunNow.setText("继续运动");
1030 - fragment.binding.rlScrollViewStartBtn.setTag(CONTINUE_RACE); 1103 + fragment.binding.rlScrollViewStartBtn.setTag(BTN_CONTINUE_RACE);
1031 } else { 1104 } else {
1032 Log.e(TAG, "大于9小时"); 1105 Log.e(TAG, "大于9小时");
1033 //重置数据 1106 //重置数据
1034 CommonInfo.resetRace(getContext()); 1107 CommonInfo.resetRace(getContext());
1035 //清空数据库 1108 //清空数据库
1036 StepUtil.clearRunData(getContext(), CommonInfo.getUserId(getContext())); 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,19 +1121,10 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
1047 isDifferentStreet = true; 1121 isDifferentStreet = true;
1048 } 1122 }
1049 //判断赛事是否已经结束 1123 //判断赛事是否已经结束
1050 - checkTheRaceIsEnd(); 1124 +// checkTheRaceIsEnd();
1051 } else { 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,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 public void onPause() { 1175 public void onPause() {
1119 if (mMapView != null) { 1176 if (mMapView != null) {
1120 mMapView.onPause(); 1177 mMapView.onPause();
@@ -1271,55 +1328,56 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { @@ -1271,55 +1328,56 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
1271 if (getContext() == null) { 1328 if (getContext() == null) {
1272 return; 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,10 +22,10 @@ public class Constant {
22 public static final int DELECT_COLL_BIND_TRACE_LIST = 13;//删除已绑定列表 22 public static final int DELECT_COLL_BIND_TRACE_LIST = 13;//删除已绑定列表
23 public static final int SERVICE_STEP_COUNT_ONRESUME = 14;//用户从后台回到前台,更新步数 23 public static final int SERVICE_STEP_COUNT_ONRESUME = 14;//用户从后台回到前台,更新步数
24 public static final int COLL_SERVICE_STEP_COUNT_ONRESUME = 15;//运营从后台回到前台,更新步数 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 // public static final long SERVICE_ID = 213553; 29 // public static final long SERVICE_ID = 213553;
30 public static final int TAG = 1; 30 public static final int TAG = 1;
31 public static final int GATHER_INTERVAL = 2;//位置采集周期 31 public static final int GATHER_INTERVAL = 2;//位置采集周期
@@ -42,4 +42,5 @@ public class Constant { @@ -42,4 +42,5 @@ public class Constant {
42 public static final int FENCE_OFFSET = 50;//围栏偏离距离 42 public static final int FENCE_OFFSET = 50;//围栏偏离距离
43 public static final int FENCE_DENOISE = 20;//围栏去噪精度 43 public static final int FENCE_DENOISE = 20;//围栏去噪精度
44 public static final int TAKE_POINT_MAX_SIZE = 100;//最大打点数量 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,12 +86,21 @@ public class RunRaceDetailInfo implements Serializable {
86 private String userMileage; 86 private String userMileage;
87 private List<String> faceUrl; 87 private List<String> faceUrl;
88 private List<String> finishFaceUrl; 88 private List<String> finishFaceUrl;
  89 + private String eventState;//1-报名未开始 2-立即报名 3-活动未开始 4-过了报名时间 5-立即开始活动
89 /*********************************后加的,非接口返回,用于*******************************************/ 90 /*********************************后加的,非接口返回,用于*******************************************/
90 private String endLatLng;//终点坐标,后加的,不是后台返回,这是从百度历史轨迹查出来的 91 private String endLatLng;//终点坐标,后加的,不是后台返回,这是从百度历史轨迹查出来的
91 private boolean endState;//活动是否结束(true 结束 false 未结束 ) 92 private boolean endState;//活动是否结束(true 结束 false 未结束 )
92 private String collStartLatLng;//运营打的点 93 private String collStartLatLng;//运营打的点
93 private String collStartLntLngName;//运营打点名称 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 public String getCollStartLatLng() { 104 public String getCollStartLatLng() {
96 return collStartLatLng; 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,11 +231,6 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity {
231 if (!ActivityCompat.shouldShowRequestPermissionRationale(this, permissions[i])) { 231 if (!ActivityCompat.shouldShowRequestPermissionRationale(this, permissions[i])) {
232 isShowPermissionTip = false; 232 isShowPermissionTip = false;
233 break; 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,6 +8,7 @@ import android.view.LayoutInflater;
8 import android.view.View; 8 import android.view.View;
9 import android.view.ViewGroup; 9 import android.view.ViewGroup;
10 import android.widget.ImageView; 10 import android.widget.ImageView;
  11 +import android.widget.LinearLayout;
11 import android.widget.RelativeLayout; 12 import android.widget.RelativeLayout;
12 import android.widget.TextView; 13 import android.widget.TextView;
13 14
@@ -18,6 +19,7 @@ import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; @@ -18,6 +19,7 @@ import com.cnlive.moudle.pedometer.commonInfo.CommonInfo;
18 import com.cnlive.moudle.pedometer.net.bean.MyRecordInfo; 19 import com.cnlive.moudle.pedometer.net.bean.MyRecordInfo;
19 import com.cnlive.moudle.pedometer.ui.activity.RaceRecordActivity; 20 import com.cnlive.moudle.pedometer.ui.activity.RaceRecordActivity;
20 import com.cnlive.moudle.pedometer.ui.widget.FivePersonIconView; 21 import com.cnlive.moudle.pedometer.ui.widget.FivePersonIconView;
  22 +import com.cnlive.moudle.pedometer.utils.ScreenUtil;
21 import com.cnlive.moudle.pedometer.utils.TimeUtil; 23 import com.cnlive.moudle.pedometer.utils.TimeUtil;
22 import com.example.moudle_pedometer.R; 24 import com.example.moudle_pedometer.R;
23 25
@@ -70,7 +72,17 @@ public class MyRecordAdapter extends RecyclerView.Adapter&lt;MyRecordAdapter.MyView @@ -70,7 +72,17 @@ public class MyRecordAdapter extends RecyclerView.Adapter&lt;MyRecordAdapter.MyView
70 myViewHolder.line_address.setText(list.get(i).getAddress()); 72 myViewHolder.line_address.setText(list.get(i).getAddress());
71 } 73 }
72 myViewHolder.people_part.setText(list.get(i).getSignupNum() + ""); 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 if(state.equals("0")){ 86 if(state.equals("0")){
75 myViewHolder.day_num.setVisibility(View.VISIBLE); 87 myViewHolder.day_num.setVisibility(View.VISIBLE);
76 myViewHolder.after_finish.setVisibility(View.GONE); 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,11 +8,13 @@ import android.view.LayoutInflater;
8 import android.view.View; 8 import android.view.View;
9 import android.view.ViewGroup; 9 import android.view.ViewGroup;
10 import android.widget.ImageView; 10 import android.widget.ImageView;
  11 +import android.widget.LinearLayout;
11 import android.widget.RelativeLayout; 12 import android.widget.RelativeLayout;
12 import android.widget.TextView; 13 import android.widget.TextView;
13 14
14 import com.cnlive.moudle.pedometer.net.bean.RunLineInfo; 15 import com.cnlive.moudle.pedometer.net.bean.RunLineInfo;
15 import com.cnlive.moudle.pedometer.ui.widget.FivePersonIconView; 16 import com.cnlive.moudle.pedometer.ui.widget.FivePersonIconView;
  17 +import com.cnlive.moudle.pedometer.utils.ScreenUtil;
16 import com.cnlive.moudle.pedometer.utils.TimeUtil; 18 import com.cnlive.moudle.pedometer.utils.TimeUtil;
17 import com.example.moudle_pedometer.R; 19 import com.example.moudle_pedometer.R;
18 20
@@ -67,6 +69,11 @@ public class RunLineAdapter extends RecyclerView.Adapter&lt;RunLineAdapter.MyViewHo @@ -67,6 +69,11 @@ public class RunLineAdapter extends RecyclerView.Adapter&lt;RunLineAdapter.MyViewHo
67 myViewHolder.people_part.setText(list.get(i).getSignupNum() + ""); 69 myViewHolder.people_part.setText(list.get(i).getSignupNum() + "");
68 if (null != list.get(i).getFaceUrl() && list.get(i).getFaceUrl().size() > 0) { 70 if (null != list.get(i).getFaceUrl() && list.get(i).getFaceUrl().size() > 0) {
69 myViewHolder.join_person.initIconData(list.get(i).getFaceUrl()); 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 myViewHolder.join_person.setVisibility(View.VISIBLE); 77 myViewHolder.join_person.setVisibility(View.VISIBLE);
71 } else { 78 } else {
72 myViewHolder.join_person.setVisibility(View.GONE); 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,5 +196,14 @@ public class RunRaceDetailFragment extends QMUIFragment&lt;RunRaceDetailFragmentVie
196 getMvpView().setRegistrationBtn(); 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,6 +52,17 @@ public class FivePersonIconView extends LinearLayout {
52 qr4 = findViewById(R.id.qm_iv4); 52 qr4 = findViewById(R.id.qm_iv4);
53 qr5 = findViewById(R.id.qm_iv5); 53 qr5 = findViewById(R.id.qm_iv5);
54 iv_right = findViewById(R.id.iv_right); 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 TypedArray attributes = context.obtainStyledAttributes(attrs, R.styleable.FivePersonIconView); 67 TypedArray attributes = context.obtainStyledAttributes(attrs, R.styleable.FivePersonIconView);
57 isShowRight = attributes.getBoolean(R.styleable.FivePersonIconView_showRightFlag, true); 68 isShowRight = attributes.getBoolean(R.styleable.FivePersonIconView_showRightFlag, true);
@@ -72,12 +83,6 @@ public class FivePersonIconView extends LinearLayout { @@ -72,12 +83,6 @@ public class FivePersonIconView extends LinearLayout {
72 if (qr1 == null || qr2 == null || qr3 == null || qr4 == null || qr5 == null) { 83 if (qr1 == null || qr2 == null || qr3 == null || qr4 == null || qr5 == null) {
73 return; 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 if (iconList != null && iconList.size() > 0) { 87 if (iconList != null && iconList.size() > 0) {
83 for (int i = 0; i < iconList.size(); i++) { 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,6 +5,7 @@ import android.graphics.Bitmap;
5 import android.graphics.BitmapFactory; 5 import android.graphics.BitmapFactory;
6 import android.location.LocationManager; 6 import android.location.LocationManager;
7 import android.os.Handler; 7 import android.os.Handler;
  8 +import android.text.TextUtils;
8 import android.util.Log; 9 import android.util.Log;
9 import android.widget.Toast; 10 import android.widget.Toast;
10 11
@@ -18,6 +19,12 @@ import com.baidu.mapapi.map.OverlayOptions; @@ -18,6 +19,12 @@ import com.baidu.mapapi.map.OverlayOptions;
18 import com.baidu.mapapi.map.PolylineOptions; 19 import com.baidu.mapapi.map.PolylineOptions;
19 import com.baidu.mapapi.model.LatLng; 20 import com.baidu.mapapi.model.LatLng;
20 import com.baidu.mapapi.model.LatLngBounds; 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 import com.baidu.mapapi.utils.DistanceUtil; 28 import com.baidu.mapapi.utils.DistanceUtil;
22 import com.baidu.trace.LBSTraceClient; 29 import com.baidu.trace.LBSTraceClient;
23 import com.baidu.trace.api.track.DistanceRequest; 30 import com.baidu.trace.api.track.DistanceRequest;
@@ -52,7 +59,83 @@ public class MyMapUtil { @@ -52,7 +59,83 @@ public class MyMapUtil {
52 //分页索引 59 //分页索引
53 private static int pageIndex = 1; 60 private static int pageIndex = 1;
54 private static List<LatLng> trackPoints; 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,4 +1168,8 @@ public class MyMapUtil {
1085 public interface CallBack { 1168 public interface CallBack {
1086 public void success(List<LatLng> resultPoints); 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,7 +11,7 @@
11 <com.qmuiteam.qmui.widget.QMUITopBar 11 <com.qmuiteam.qmui.widget.QMUITopBar
12 android:id="@+id/topbar" 12 android:id="@+id/topbar"
13 android:layout_width="match_parent" 13 android:layout_width="match_parent"
14 - android:layout_height="?attr/qmui_topbar_height" /> 14 + android:layout_height="48dp" />
15 15
16 <android.support.design.widget.TabLayout 16 <android.support.design.widget.TabLayout
17 android:id="@+id/tabs" 17 android:id="@+id/tabs"
moudle_pedometer/src/main/res/layout/five_persion_icon.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 xmlns:app="http://schemas.android.com/apk/res-auto" 3 xmlns:app="http://schemas.android.com/apk/res-auto"
4 - android:layout_width="match_parent" 4 + android:layout_width="wrap_content"
5 android:layout_height="wrap_content" 5 android:layout_height="wrap_content"
6 - android:gravity="center_vertical|right"> 6 + android:gravity="center_vertical">
7 7
8 8
9 <com.qmuiteam.qmui.widget.QMUIRadiusImageView 9 <com.qmuiteam.qmui.widget.QMUIRadiusImageView
@@ -11,7 +11,6 @@ @@ -11,7 +11,6 @@
11 android:layout_width="40dp" 11 android:layout_width="40dp"
12 android:layout_height="40dp" 12 android:layout_height="40dp"
13 android:layout_marginLeft="10dp" 13 android:layout_marginLeft="10dp"
14 - android:background="@drawable/tc_ic_workout_level_adjust_coach"  
15 app:qmui_corner_radius="100dp" /> 14 app:qmui_corner_radius="100dp" />
16 15
17 <com.qmuiteam.qmui.widget.QMUIRadiusImageView 16 <com.qmuiteam.qmui.widget.QMUIRadiusImageView
@@ -19,7 +18,6 @@ @@ -19,7 +18,6 @@
19 android:layout_width="40dp" 18 android:layout_width="40dp"
20 android:layout_height="40dp" 19 android:layout_height="40dp"
21 android:layout_marginLeft="-10dp" 20 android:layout_marginLeft="-10dp"
22 - android:background="@drawable/tc_ic_workout_level_adjust_coach"  
23 app:qmui_corner_radius="100dp" /> 21 app:qmui_corner_radius="100dp" />
24 22
25 <com.qmuiteam.qmui.widget.QMUIRadiusImageView 23 <com.qmuiteam.qmui.widget.QMUIRadiusImageView
@@ -27,7 +25,6 @@ @@ -27,7 +25,6 @@
27 android:layout_width="40dp" 25 android:layout_width="40dp"
28 android:layout_height="40dp" 26 android:layout_height="40dp"
29 android:layout_marginLeft="-10dp" 27 android:layout_marginLeft="-10dp"
30 - android:background="@drawable/tc_ic_workout_level_adjust_coach"  
31 app:qmui_corner_radius="100dp" /> 28 app:qmui_corner_radius="100dp" />
32 29
33 <com.qmuiteam.qmui.widget.QMUIRadiusImageView 30 <com.qmuiteam.qmui.widget.QMUIRadiusImageView
@@ -35,7 +32,6 @@ @@ -35,7 +32,6 @@
35 android:layout_width="40dp" 32 android:layout_width="40dp"
36 android:layout_height="40dp" 33 android:layout_height="40dp"
37 android:layout_marginLeft="-10dp" 34 android:layout_marginLeft="-10dp"
38 - android:background="@drawable/tc_ic_workout_level_adjust_coach"  
39 app:qmui_corner_radius="100dp" /> 35 app:qmui_corner_radius="100dp" />
40 36
41 <com.qmuiteam.qmui.widget.QMUIRadiusImageView 37 <com.qmuiteam.qmui.widget.QMUIRadiusImageView
@@ -43,7 +39,6 @@ @@ -43,7 +39,6 @@
43 android:layout_width="40dp" 39 android:layout_width="40dp"
44 android:layout_height="40dp" 40 android:layout_height="40dp"
45 android:layout_marginLeft="-10dp" 41 android:layout_marginLeft="-10dp"
46 - android:background="@drawable/tc_ic_workout_level_adjust_coach"  
47 app:qmui_corner_radius="100dp" /> 42 app:qmui_corner_radius="100dp" />
48 43
49 <ImageView 44 <ImageView
moudle_pedometer/src/main/res/layout/fragment_run_main.xml
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 <layout xmlns:android="http://schemas.android.com/apk/res/android"> 2 <layout xmlns:android="http://schemas.android.com/apk/res/android">
3 3
4 <LinearLayout 4 <LinearLayout
  5 + android:id="@+id/ll_root"
5 android:layout_width="match_parent" 6 android:layout_width="match_parent"
6 android:layout_height="match_parent" 7 android:layout_height="match_parent"
7 android:background="@color/run_main_bg" 8 android:background="@color/run_main_bg"
@@ -9,14 +10,12 @@ @@ -9,14 +10,12 @@
9 10
10 <FrameLayout 11 <FrameLayout
11 android:layout_width="match_parent" 12 android:layout_width="match_parent"
12 - android:background="@color/run_main_bg"  
13 android:layout_height="match_parent"> 13 android:layout_height="match_parent">
14 14
15 <LinearLayout 15 <LinearLayout
16 android:id="@+id/ll_run_main_root" 16 android:id="@+id/ll_run_main_root"
17 android:layout_width="match_parent" 17 android:layout_width="match_parent"
18 android:layout_height="match_parent" 18 android:layout_height="match_parent"
19 - android:background="@color/run_main_bg"  
20 android:orientation="vertical"> 19 android:orientation="vertical">
21 20
22 <RelativeLayout 21 <RelativeLayout
moudle_pedometer/src/main/res/layout/fragment_run_race_detail.xml
@@ -117,7 +117,7 @@ @@ -117,7 +117,7 @@
117 android:layout_height="40sp" 117 android:layout_height="40sp"
118 android:layout_gravity="bottom" 118 android:layout_gravity="bottom"
119 android:background="@color/green_round" 119 android:background="@color/green_round"
120 - android:tag="0"> 120 + android:tag="1">
121 121
122 <TextView 122 <TextView
123 android:id="@+id/tv_run_now" 123 android:id="@+id/tv_run_now"
moudle_pedometer/src/main/res/layout/item_my_record.xml
@@ -82,7 +82,7 @@ @@ -82,7 +82,7 @@
82 android:id="@+id/join_person" 82 android:id="@+id/join_person"
83 android:layout_width="150dp" 83 android:layout_width="150dp"
84 android:layout_height="40dp" 84 android:layout_height="40dp"
85 - android:layout_marginRight="10dp" 85 + android:gravity="left"
86 FivePersonIconView:showRightFlag="false" /> 86 FivePersonIconView:showRightFlag="false" />
87 87
88 <TextView 88 <TextView
moudle_pedometer/src/main/res/layout/layout_run_detail_street.xml
@@ -446,6 +446,7 @@ @@ -446,6 +446,7 @@
446 android:id="@+id/five_join_person" 446 android:id="@+id/five_join_person"
447 android:layout_width="180dp" 447 android:layout_width="180dp"
448 android:layout_height="40dp" 448 android:layout_height="40dp"
  449 + android:gravity="right"
449 android:layout_marginRight="10dp" 450 android:layout_marginRight="10dp"
450 FivePersonIconView:showRightFlag="true" /> 451 FivePersonIconView:showRightFlag="true" />
451 452