Commit 0661b519e12c608b87cc4b3c8cff6687cb12ecab

Authored by 杨帅
1 parent b3f8d752

1 实现赛事详情页中赛事结束判断

moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollRunRaceDetailFragmentView.java
... ... @@ -171,21 +171,21 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen
171 171 fragment.binding.includeStreet.tvEndAddr.setText(runRaceDetailInfo.getEndLocation());
172 172 }
173 173 //设置起始报名时间
174   - if (!TextUtils.isEmpty(TimeUtil.getStampToTime(runRaceDetailInfo.getSign_up_start_time(), "yyyy-MM-dd"))) {
175   - fragment.binding.includeStreet.tvSignUpStartTime.setText(TimeUtil.getStampToTime(runRaceDetailInfo.getSign_up_start_time(), "yyyy-MM-dd"));
  174 + if (!TextUtils.isEmpty(TimeUtil.getStampToTime(runRaceDetailInfo.getSign_up_start_time(), "yyyy.MM.dd"))) {
  175 + fragment.binding.includeStreet.tvSignUpStartTime.setText(TimeUtil.getStampToTime(runRaceDetailInfo.getSign_up_start_time(), "yyyy.MM.dd"));
176 176  
177 177 }
178 178 //设置终止报名时间
179   - if (!TextUtils.isEmpty(TimeUtil.getStampToTime(runRaceDetailInfo.getSign_up_end_time(), "yyyy-MM-dd"))) {
180   - fragment.binding.includeStreet.tvSignUpEndTime.setText(TimeUtil.getStampToTime(runRaceDetailInfo.getSign_up_end_time(), "yyyy-MM-dd"));
  179 + if (!TextUtils.isEmpty(TimeUtil.getStampToTime(runRaceDetailInfo.getSign_up_end_time(), "yyyy.MM.dd"))) {
  180 + fragment.binding.includeStreet.tvSignUpEndTime.setText(TimeUtil.getStampToTime(runRaceDetailInfo.getSign_up_end_time(), "yyyy.MM.dd"));
181 181 }
182 182 //设置活动开始时间
183   - if (!TextUtils.isEmpty(TimeUtil.getStampToTime(runRaceDetailInfo.getStart_time(), "yyyy-MM-dd"))) {
184   - fragment.binding.includeStreet.tvActiveStartTime.setText(TimeUtil.getStampToTime(runRaceDetailInfo.getStart_time(), "yyyy-MM-dd"));
  183 + if (!TextUtils.isEmpty(TimeUtil.getStampToTime(runRaceDetailInfo.getStart_time(), "yyyy.MM.dd"))) {
  184 + fragment.binding.includeStreet.tvActiveStartTime.setText(TimeUtil.getStampToTime(runRaceDetailInfo.getStart_time(), "yyyy.MM.dd"));
185 185 }
186 186 //设置活动结束时间
187   - if (!TextUtils.isEmpty(TimeUtil.getStampToTime(runRaceDetailInfo.getEnd_time(), "yyyy-MM-dd"))) {
188   - fragment.binding.includeStreet.tvActiveEndTime.setText(TimeUtil.getStampToTime(runRaceDetailInfo.getEnd_time(), "yyyy-MM-dd"));
  187 + if (!TextUtils.isEmpty(TimeUtil.getStampToTime(runRaceDetailInfo.getEnd_time(), "yyyy.MM.dd"))) {
  188 + fragment.binding.includeStreet.tvActiveEndTime.setText(TimeUtil.getStampToTime(runRaceDetailInfo.getEnd_time(), "yyyy.MM.dd"));
189 189 }
190 190  
191 191  
... ... @@ -195,12 +195,6 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen
195 195 GlideApp.with(getContext()).load(runRaceDetailInfo.getRoadmap()).into(fragment.binding.includeStreetIntroduce.ivRoadMao);
196 196  
197 197 }
198   - //开始按钮点击事件(用户进行滑动滑动)
199   - fragment.binding.rlScrollViewStartBtn.setOnClickListener(new View.OnClickListener() {
200   - @Override
201   - public void onClick(View view) {
202   - }
203   - });
204 198 //添加轨迹按钮点击事件
205 199 fragment.binding.btnAddTrace.setOnClickListener(new View.OnClickListener() {
206 200 @Override
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/OnGoingFragmentView.java
... ... @@ -7,6 +7,7 @@ import android.graphics.BitmapFactory;
7 7 import android.text.TextUtils;
8 8 import android.util.Log;
9 9 import android.view.View;
  10 +import android.view.ViewTreeObserver;
10 11 import android.widget.LinearLayout;
11 12  
12 13 import com.alibaba.android.arouter.launcher.ARouter;
... ... @@ -210,15 +211,25 @@ public class OnGoingFragmentView implements MvpView {
210 211 //设置围栏ID
211 212 CommonInfo.setFenceId(getContext(), Integer.parseInt(runRaceDetailInfo.getFenceId()));
212 213 }
  214 + fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(), 140));
213 215 //设置标题
214 216 if (!TextUtils.isEmpty(runRaceDetailInfo.getTitle())) {
215 217 fragment.binding.includeStreet.tvRaceTitle.setText(runRaceDetailInfo.getTitle());
216   - //根据标题字数动态设置卡片高度
217   - if (runRaceDetailInfo.getTitle().length() > 19) {
218   - fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(), 162));
219   - } else {
220   - fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(), 140));
221   - }
  218 + //根据标题行数,自动调整卡片大小
  219 + fragment.binding.includeStreet.tvRaceTitle.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
  220 + @Override
  221 + public boolean onPreDraw() {
  222 + int line = fragment.binding.includeStreet.tvRaceTitle.getLineCount();
  223 + int height = fragment.binding.includeStreet.tvRaceTitle.getHeight();
  224 + if (line > 1) {
  225 + int avgHeight = height / line;//平局高度
  226 + fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(), 140) + avgHeight * (line - 1));
  227 +
  228 + }
  229 + fragment.binding.includeStreet.tvRaceTitle.getViewTreeObserver().removeOnPreDrawListener(this);
  230 + return false;
  231 + }
  232 + });
222 233 fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
223 234 }
224 235 //设置活动地点
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunRaceDetailFragmentView.java
... ... @@ -8,13 +8,11 @@ import android.hardware.Sensor;
8 8 import android.hardware.SensorEvent;
9 9 import android.hardware.SensorEventListener;
10 10 import android.hardware.SensorManager;
11   -import android.os.Handler;
12 11 import android.os.SystemClock;
13 12 import android.support.v4.content.ContextCompat;
14 13 import android.text.TextUtils;
15 14 import android.util.Log;
16 15 import android.view.View;
17   -import android.view.ViewGroup;
18 16 import android.view.ViewTreeObserver;
19 17 import android.widget.LinearLayout;
20 18 import android.widget.Toast;
... ... @@ -28,39 +26,18 @@ import com.baidu.mapapi.map.BaiduMap;
28 26 import com.baidu.mapapi.map.BitmapDescriptor;
29 27 import com.baidu.mapapi.map.BitmapDescriptorFactory;
30 28 import com.baidu.mapapi.map.MapStatus;
31   -import com.baidu.mapapi.map.MapStatusUpdate;
32 29 import com.baidu.mapapi.map.MapStatusUpdateFactory;
33 30 import com.baidu.mapapi.map.MapView;
34 31 import com.baidu.mapapi.map.MarkerOptions;
35 32 import com.baidu.mapapi.map.MyLocationConfiguration;
36 33 import com.baidu.mapapi.map.MyLocationData;
37   -import com.baidu.mapapi.map.Overlay;
38   -import com.baidu.mapapi.map.OverlayOptions;
39   -import com.baidu.mapapi.map.PolylineOptions;
40 34 import com.baidu.mapapi.map.UiSettings;
41 35 import com.baidu.mapapi.model.LatLng;
42   -import com.baidu.mapapi.model.LatLngBounds;
43   -import com.baidu.mapapi.search.core.SearchResult;
44   -import com.baidu.mapapi.search.route.BikingRouteResult;
45   -import com.baidu.mapapi.search.route.DrivingRouteResult;
46   -import com.baidu.mapapi.search.route.IndoorRouteResult;
47   -import com.baidu.mapapi.search.route.MassTransitRouteResult;
48   -import com.baidu.mapapi.search.route.OnGetRoutePlanResultListener;
49   -import com.baidu.mapapi.search.route.PlanNode;
50 36 import com.baidu.mapapi.search.route.RoutePlanSearch;
51   -import com.baidu.mapapi.search.route.TransitRouteResult;
52   -import com.baidu.mapapi.search.route.WalkingRoutePlanOption;
53   -import com.baidu.mapapi.search.route.WalkingRouteResult;
54 37 import com.baidu.mapapi.utils.DistanceUtil;
55 38 import com.baidu.trace.LBSTraceClient;
56   -import com.baidu.trace.Trace;
57   -import com.baidu.trace.model.LocationMode;
58 39 import com.baidu.trace.model.SortType;
59   -import com.cnlive.libs.base.logic.Event;
60   -import com.cnlive.libs.base.logic.callback.FailureCallback;
61   -import com.cnlive.libs.base.logic.callback.SuccessCallback;
62 40 import com.cnlive.libs.base.util.StatusBarUtil2;
63   -import com.cnlive.moudle.pedometer.commonInfo.CollCommonInfo;
64 41 import com.cnlive.moudle.pedometer.commonInfo.CommonInfo;
65 42 import com.cnlive.moudle.pedometer.model.Constant;
66 43 import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo;
... ... @@ -74,7 +51,6 @@ import com.cnlive.moudle.pedometer.ui.activity.TakePartActivity;
74 51 import com.cnlive.moudle.pedometer.ui.fragment.RunRaceDetailFragment;
75 52 import com.cnlive.moudle.pedometer.ui.widget.SelectDialog;
76 53 import com.cnlive.moudle.pedometer.ui.widget.TipDialog;
77   -import com.cnlive.moudle.pedometer.upload.UploadLogic;
78 54 import com.cnlive.moudle.pedometer.utils.BitmapUtil;
79 55 import com.cnlive.moudle.pedometer.utils.GsonUtil;
80 56 import com.cnlive.moudle.pedometer.utils.MyMapUtil;
... ... @@ -89,13 +65,7 @@ import com.hannesdorfmann.mosby3.mvp.MvpView;
89 65 import com.qmuiteam.qmui.util.QMUIStatusBarHelper;
90 66 import com.sothree.slidinguppanel.SlidingUpPanelLayout;
91 67  
92   -import java.io.File;
93   -import java.io.FileOutputStream;
94   -import java.io.LineNumberReader;
95   -import java.text.SimpleDateFormat;
96 68 import java.util.ArrayList;
97   -import java.util.Date;
98   -import java.util.LinkedList;
99 69 import java.util.List;
100 70  
101 71 public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
... ... @@ -353,20 +323,30 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
353 323 //设置标题
354 324 if (!TextUtils.isEmpty(runRaceDetailInfo.getTitle())) {
355 325 fragment.binding.includeStreet.tvRaceTitle.setText(runRaceDetailInfo.getTitle());
356   - fragment.binding.includeStreet.tvRaceTitle.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
357   - @Override
358   - public boolean onPreDraw() {
359   - Log.e(TAG, "initView: "+ fragment.binding.includeStreet.tvRaceTitle.getLineCount() );
360   - fragment.binding.includeStreet.tvRaceTitle.getViewTreeObserver().removeOnPreDrawListener(this);
361   - return false;
362   - }
363   - });
364   - //根据标题字数动态设置卡片高度
365   - if (runRaceDetailInfo.getTitle().length() > 19) {
366   - fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(), 200));
367   - } else {
368   - fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(), 181));
369   - }
  326 + fragment.binding.includeStreet.tvRaceTitle.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
  327 + @Override
  328 + public boolean onPreDraw() {
  329 + Log.e(TAG, "initView: " + fragment.binding.includeStreet.tvRaceTitle.getLineCount());
  330 + fragment.binding.includeStreet.tvRaceTitle.getViewTreeObserver().removeOnPreDrawListener(this);
  331 + return false;
  332 + }
  333 + });
  334 + fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(), 181) );
  335 + //根据标题行数,自动调整卡片大小
  336 + fragment.binding.includeStreet.tvRaceTitle.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
  337 + @Override
  338 + public boolean onPreDraw() {
  339 + int line = fragment.binding.includeStreet.tvRaceTitle.getLineCount();
  340 + int height = fragment.binding.includeStreet.tvRaceTitle.getHeight();
  341 + if (line > 1) {
  342 + int avgHeight = height / line;//平局高度
  343 + fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(), 181) + avgHeight * (line - 1));
  344 +
  345 + }
  346 + fragment.binding.includeStreet.tvRaceTitle.getViewTreeObserver().removeOnPreDrawListener(this);
  347 + return false;
  348 + }
  349 + });
370 350 fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
371 351 }
372 352 //设置活动地点
... ... @@ -1056,6 +1036,57 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
1056 1036 fragment.binding.tvRunNow.setText("立即开始");
1057 1037 fragment.binding.rlScrollViewStartBtn.setTag("1");
1058 1038 }
  1039 + //判断赛事是否已经结束
  1040 + checkTheRaceIsEnd();
  1041 +
  1042 + }
  1043 +
  1044 + /**
  1045 + * 判断赛事是否已经结束
  1046 + */
  1047 + private void checkTheRaceIsEnd() {
  1048 + //判断赛事是否结束
  1049 + if (null != userStepEntity) {
  1050 + if (null != runRaceDetailInfo) {
  1051 + //判断赛事id是否一致
  1052 + if (!TextUtils.isEmpty(userStepEntity.getStreetId())) {
  1053 + if (userStepEntity.getStreetId().equals(CommonInfo.getStreetId(getContext()))) {
  1054 + //判断赛事是否结束
  1055 + if (runRaceDetailInfo.isEndState()) {
  1056 + //结束清除数据
  1057 + //清空上次保存数据
  1058 + StepUtil.clearRunData(getContext(), CommonInfo.getUserId(getContext()));
  1059 + //停止服务
  1060 + stopStepService();
  1061 + //清除数据
  1062 + CommonInfo.resetRace(getContext());
  1063 + //设置按钮状态
  1064 + fragment.binding.rlScrollViewStartBtn.setTag("3");
  1065 + fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.red_round));
  1066 + fragment.binding.tvRunNow.setText("赛事已结束");
  1067 + fragment.binding.tvGoTip.setVisibility(View.GONE);
  1068 + }
  1069 + }
  1070 + }
  1071 + }
  1072 + } else {
  1073 + //如果数据库中没有数据,即,用户在当前赛事已经结束
  1074 + if (null != runRaceDetailInfo) {
  1075 + if (runRaceDetailInfo.isEndState()) {
  1076 + //设置按钮状态
  1077 + fragment.binding.rlScrollViewStartBtn.setTag("3");
  1078 + fragment.binding.rlScrollViewStartBtn.setBackgroundColor(getContext().getResources().getColor(R.color.red_round));
  1079 + fragment.binding.tvRunNow.setText("赛事已结束");
  1080 + fragment.binding.tvGoTip.setVisibility(View.GONE);
  1081 + }
  1082 + }
  1083 + }
  1084 + }
  1085 +
  1086 + /**
  1087 + * 赛事已经结束
  1088 + */
  1089 + private void raceHasEnd() {
1059 1090  
1060 1091 }
1061 1092  
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/net/bean/RunRaceDetailInfo.java
... ... @@ -87,6 +87,15 @@ public class RunRaceDetailInfo implements Serializable {
87 87 private List<String> faceUrl;
88 88 private List<String> finishFaceUrl;
89 89 private String endLatLng;//终点坐标,后加的,不是后台返回,这是从百度历史轨迹查出来的
  90 + private boolean endState;//活动是否结束(true 结束 false 未结束 )
  91 +
  92 + public boolean isEndState() {
  93 + return endState;
  94 + }
  95 +
  96 + public void setEndState(boolean endState) {
  97 + this.endState = endState;
  98 + }
90 99  
91 100 public String getEndLatLng() {
92 101 return endLatLng;
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/MyMapUtil.java
... ... @@ -331,7 +331,7 @@ public class MyMapUtil {
331 331 */
332 332 public static Overlay drawRealTimeTrack(Context context, BaiduMap baiduMap, List<LatLng> points, SortType sortType, int lineColor, int startIconRes) {
333 333 // 绘制新覆盖物前,清空之前的覆盖物
334   - if (points == null || points.size() == 0 || lineColor == 0 ) {
  334 + if (points == null || points.size() == 0 || lineColor == 0) {
335 335 return null;
336 336 }
337 337 //只有一个点
... ... @@ -378,114 +378,120 @@ public class MyMapUtil {
378 378 * 绘制服务器传过来的轨迹
379 379 */
380 380 public static List<Overlay> drawServerLineTrack(Context context, BaiduMap baiduMap, List<LatLng> points, SortType sortType, int lineColor, int startIconRes, int endIconRes) {
381   - // 绘制新覆盖物前,清空之前的覆盖物
382   - if (points == null || points.size() == 0) {
383   - return null;
384   - }
385   - List<Overlay> resultOverlays = new ArrayList<>();
386   - //只有一个点
387   - if (points.size() == 1) {
388   - Bitmap pointBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), startIconRes), 24, 30);
389   - OverlayOptions startOptions = null;
390   - if (pointBitmap != null) {
391   - startOptions = new MarkerOptions().position(points.get(0)).icon(BitmapDescriptorFactory.fromBitmap(pointBitmap));
392   - if (startOptions != null) {
393   - resultOverlays.add(baiduMap.addOverlay(startOptions));
  381 + try {
  382 + // 绘制新覆盖物前,清空之前的覆盖物
  383 + if (points == null || points.size() == 0) {
  384 + return null;
  385 + }
  386 + List<Overlay> resultOverlays = new ArrayList<>();
  387 + //只有一个点
  388 + if (points.size() == 1) {
  389 + Bitmap pointBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), startIconRes), 24, 30);
  390 + OverlayOptions startOptions = null;
  391 + if (pointBitmap != null) {
  392 + startOptions = new MarkerOptions().position(points.get(0)).icon(BitmapDescriptorFactory.fromBitmap(pointBitmap));
  393 + if (startOptions != null) {
  394 + resultOverlays.add(baiduMap.addOverlay(startOptions));
  395 + }
  396 + return resultOverlays;
394 397 }
395   - return resultOverlays;
396 398 }
397   - }
398 399  
399   - LatLng startPoint;
400   - LatLng endPoint;
401   - if (sortType == SortType.asc) {
402   - startPoint = points.get(0);
403   - endPoint = points.get(points.size() - 1);
404   - } else {
405   - startPoint = points.get(points.size() - 1);
406   - endPoint = points.get(0);
407   - }
408   - // 添加起点图标
409   - Bitmap startPointBitmap = null;
410   - if (null != context.getResources()) {
411   - startPointBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), startIconRes), 24, 30);
412   - }
413   - OverlayOptions startOptions = null;
414   - if (startPointBitmap != null) {
415   - startOptions = new MarkerOptions()
416   - .position(startPoint)
417   - .icon(BitmapDescriptorFactory.fromBitmap(startPointBitmap))
418   - .perspective(false)
419   - .animateType(MarkerOptions.MarkerAnimateType.grow);
420   - }
421   - // 添加终点图标
422   - Bitmap endPointBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), endIconRes), 24, 30);
423   - OverlayOptions endOptions = null;
424   - if (endPointBitmap != null) {
425   - endOptions = new MarkerOptions()
426   - .position(endPoint)
427   - .icon(BitmapDescriptorFactory.fromBitmap(endPointBitmap))
428   - .perspective(false)
429   - .anchor(0.6f, 0.96f)
430   - .animateType(MarkerOptions.MarkerAnimateType.grow);
431   - }
432   - // 添加圆形范围
433   - Bitmap startCircleBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), R.drawable.circle_point_raduis), 60, 60);
434   - OverlayOptions startCircleOptions = null;
435   - OverlayOptions endCircleOptions = null;
436   - if (startCircleBitmap != null) {
437   - startCircleOptions = new MarkerOptions()
438   - .position(startPoint)
439   - .icon(BitmapDescriptorFactory.fromBitmap(startCircleBitmap))
440   - .perspective(false)
441   - .anchor(0.5f, 0.6f)
442   - .animateType(MarkerOptions.MarkerAnimateType.grow);
443   -
444   - endCircleOptions = new MarkerOptions()
445   - .position(endPoint)
446   - .icon(BitmapDescriptorFactory.fromBitmap(startCircleBitmap))
447   - .perspective(false)
448   - .anchor(0.5f, 0.6f)
449   - .animateType(MarkerOptions.MarkerAnimateType.grow);
450   - }
451   - // 添加路线(轨迹)
452   - OverlayOptions polylineOptions = null;
453   - if (points != null && points.size() > 1) {
454   - polylineOptions = new PolylineOptions().width(10)
455   - .color(context.getResources().getColor(lineColor)).points(points);
456   - }
457   - if (endCircleOptions != null) {
458   - resultOverlays.add(baiduMap.addOverlay(endCircleOptions));
459   - }
460   - if (startCircleOptions != null) {
461   - resultOverlays.add(baiduMap.addOverlay(startCircleOptions));
462   - }
463   - if (startOptions != null) {
464   - resultOverlays.add(baiduMap.addOverlay(startOptions));
  400 + LatLng startPoint;
  401 + LatLng endPoint;
  402 + if (sortType == SortType.asc) {
  403 + startPoint = points.get(0);
  404 + endPoint = points.get(points.size() - 1);
  405 + } else {
  406 + startPoint = points.get(points.size() - 1);
  407 + endPoint = points.get(0);
  408 + }
  409 + // 添加起点图标
  410 + Bitmap startPointBitmap = null;
  411 + if (null != context.getResources()) {
  412 + startPointBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), startIconRes), 24, 30);
  413 + }
  414 + OverlayOptions startOptions = null;
  415 + if (startPointBitmap != null) {
  416 + startOptions = new MarkerOptions()
  417 + .position(startPoint)
  418 + .icon(BitmapDescriptorFactory.fromBitmap(startPointBitmap))
  419 + .perspective(false)
  420 + .animateType(MarkerOptions.MarkerAnimateType.grow);
  421 + }
  422 + // 添加终点图标
  423 + Bitmap endPointBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), endIconRes), 24, 30);
  424 + OverlayOptions endOptions = null;
  425 + if (endPointBitmap != null) {
  426 + endOptions = new MarkerOptions()
  427 + .position(endPoint)
  428 + .icon(BitmapDescriptorFactory.fromBitmap(endPointBitmap))
  429 + .perspective(false)
  430 + .anchor(0.6f, 0.96f)
  431 + .animateType(MarkerOptions.MarkerAnimateType.grow);
  432 + }
  433 + // 添加圆形范围
  434 + Bitmap startCircleBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), R.drawable.circle_point_raduis), 60, 60);
  435 + OverlayOptions startCircleOptions = null;
  436 + OverlayOptions endCircleOptions = null;
  437 + if (startCircleBitmap != null) {
  438 + startCircleOptions = new MarkerOptions()
  439 + .position(startPoint)
  440 + .icon(BitmapDescriptorFactory.fromBitmap(startCircleBitmap))
  441 + .perspective(false)
  442 + .anchor(0.5f, 0.6f)
  443 + .animateType(MarkerOptions.MarkerAnimateType.grow);
  444 +
  445 + endCircleOptions = new MarkerOptions()
  446 + .position(endPoint)
  447 + .icon(BitmapDescriptorFactory.fromBitmap(startCircleBitmap))
  448 + .perspective(false)
  449 + .anchor(0.5f, 0.6f)
  450 + .animateType(MarkerOptions.MarkerAnimateType.grow);
  451 + }
  452 + // 添加路线(轨迹)
  453 + OverlayOptions polylineOptions = null;
  454 + if (points != null && points.size() > 1) {
  455 + polylineOptions = new PolylineOptions().width(10)
  456 + .color(context.getResources().getColor(lineColor)).points(points);
  457 + }
  458 + if (endCircleOptions != null) {
  459 + resultOverlays.add(baiduMap.addOverlay(endCircleOptions));
  460 + }
  461 + if (startCircleOptions != null) {
  462 + resultOverlays.add(baiduMap.addOverlay(startCircleOptions));
  463 + }
  464 + if (startOptions != null) {
  465 + resultOverlays.add(baiduMap.addOverlay(startOptions));
465 466  
466   - }
467   - if (endOptions != null) {
468   - resultOverlays.add(baiduMap.addOverlay(endOptions));
469   - }
470   - if (polylineOptions != null) {
471   - resultOverlays.add(baiduMap.addOverlay(polylineOptions));
  467 + }
  468 + if (endOptions != null) {
  469 + resultOverlays.add(baiduMap.addOverlay(endOptions));
  470 + }
  471 + if (polylineOptions != null) {
  472 + resultOverlays.add(baiduMap.addOverlay(polylineOptions));
472 473  
473   - }
474   - if (resultOverlays != null) {
475   - return resultOverlays;
476   - } else {
  474 + }
  475 + if (resultOverlays != null) {
  476 + return resultOverlays;
  477 + } else {
  478 + return null;
  479 + }
  480 + } catch (Exception e) {
477 481 return null;
478 482 }
479 483 }
480 484  
481 485  
482   - public static Overlay drawMapLine(Context context, BaiduMap baiduMap, List<LatLng> points, int lineColor) {
  486 + public static Overlay drawMapLine(Context context, BaiduMap
  487 + baiduMap, List<LatLng> points, int lineColor) {
483 488 OverlayOptions polylineOptions = new PolylineOptions().width(10)
484 489 .color(context.getResources().getColor(lineColor)).points(points);
485 490 return baiduMap.addOverlay(polylineOptions);
486 491 }
487 492  
488   - public static Overlay drawMapLineRoutePoint(Context context, BaiduMap baiduMap, List<RoutePoint> points, int lineColor) {
  493 + public static Overlay drawMapLineRoutePoint(Context context, BaiduMap
  494 + baiduMap, List<RoutePoint> points, int lineColor) {
489 495 List<LatLng> latLngs = new ArrayList<>();
490 496 for (RoutePoint routePoint : points) {
491 497 if (routePoint != null && routePoint.getLat() != 0 && routePoint.getLng() != 0) {
... ...
moudle_pedometer/src/main/res/drawable/shape_circle_30_btn_black_green.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<shape xmlns:android="http://schemas.android.com/apk/res/android">
  3 + <corners android:radius="100dp" />
  4 + <stroke
  5 + android:width="1dp"
  6 + android:color="@color/green_round" />
  7 + <solid android:color="@color/black_20" />
  8 +</shape>
0 9 \ No newline at end of file
... ...
moudle_pedometer/src/main/res/layout/fragment_collect_run_race_detail.xml
... ... @@ -48,12 +48,15 @@
48 48  
49 49 <Button
50 50 android:id="@+id/btn_add_trace"
51   - android:layout_width="wrap_content"
52   - android:layout_height="wrap_content"
  51 + android:layout_width="90dp"
  52 + android:layout_height="35dp"
53 53 android:layout_gravity="center"
54 54 android:layout_marginBottom="100dp"
  55 + android:background="@drawable/shape_circle_30_btn_black_green"
55 56 android:text="@string/layout_collect_bind_trace"
56   - android:textSize="15sp" />
  57 + android:textColor="@color/green_round"
  58 + android:textSize="15sp"
  59 + android:textStyle="bold" />
57 60 <!---->
58 61 <com.cnlive.strike.ui.widget.UIEmptyView
59 62 android:id="@+id/empty_layout"
... ... @@ -71,6 +74,7 @@
71 74 android:id="@+id/dragView"
72 75 android:layout_width="match_parent"
73 76 android:layout_height="match_parent"
  77 + android:background="@drawable/shape_left_right_10dp_white_raduis_bg"
74 78 android:clickable="false"
75 79 android:focusable="false">
76 80  
... ... @@ -92,7 +96,7 @@
92 96 <!---->
93 97 <View
94 98 android:layout_width="match_parent"
95   - android:layout_height="20dp"
  99 + android:layout_height="10dp"
96 100 android:background="#F4F4F4" />
97 101 <!--路线介绍-->
98 102 <include
... ... @@ -101,27 +105,6 @@
101 105 </LinearLayout>
102 106  
103 107 </ScrollView>
104   - <!--按钮-->
105   - <RelativeLayout
106   - android:id="@+id/rl_scrollView_startBtn"
107   - android:layout_width="match_parent"
108   - android:layout_height="40sp"
109   - android:layout_gravity="bottom"
110   - android:background="@color/green_round"
111   - android:tag="0">
112   -
113   - <TextView
114   - android:id="@+id/tv_run_now"
115   - android:layout_width="wrap_content"
116   - android:layout_height="wrap_content"
117   - android:layout_centerInParent="true"
118   - android:tag="0"
119   - android:text="@string/layout_collect_bind_trace"
120   - android:textColor="@color/white"
121   - android:textSize="18sp" />
122   -
123   -
124   - </RelativeLayout>
125 108 </FrameLayout>
126 109 </com.sothree.slidinguppanel.SlidingUpPanelLayout>
127 110  
... ...
moudle_pedometer/src/main/res/layout/layout_collect_run_detail_street.xml
... ... @@ -22,7 +22,6 @@
22 22 android:id="@+id/ll_first_panel_root"
23 23 android:layout_width="match_parent"
24 24 android:layout_height="wrap_content"
25   - android:background="@drawable/shape_left_right_10dp_white_raduis_bg"
26 25 android:orientation="vertical">
27 26 <!--活动标题-->
28 27 <TextView
... ... @@ -76,6 +75,15 @@
76 75  
77 76 </LinearLayout>
78 77 </LinearLayout>
  78 +
  79 + <View
  80 + android:layout_width="match_parent"
  81 + android:layout_height="1dp"
  82 + android:layout_marginLeft="35dp"
  83 + android:layout_marginTop="-5dp"
  84 + android:layout_marginRight="35dp"
  85 + android:layout_marginBottom="5dp"
  86 + android:background="@color/line" />
79 87 </LinearLayout>
80 88 <!---->
81 89 <LinearLayout
... ... @@ -92,8 +100,8 @@
92 100 android:gravity="center_vertical">
93 101  
94 102 <View
95   - android:layout_width="10dp"
96   - android:layout_height="10dp"
  103 + android:layout_width="6dp"
  104 + android:layout_height="6dp"
97 105 android:layout_marginLeft="25dp"
98 106 android:background="@drawable/shape_circle_green" />
99 107  
... ... @@ -114,6 +122,14 @@
114 122 android:textColor="@color/text_black"
115 123 android:textSize="15sp" />
116 124 </LinearLayout>
  125 + <!--竖线-->
  126 + <View
  127 + android:layout_width="1dp"
  128 + android:layout_height="20dp"
  129 + android:layout_marginLeft="37dp"
  130 + android:layout_marginTop="-3dp"
  131 + android:layout_marginBottom="-13dp"
  132 + android:background="@color/vertical_line" />
117 133 <!--终点-->
118 134 <LinearLayout
119 135 android:id="@+id/ll_end_point"
... ... @@ -124,8 +140,8 @@
124 140 android:gravity="center_vertical">
125 141  
126 142 <View
127   - android:layout_width="10dp"
128   - android:layout_height="10dp"
  143 + android:layout_width="6dp"
  144 + android:layout_height="6dp"
129 145 android:layout_marginLeft="25dp"
130 146 android:background="@drawable/shape_circle_red" />
131 147  
... ... @@ -189,7 +205,7 @@
189 205 android:layout_width="wrap_content"
190 206 android:layout_height="match_parent"
191 207 android:layout_marginLeft="5dp"
192   - android:text="——"
  208 + android:text=""
193 209 android:textColor="@color/text_black"
194 210 android:textSize="15sp" />
195 211  
... ... @@ -206,9 +222,9 @@
206 222 <View
207 223 android:layout_width="match_parent"
208 224 android:layout_height="1dp"
209   - android:layout_marginLeft="10dp"
  225 + android:layout_marginLeft="35dp"
210 226 android:layout_marginTop="5dp"
211   - android:layout_marginRight="10dp"
  227 + android:layout_marginRight="35dp"
212 228 android:background="@color/line" />
213 229 <!--活动时间-->
214 230 <LinearLayout
... ... @@ -251,7 +267,7 @@
251 267 android:layout_width="wrap_content"
252 268 android:layout_height="match_parent"
253 269 android:layout_marginLeft="5dp"
254   - android:text="——"
  270 + android:text=""
255 271 android:textColor="@color/text_black"
256 272 android:textSize="15sp" />
257 273  
... ... @@ -268,9 +284,9 @@
268 284 <View
269 285 android:layout_width="match_parent"
270 286 android:layout_height="1dp"
271   - android:layout_marginLeft="10dp"
  287 + android:layout_marginLeft="35dp"
272 288 android:layout_marginTop="5dp"
273   - android:layout_marginRight="10dp"
  289 + android:layout_marginRight="35dp"
274 290 android:background="@color/line" />
275 291 <!--活动类型-->
276 292 <LinearLayout
... ... @@ -311,6 +327,15 @@
311 327 android:textStyle="bold" />
312 328  
313 329 </LinearLayout>
  330 +
  331 + <View
  332 + android:layout_width="match_parent"
  333 + android:layout_height="1dp"
  334 + android:layout_marginLeft="35dp"
  335 + android:layout_marginTop="5dp"
  336 + android:layout_marginRight="35dp"
  337 + android:layout_marginBottom="15dp"
  338 + android:background="@color/line" />
314 339 </LinearLayout>
315 340 <!---->
316 341 </LinearLayout>
... ...
moudle_pedometer/src/main/res/values/colors.xml
... ... @@ -20,6 +20,7 @@
20 20 <color name="black_50">#80000000</color>
21 21 <color name="black_20">#33000000</color>
22 22  
  23 +
23 24 <color name="white_50">#80FFFFFF</color>
24 25  
25 26 <color name="green">#23D026</color>
... ...