Commit befb001b80bac61bb74f1004c037615c91f9a91f
1 parent
b36c7ea5
1 优化绑定功能逻辑
Showing
9 changed files
with
41 additions
and
326 deletions
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollRunRaceDetailFragmentView.java
| @@ -194,6 +194,31 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen | @@ -194,6 +194,31 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen | ||
| 194 | return false; | 194 | return false; |
| 195 | } | 195 | } |
| 196 | }); | 196 | }); |
| 197 | + //开始绘制历史轨迹 | ||
| 198 | + long startTime = 0; | ||
| 199 | + if (!TextUtils.isEmpty(runRaceDetailInfo.getStartTime())) { | ||
| 200 | + startTime = Long.parseLong(runRaceDetailInfo.getStartTime()); | ||
| 201 | + } | ||
| 202 | + long endTime = 0; | ||
| 203 | + if (!TextUtils.isEmpty(runRaceDetailInfo.getEndTime())) { | ||
| 204 | + endTime = Long.parseLong(runRaceDetailInfo.getEndTime()); | ||
| 205 | + } | ||
| 206 | + String entityName = ""; | ||
| 207 | + if (!TextUtils.isEmpty(runRaceDetailInfo.getEntityName())) { | ||
| 208 | + entityName = runRaceDetailInfo.getEntityName(); | ||
| 209 | + } | ||
| 210 | + //开始查询历史轨迹 | ||
| 211 | + if (0 != startTime && 0 != endTime && !TextUtils.isEmpty(entityName)) { | ||
| 212 | + MyMapUtil.queryHistoryTrace(getContext(), mClient, entityName, startTime, endTime, new MyMapUtil.CallBack() { | ||
| 213 | + @Override | ||
| 214 | + public void success(List<LatLng> resultPoints) { | ||
| 215 | + if (null != resultPoints && resultPoints.size() > 1) { | ||
| 216 | + MyMapUtil.drawHistoryTrack(getContext(), baiduMap, resultPoints, SortType.asc, R.color.green_round, R.drawable.icon_start, R.drawable.icon_end); | ||
| 217 | + MyMapUtil.setMapAutoZoom(baiduMap, resultPoints, -1.5f); | ||
| 218 | + } | ||
| 219 | + } | ||
| 220 | + }); | ||
| 221 | + } | ||
| 197 | 222 | ||
| 198 | } | 223 | } |
| 199 | //设置活动地点 | 224 | //设置活动地点 |
| @@ -201,7 +226,7 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen | @@ -201,7 +226,7 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen | ||
| 201 | fragment.binding.includeStreet.tvAddress.setText(runRaceDetailInfo.getAddress()); | 226 | fragment.binding.includeStreet.tvAddress.setText(runRaceDetailInfo.getAddress()); |
| 202 | //设置活动距离 | 227 | //设置活动距离 |
| 203 | if (!TextUtils.isEmpty(runRaceDetailInfo.getMileage())) { | 228 | if (!TextUtils.isEmpty(runRaceDetailInfo.getMileage())) { |
| 204 | - fragment.binding.includeStreet.tvAddress.append("\t\t" + runRaceDetailInfo.getMileage()); | 229 | + fragment.binding.includeStreet.tvAddress.append("\t\t全长" + runRaceDetailInfo.getMileage() + "公里"); |
| 205 | } | 230 | } |
| 206 | } | 231 | } |
| 207 | 232 | ||
| @@ -244,7 +269,7 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen | @@ -244,7 +269,7 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen | ||
| 244 | @Override | 269 | @Override |
| 245 | public void onClick(View view) { | 270 | public void onClick(View view) { |
| 246 | if (null != runRaceDetailInfo) { | 271 | if (null != runRaceDetailInfo) { |
| 247 | - RaceNameListActivity.newInstance(fragment.getActivity(), CollCommonInfo.getStreetId(fragment.getActivity()),runRaceDetailInfo); | 272 | + RaceNameListActivity.newInstance(fragment.getActivity(), CollCommonInfo.getStreetId(fragment.getActivity()), runRaceDetailInfo); |
| 248 | 273 | ||
| 249 | // StartCollectTraceActivity.startActivity(fragment.getActivity(), runRaceDetailInfo); | 274 | // StartCollectTraceActivity.startActivity(fragment.getActivity(), runRaceDetailInfo); |
| 250 | } | 275 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollTraceListDetailFragmentView.java
| @@ -248,8 +248,10 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | @@ -248,8 +248,10 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener | ||
| 248 | if (null == baiduMap) { | 248 | if (null == baiduMap) { |
| 249 | return; | 249 | return; |
| 250 | } | 250 | } |
| 251 | - MyMapUtil.drawHistoryTrack(getContext(), baiduMap, resultPoints, SortType.asc, R.color.green_round, R.drawable.icon_start, R.drawable.icon_end); | ||
| 252 | - MyMapUtil.setMapAutoZoom(baiduMap, resultPoints, -1.5f); | 251 | + if (resultPoints.size() > 1) { |
| 252 | + MyMapUtil.drawHistoryTrack(getContext(), baiduMap, resultPoints, SortType.asc, R.color.green_round, R.drawable.icon_start, R.drawable.icon_end); | ||
| 253 | + MyMapUtil.setMapAutoZoom(baiduMap, resultPoints, -1.5f); | ||
| 254 | + } | ||
| 253 | } | 255 | } |
| 254 | } | 256 | } |
| 255 | }); | 257 | }); |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/RunningMapFragmentPresenter.java
| 1 | package com.cnlive.moudle.pedometer.frame.presenter; | 1 | package com.cnlive.moudle.pedometer.frame.presenter; |
| 2 | 2 | ||
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | -import android.graphics.Bitmap; | ||
| 5 | -import android.graphics.BitmapFactory; | ||
| 6 | import android.os.Handler; | 4 | import android.os.Handler; |
| 7 | import android.text.TextUtils; | 5 | import android.text.TextUtils; |
| 8 | import android.util.Log; | 6 | import android.util.Log; |
| 9 | import android.widget.Toast; | 7 | import android.widget.Toast; |
| 10 | 8 | ||
| 11 | -import com.baidu.mapapi.map.BitmapDescriptorFactory; | ||
| 12 | -import com.baidu.mapapi.map.MarkerOptions; | ||
| 13 | -import com.baidu.mapapi.map.Overlay; | ||
| 14 | -import com.baidu.mapapi.map.OverlayOptions; | ||
| 15 | import com.baidu.mapapi.model.LatLng; | 9 | import com.baidu.mapapi.model.LatLng; |
| 16 | -import com.baidu.mapapi.utils.DistanceUtil; | ||
| 17 | -import com.baidu.trace.api.entity.AddEntityResponse; | ||
| 18 | -import com.baidu.trace.api.entity.AroundSearchResponse; | ||
| 19 | -import com.baidu.trace.api.entity.BoundSearchResponse; | ||
| 20 | -import com.baidu.trace.api.entity.DeleteEntityResponse; | ||
| 21 | -import com.baidu.trace.api.entity.DistrictSearchResponse; | ||
| 22 | -import com.baidu.trace.api.entity.EntityInfo; | ||
| 23 | -import com.baidu.trace.api.entity.EntityListRequest; | ||
| 24 | -import com.baidu.trace.api.entity.EntityListResponse; | ||
| 25 | -import com.baidu.trace.api.entity.FilterCondition; | ||
| 26 | import com.baidu.trace.api.entity.LocRequest; | 10 | import com.baidu.trace.api.entity.LocRequest; |
| 27 | -import com.baidu.trace.api.entity.OnEntityListener; | ||
| 28 | -import com.baidu.trace.api.entity.PolygonSearchResponse; | ||
| 29 | -import com.baidu.trace.api.entity.SearchResponse; | ||
| 30 | -import com.baidu.trace.api.entity.SortBy; | ||
| 31 | -import com.baidu.trace.api.entity.UpdateEntityResponse; | ||
| 32 | import com.baidu.trace.api.fence.AddMonitoredPersonResponse; | 11 | import com.baidu.trace.api.fence.AddMonitoredPersonResponse; |
| 33 | import com.baidu.trace.api.fence.CreateFenceRequest; | 12 | import com.baidu.trace.api.fence.CreateFenceRequest; |
| 34 | import com.baidu.trace.api.fence.CreateFenceResponse; | 13 | import com.baidu.trace.api.fence.CreateFenceResponse; |
| 35 | -import com.baidu.trace.api.fence.DeleteFenceRequest; | ||
| 36 | import com.baidu.trace.api.fence.DeleteFenceResponse; | 14 | import com.baidu.trace.api.fence.DeleteFenceResponse; |
| 37 | import com.baidu.trace.api.fence.DeleteMonitoredPersonResponse; | 15 | import com.baidu.trace.api.fence.DeleteMonitoredPersonResponse; |
| 38 | -import com.baidu.trace.api.fence.FenceInfo; | ||
| 39 | import com.baidu.trace.api.fence.FenceListRequest; | 16 | import com.baidu.trace.api.fence.FenceListRequest; |
| 40 | import com.baidu.trace.api.fence.FenceListResponse; | 17 | import com.baidu.trace.api.fence.FenceListResponse; |
| 41 | import com.baidu.trace.api.fence.HistoryAlarmResponse; | 18 | import com.baidu.trace.api.fence.HistoryAlarmResponse; |
| @@ -48,31 +25,16 @@ import com.baidu.trace.api.fence.MonitoredStatusResponse; | @@ -48,31 +25,16 @@ import com.baidu.trace.api.fence.MonitoredStatusResponse; | ||
| 48 | import com.baidu.trace.api.fence.OnFenceListener; | 25 | import com.baidu.trace.api.fence.OnFenceListener; |
| 49 | import com.baidu.trace.api.fence.UpdateFenceResponse; | 26 | import com.baidu.trace.api.fence.UpdateFenceResponse; |
| 50 | import com.baidu.trace.api.track.DistanceRequest; | 27 | import com.baidu.trace.api.track.DistanceRequest; |
| 51 | -import com.baidu.trace.api.track.DistanceResponse; | ||
| 52 | import com.baidu.trace.api.track.HistoryTrackRequest; | 28 | import com.baidu.trace.api.track.HistoryTrackRequest; |
| 53 | -import com.baidu.trace.api.track.HistoryTrackResponse; | ||
| 54 | -import com.baidu.trace.api.track.LatestPointResponse; | ||
| 55 | -import com.baidu.trace.api.track.OnTrackListener; | ||
| 56 | -import com.baidu.trace.api.track.SupplementMode; | ||
| 57 | -import com.baidu.trace.api.track.TrackPoint; | ||
| 58 | import com.baidu.trace.model.CoordType; | 29 | import com.baidu.trace.model.CoordType; |
| 59 | -import com.baidu.trace.model.ProcessOption; | ||
| 60 | import com.baidu.trace.model.SortType; | 30 | import com.baidu.trace.model.SortType; |
| 61 | -import com.baidu.trace.model.StatusCodes; | ||
| 62 | -import com.baidu.trace.model.TraceLocation; | ||
| 63 | -import com.baidu.trace.model.TransportMode; | ||
| 64 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | 31 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| 65 | import com.cnlive.moudle.pedometer.frame.view.RunningMapFragmentView; | 32 | import com.cnlive.moudle.pedometer.frame.view.RunningMapFragmentView; |
| 66 | import com.cnlive.moudle.pedometer.model.Constant; | 33 | import com.cnlive.moudle.pedometer.model.Constant; |
| 67 | -import com.cnlive.moudle.pedometer.model.RoutePoint; | ||
| 68 | import com.cnlive.moudle.pedometer.service.StepService; | 34 | import com.cnlive.moudle.pedometer.service.StepService; |
| 69 | import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; | 35 | import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; |
| 70 | -import com.cnlive.moudle.pedometer.utils.BitmapUtil; | ||
| 71 | -import com.cnlive.moudle.pedometer.utils.CommonUtil; | ||
| 72 | import com.cnlive.moudle.pedometer.utils.GsonUtil; | 36 | import com.cnlive.moudle.pedometer.utils.GsonUtil; |
| 73 | -import com.cnlive.moudle.pedometer.utils.MapUtil; | ||
| 74 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; | 37 | import com.cnlive.moudle.pedometer.utils.MyMapUtil; |
| 75 | -import com.cnlive.moudle.pedometer.utils.StepUtil; | ||
| 76 | import com.cnlive.moudle.pedometer.utils.TimeUtil; | 38 | import com.cnlive.moudle.pedometer.utils.TimeUtil; |
| 77 | import com.example.moudle_pedometer.R; | 39 | import com.example.moudle_pedometer.R; |
| 78 | import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; | 40 | import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunRaceDetailFragmentView.java
| @@ -317,7 +317,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -317,7 +317,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 317 | } | 317 | } |
| 318 | }); | 318 | }); |
| 319 | /*************************设置相关页面数据***************************/ | 319 | /*************************设置相关页面数据***************************/ |
| 320 | - if (runRaceDetailInfo.getFenceId() != null) { | 320 | + if (runRaceDetailInfo.getFenceId() != null&&!TextUtils.isEmpty(runRaceDetailInfo.getFenceId())) { |
| 321 | //设置围栏ID | 321 | //设置围栏ID |
| 322 | CommonInfo.setFenceId(getContext(), Integer.parseInt(runRaceDetailInfo.getFenceId())); | 322 | CommonInfo.setFenceId(getContext(), Integer.parseInt(runRaceDetailInfo.getFenceId())); |
| 323 | } | 323 | } |
| @@ -419,7 +419,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -419,7 +419,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 419 | } | 419 | } |
| 420 | //设置用时 | 420 | //设置用时 |
| 421 | if (!TextUtils.isEmpty(runRaceDetailInfo.getEmployTime())) { | 421 | if (!TextUtils.isEmpty(runRaceDetailInfo.getEmployTime())) { |
| 422 | - fragment.binding.includePersonScore.tvEmployTime.setText(runRaceDetailInfo.getEmployTime()); | 422 | + fragment.binding.includePersonScore.tvEmployTime.setText(TimeUtil.stampToChronometer(Long.parseLong(runRaceDetailInfo.getEmployTime()))); |
| 423 | } | 423 | } |
| 424 | //设置配速 | 424 | //设置配速 |
| 425 | if (!TextUtils.isEmpty(runRaceDetailInfo.getPace())) { | 425 | if (!TextUtils.isEmpty(runRaceDetailInfo.getPace())) { |
| @@ -443,6 +443,10 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | @@ -443,6 +443,10 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 443 | if (!TextUtils.isEmpty(runRaceDetailInfo.getFirstName())) { | 443 | if (!TextUtils.isEmpty(runRaceDetailInfo.getFirstName())) { |
| 444 | fragment.binding.includeRank.tvKingNickName.setText(runRaceDetailInfo.getFirstName()); | 444 | fragment.binding.includeRank.tvKingNickName.setText(runRaceDetailInfo.getFirstName()); |
| 445 | } | 445 | } |
| 446 | + //第一名用时 | ||
| 447 | + if (!TextUtils.isEmpty(runRaceDetailInfo.getFirstEmployTime())){ | ||
| 448 | + fragment.binding.includeRank.tvFirstTime.setText(TimeUtil.stampToChronometer(Long.parseLong(runRaceDetailInfo.getFirstEmployTime()))); | ||
| 449 | + } | ||
| 446 | } else { | 450 | } else { |
| 447 | fragment.binding.includeRank.llRankRoot.setVisibility(View.GONE); | 451 | fragment.binding.includeRank.llRankRoot.setVisibility(View.GONE); |
| 448 | 452 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/MapUtil.java deleted
100644 → 0
| 1 | -package com.cnlive.moudle.pedometer.utils; | ||
| 2 | - | ||
| 3 | -import android.graphics.Color; | ||
| 4 | -import android.graphics.Point; | ||
| 5 | -import android.os.Bundle; | ||
| 6 | -import android.text.TextUtils; | ||
| 7 | - | ||
| 8 | -import com.baidu.mapapi.map.BaiduMap; | ||
| 9 | -import com.baidu.mapapi.map.BitmapDescriptor; | ||
| 10 | -import com.baidu.mapapi.map.MapStatus; | ||
| 11 | -import com.baidu.mapapi.map.MapStatusUpdate; | ||
| 12 | -import com.baidu.mapapi.map.MapStatusUpdateFactory; | ||
| 13 | -import com.baidu.mapapi.map.MapView; | ||
| 14 | -import com.baidu.mapapi.map.Marker; | ||
| 15 | -import com.baidu.mapapi.map.MarkerOptions; | ||
| 16 | -import com.baidu.mapapi.map.Overlay; | ||
| 17 | -import com.baidu.mapapi.map.OverlayOptions; | ||
| 18 | -import com.baidu.mapapi.map.PolylineOptions; | ||
| 19 | -import com.baidu.mapapi.model.LatLng; | ||
| 20 | -import com.baidu.mapapi.model.LatLngBounds; | ||
| 21 | -import com.baidu.mapapi.utils.CoordinateConverter; | ||
| 22 | -import com.baidu.trace.model.CoordType; | ||
| 23 | -import com.baidu.trace.model.SortType; | ||
| 24 | -import com.baidu.trace.model.TraceLocation; | ||
| 25 | - | ||
| 26 | -import java.util.List; | ||
| 27 | - | ||
| 28 | - | ||
| 29 | -/** | ||
| 30 | - * Created by baidu on 17/2/9. | ||
| 31 | - */ | ||
| 32 | - | ||
| 33 | -public class MapUtil { | ||
| 34 | - | ||
| 35 | - private static MapUtil INSTANCE = new MapUtil(); | ||
| 36 | - | ||
| 37 | - private MapStatus mapStatus = null; | ||
| 38 | - | ||
| 39 | - private Marker mMoveMarker = null; | ||
| 40 | - | ||
| 41 | - public MapView mapView = null; | ||
| 42 | - | ||
| 43 | - public BaiduMap baiduMap = null; | ||
| 44 | - | ||
| 45 | - public LatLng lastPoint = null; | ||
| 46 | - | ||
| 47 | - /** | ||
| 48 | - * 路线覆盖物 | ||
| 49 | - */ | ||
| 50 | - public Overlay polylineOverlay = null; | ||
| 51 | - | ||
| 52 | - private MapUtil() { | ||
| 53 | - } | ||
| 54 | - | ||
| 55 | - public static MapUtil getInstance() { | ||
| 56 | - return INSTANCE; | ||
| 57 | - } | ||
| 58 | - | ||
| 59 | - public void init(MapView view) { | ||
| 60 | - mapView = view; | ||
| 61 | - baiduMap = mapView.getMap(); | ||
| 62 | - mapView.showZoomControls(false); | ||
| 63 | - } | ||
| 64 | - | ||
| 65 | - public void onPause() { | ||
| 66 | - if (null != mapView) { | ||
| 67 | - mapView.onPause(); | ||
| 68 | - } | ||
| 69 | - } | ||
| 70 | - | ||
| 71 | - public void onResume() { | ||
| 72 | - if (null != mapView) { | ||
| 73 | - mapView.onResume(); | ||
| 74 | - } | ||
| 75 | - } | ||
| 76 | - | ||
| 77 | - public void clear() { | ||
| 78 | - lastPoint = null; | ||
| 79 | - if (null != mMoveMarker) { | ||
| 80 | - mMoveMarker.remove(); | ||
| 81 | - mMoveMarker = null; | ||
| 82 | - } | ||
| 83 | - if (null != polylineOverlay) { | ||
| 84 | - polylineOverlay.remove(); | ||
| 85 | - polylineOverlay = null; | ||
| 86 | - } | ||
| 87 | - if (null != baiduMap) { | ||
| 88 | - baiduMap.clear(); | ||
| 89 | - baiduMap = null; | ||
| 90 | - } | ||
| 91 | - mapStatus = null; | ||
| 92 | - if (null != mapView) { | ||
| 93 | - mapView.onDestroy(); | ||
| 94 | - mapView = null; | ||
| 95 | - } | ||
| 96 | - } | ||
| 97 | - | ||
| 98 | - /** | ||
| 99 | - * 将轨迹实时定位点转换为地图坐标 | ||
| 100 | - * | ||
| 101 | - * @param location | ||
| 102 | - * | ||
| 103 | - * @return | ||
| 104 | - */ | ||
| 105 | - public static LatLng convertTraceLocation2Map(TraceLocation location) { | ||
| 106 | - if (null == location) { | ||
| 107 | - return null; | ||
| 108 | - } | ||
| 109 | - double latitude = location.getLatitude(); | ||
| 110 | - double longitude = location.getLongitude(); | ||
| 111 | - if (Math.abs(latitude - 0.0) < 0.000001 && Math.abs(longitude - 0.0) < 0.000001) { | ||
| 112 | - return null; | ||
| 113 | - } | ||
| 114 | - LatLng currentLatLng = new LatLng(latitude, longitude); | ||
| 115 | - if (CoordType.wgs84 == location.getCoordType()) { | ||
| 116 | - LatLng sourceLatLng = currentLatLng; | ||
| 117 | - CoordinateConverter converter = new CoordinateConverter(); | ||
| 118 | - converter.from(CoordinateConverter.CoordType.GPS); | ||
| 119 | - converter.coord(sourceLatLng); | ||
| 120 | - currentLatLng = converter.convert(); | ||
| 121 | - } | ||
| 122 | - return currentLatLng; | ||
| 123 | - } | ||
| 124 | - | ||
| 125 | - /** | ||
| 126 | - * 将地图坐标转换轨迹坐标 | ||
| 127 | - * | ||
| 128 | - * @param latLng | ||
| 129 | - * | ||
| 130 | - * @return | ||
| 131 | - */ | ||
| 132 | - public static com.baidu.trace.model.LatLng convertMap2Trace(LatLng latLng) { | ||
| 133 | - return new com.baidu.trace.model.LatLng(latLng.latitude, latLng.longitude); | ||
| 134 | - } | ||
| 135 | - | ||
| 136 | - /** | ||
| 137 | - * 将轨迹坐标对象转换为地图坐标对象 | ||
| 138 | - * | ||
| 139 | - * @param traceLatLng | ||
| 140 | - * | ||
| 141 | - * @return | ||
| 142 | - */ | ||
| 143 | - public static LatLng convertTrace2Map(com.baidu.trace.model.LatLng traceLatLng) { | ||
| 144 | - return new LatLng(traceLatLng.latitude, traceLatLng.longitude); | ||
| 145 | - } | ||
| 146 | - | ||
| 147 | -// /** | ||
| 148 | -// * 设置地图中心:使用已有定位信息; | ||
| 149 | -// * | ||
| 150 | -// * @param trackApp | ||
| 151 | -// */ | ||
| 152 | -// public void setCenter(TrackApplication trackApp) { | ||
| 153 | -// if (!CommonUtil.isZeroPoint(CurrentLocation.latitude, CurrentLocation.longitude)) { | ||
| 154 | -// LatLng currentLatLng = new LatLng(CurrentLocation.latitude, CurrentLocation.longitude); | ||
| 155 | -// updateStatus(currentLatLng, false); | ||
| 156 | -// return; | ||
| 157 | -// } | ||
| 158 | -// String lastLocation = trackApp.trackConf.getString(Constants.LAST_LOCATION, null); | ||
| 159 | -// if (!TextUtils.isEmpty(lastLocation)) { | ||
| 160 | -// String[] locationInfo = lastLocation.split(";"); | ||
| 161 | -// if (!CommonUtil.isZeroPoint(Double.parseDouble(locationInfo[1]), | ||
| 162 | -// Double.parseDouble(locationInfo[2]))) { | ||
| 163 | -// LatLng currentLatLng = new LatLng(Double.parseDouble(locationInfo[1]), | ||
| 164 | -// Double.parseDouble(locationInfo[2])); | ||
| 165 | -// updateStatus(currentLatLng, false); | ||
| 166 | -// return; | ||
| 167 | -// } | ||
| 168 | -// } | ||
| 169 | -// } | ||
| 170 | - | ||
| 171 | -// public void updateStatus(LatLng currentPoint, boolean showMarker) { | ||
| 172 | -// if (null == baiduMap || null == currentPoint) { | ||
| 173 | -// return; | ||
| 174 | -// } | ||
| 175 | -// | ||
| 176 | -// if (null != baiduMap.getProjection()) { | ||
| 177 | -// Point screenPoint = baiduMap.getProjection().toScreenLocation(currentPoint); | ||
| 178 | -// // 点在屏幕上的坐标超过限制范围,则重新聚焦底图 | ||
| 179 | -// if (screenPoint.y < 200 || screenPoint.y > TrackApplication.screenHeight - 500 | ||
| 180 | -// || screenPoint.x < 200 || screenPoint.x > TrackApplication.screenWidth - 200 | ||
| 181 | -// || null == mapStatus) { | ||
| 182 | -// animateMapStatus(currentPoint, 15.0f); | ||
| 183 | -// } | ||
| 184 | -// } else if (null == mapStatus) { | ||
| 185 | -// // 第一次定位时,聚焦底图 | ||
| 186 | -// setMapStatus(currentPoint, 15.0f); | ||
| 187 | -// } | ||
| 188 | -// | ||
| 189 | -// if (showMarker) { | ||
| 190 | -// addMarker(currentPoint); | ||
| 191 | -// } | ||
| 192 | -// | ||
| 193 | -// } | ||
| 194 | - | ||
| 195 | - public Marker addOverlay(LatLng currentPoint, BitmapDescriptor icon, Bundle bundle) { | ||
| 196 | - OverlayOptions overlayOptions = new MarkerOptions().position(currentPoint) | ||
| 197 | - .icon(icon).zIndex(9).draggable(true); | ||
| 198 | - Marker marker = (Marker) baiduMap.addOverlay(overlayOptions); | ||
| 199 | - if (null != bundle) { | ||
| 200 | - marker.setExtraInfo(bundle); | ||
| 201 | - } | ||
| 202 | - return marker; | ||
| 203 | - } | ||
| 204 | - | ||
| 205 | - /** | ||
| 206 | - * 添加地图覆盖物 | ||
| 207 | - */ | ||
| 208 | -// public void addMarker(LatLng currentPoint) { | ||
| 209 | -// if (null == mMoveMarker) { | ||
| 210 | -// mMoveMarker = addOverlay(currentPoint, BitmapUtil.bmArrowPoint, null); | ||
| 211 | -// return; | ||
| 212 | -// } | ||
| 213 | -// | ||
| 214 | -// if (null != lastPoint) { | ||
| 215 | -// moveLooper(currentPoint); | ||
| 216 | -// } else { | ||
| 217 | -// lastPoint = currentPoint; | ||
| 218 | -// mMoveMarker.setPosition(currentPoint); | ||
| 219 | -// } | ||
| 220 | -// } | ||
| 221 | - | ||
| 222 | - /** | ||
| 223 | - * 移动逻辑 | ||
| 224 | - */ | ||
| 225 | - public void moveLooper(LatLng endPoint) { | ||
| 226 | - | ||
| 227 | - mMoveMarker.setPosition(lastPoint); | ||
| 228 | - mMoveMarker.setRotate((float) CommonUtil.getAngle(lastPoint, endPoint)); | ||
| 229 | - | ||
| 230 | - double slope = CommonUtil.getSlope(lastPoint, endPoint); | ||
| 231 | - // 是不是正向的标示(向上设为正向) | ||
| 232 | - boolean isReverse = (lastPoint.latitude > endPoint.latitude); | ||
| 233 | - double intercept = CommonUtil.getInterception(slope, lastPoint); | ||
| 234 | - double xMoveDistance = isReverse ? CommonUtil.getXMoveDistance(slope) : -1 * CommonUtil.getXMoveDistance(slope); | ||
| 235 | - | ||
| 236 | - for (double latitude = lastPoint.latitude; latitude > endPoint.latitude == isReverse; latitude = | ||
| 237 | - latitude - xMoveDistance) { | ||
| 238 | - LatLng latLng; | ||
| 239 | - if (slope != Double.MAX_VALUE) { | ||
| 240 | - latLng = new LatLng(latitude, (latitude - intercept) / slope); | ||
| 241 | - } else { | ||
| 242 | - latLng = new LatLng(latitude, lastPoint.longitude); | ||
| 243 | - } | ||
| 244 | - mMoveMarker.setPosition(latLng); | ||
| 245 | - } | ||
| 246 | - } | ||
| 247 | - | ||
| 248 | - | ||
| 249 | - public void animateMapStatus(List<LatLng> points) { | ||
| 250 | - if (null == points || points.isEmpty()) { | ||
| 251 | - return; | ||
| 252 | - } | ||
| 253 | - LatLngBounds.Builder builder = new LatLngBounds.Builder(); | ||
| 254 | - for (LatLng point : points) { | ||
| 255 | - builder.include(point); | ||
| 256 | - } | ||
| 257 | - MapStatusUpdate msUpdate = MapStatusUpdateFactory.newLatLngBounds(builder.build()); | ||
| 258 | - baiduMap.animateMapStatus(msUpdate); | ||
| 259 | - } | ||
| 260 | - | ||
| 261 | - public void animateMapStatus(LatLng point, float zoom) { | ||
| 262 | - MapStatus.Builder builder = new MapStatus.Builder(); | ||
| 263 | - mapStatus = builder.target(point).zoom(zoom).build(); | ||
| 264 | - baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(mapStatus)); | ||
| 265 | - } | ||
| 266 | - | ||
| 267 | - public void setMapStatus(LatLng point, float zoom) { | ||
| 268 | - MapStatus.Builder builder = new MapStatus.Builder(); | ||
| 269 | - mapStatus = builder.target(point).zoom(zoom).build(); | ||
| 270 | - baiduMap.setMapStatus(MapStatusUpdateFactory.newMapStatus(mapStatus)); | ||
| 271 | - } | ||
| 272 | - | ||
| 273 | - public void refresh() { | ||
| 274 | - LatLng mapCenter = baiduMap.getMapStatus().target; | ||
| 275 | - float mapZoom = baiduMap.getMapStatus().zoom - 1.0f; | ||
| 276 | - setMapStatus(mapCenter, mapZoom); | ||
| 277 | - } | ||
| 278 | - | ||
| 279 | -} | ||
| 280 | - |
moudle_pedometer/src/main/res/layout/fragment_collect_run_race_detail.xml
| @@ -59,7 +59,7 @@ | @@ -59,7 +59,7 @@ | ||
| 59 | android:id="@+id/dragView" | 59 | android:id="@+id/dragView" |
| 60 | android:layout_width="match_parent" | 60 | android:layout_width="match_parent" |
| 61 | android:layout_height="match_parent" | 61 | android:layout_height="match_parent" |
| 62 | - android:background="@drawable/shape_left_right_10dp_white_raduis_bg" | 62 | + android:background="@color/white" |
| 63 | android:clickable="false" | 63 | android:clickable="false" |
| 64 | android:focusable="false"> | 64 | android:focusable="false"> |
| 65 | 65 |
moudle_pedometer/src/main/res/layout/layout_collect_run_detail_street.xml
| @@ -76,6 +76,7 @@ | @@ -76,6 +76,7 @@ | ||
| 76 | android:layout_width="wrap_content" | 76 | android:layout_width="wrap_content" |
| 77 | android:layout_height="wrap_content" | 77 | android:layout_height="wrap_content" |
| 78 | android:layout_marginLeft="25dp" | 78 | android:layout_marginLeft="25dp" |
| 79 | + android:layout_marginRight="25dp" | ||
| 79 | android:text="--" | 80 | android:text="--" |
| 80 | android:textColor="@color/text_black" | 81 | android:textColor="@color/text_black" |
| 81 | android:textSize="15sp" /> | 82 | android:textSize="15sp" /> |
moudle_pedometer/src/main/res/layout/layout_run_detail_person_score.xml
| @@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
| 9 | <!--个人最佳成绩--> | 9 | <!--个人最佳成绩--> |
| 10 | <LinearLayout | 10 | <LinearLayout |
| 11 | android:layout_width="match_parent" | 11 | android:layout_width="match_parent" |
| 12 | - android:layout_height="200dp" | 12 | + android:layout_height="190dp" |
| 13 | android:background="@drawable/white_shadow_bg" | 13 | android:background="@drawable/white_shadow_bg" |
| 14 | android:orientation="vertical" | 14 | android:orientation="vertical" |
| 15 | android:paddingLeft="15dp" | 15 | android:paddingLeft="15dp" |
moudle_pedometer/src/main/res/layout/layout_run_detail_rank.xml
| @@ -102,6 +102,7 @@ | @@ -102,6 +102,7 @@ | ||
| 102 | 102 | ||
| 103 | 103 | ||
| 104 | <TextView | 104 | <TextView |
| 105 | + android:id="@+id/tv_first_time" | ||
| 105 | android:layout_width="wrap_content" | 106 | android:layout_width="wrap_content" |
| 106 | android:layout_height="wrap_content" | 107 | android:layout_height="wrap_content" |
| 107 | android:text="--" | 108 | android:text="--" |