Commit 3b0c1282d3b9b9080a66612ae7538012502d408e

Authored by 杨帅
1 parent 53bc7184

1.修改UI

moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunRaceDetailFragmentView.java
... ... @@ -103,7 +103,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
103 103  
104 104 private String startPoint = "首都师范大学南门";
105 105 private String endPoint = "首都师范大学篮球场";
106   - private String test = "[{\"latitude\":39.933889208848,\"latitudeE6\":3.9933889208848E7,\"longitude\":116.30900265517,\"longitudeE6\":1.1630900265517001E8},{\"latitude\":39.933868507347,\"latitudeE6\":3.9933868507347E7,\"longitude\":116.30865416508,\"longitudeE6\":1.1630865416508E8},{\"latitude\":39.934756505077,\"latitudeE6\":3.9934756505077E7,\"longitude\":116.30860516469,\"longitudeE6\":1.1630860516468999E8},{\"latitude\":39.934781620502,\"latitudeE6\":3.9934781620502E7,\"longitude\":116.30961013007,\"longitudeE6\":1.1630961013007E8},{\"latitude\":39.934881620374,\"latitudeE6\":3.9934881620374E7,\"longitude\":116.30960513008,\"longitudeE6\":1.1630960513008E8},{\"latitude\":39.934077623132,\"latitudeE6\":3.9934077623132E7,\"longitude\":116.30965812942,\"longitudeE6\":1.1630965812942E8},{\"latitude\":39.933972618463,\"latitudeE6\":3.9933972618463E7,\"longitude\":116.30962113087,\"longitudeE6\":1.1630962113087E8},{\"latitude\":39.933932608856,\"latitudeE6\":3.9933932608856E7,\"longitude\":116.30953913383,\"longitudeE6\":1.1630953913383E8},{\"latitude\":39.933903844942,\"latitudeE6\":3.9933903844942E7,\"longitude\":116.30918357649,\"longitudeE6\":1.1630918357649E8}]";
  106 + private String test = "[{\"latitude\":39.933889208848,\"latitudeE6\":3.9933889208848E7,\"longitude\":116.30900265517,\"longitudeE6\":1.1630900265517001E8},{\"latitude\":39.933868507347,\"latitudeE6\":3.9933868507347E7,\"longitude\":116.30865416508,\"longitudeE6\":1.1630865416508E8},{\"latitude\":39.934756505077,\"latitudeE6\":3.9934756505077E7,\"longitude\":116.30860516469,\"longitudeE6\":1.1630860516468999E8},{\"latitude\":39.934781620502,\"latitudeE6\":3.9934781620502E7,\"longitude\":116.30961013007,\"longitudeE6\":1.1630961013007E8},{\"latitude\":39.934881620374,\"latitudeE6\":3.9934881620374E7,\"longitude\":116.30960513008,\"longitudeE6\":1.1630960513008E8},{\"latitude\":39.934077623132,\"latitudeE6\":3.9934077623132E7,\"longitude\":116.30965812942,\"longitudeE6\":1.1630965812942E8},{\"latitude\":39.933972618463,\"latitudeE6\":3.9933972618463E7,\"longitude\":116.30962113087,\"longitudeE6\":1.1630962113087E8},{\"latitude\":39.933932608856,\"latitudeE6\":3.9933932608856E7,\"longitude\":116.30953913383,\"longitudeE6\":1.1630953913383E8}]";
107 107 private LinkedList<LatLng> importLatLngs;//关键点
108 108 private LatLng startLatLng = new LatLng(39.934733, 116.308646);//起始点
109 109 private List<LatLng> trackPoints;
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunningMapFragmentView.java
... ... @@ -240,7 +240,6 @@ public class RunningMapFragmentView implements MvpView, SensorEventListener {
240 240  
241 241 @Override
242 242 public void onReceiveLocation(BDLocation location) {
243   - Log.e(TAG, "onReceiveLocation: 状态" + location.getGpsAccuracyStatus());
244 243 // map view 销毁后不在处理新接收的位置
245 244 if (location == null || mMapView == null) {
246 245 return;
... ... @@ -319,7 +318,7 @@ public class RunningMapFragmentView implements MvpView, SensorEventListener {
319 318 return;
320 319 }
321 320 MapStatus.Builder builder = new MapStatus.Builder();
322   - //不是第一次定位
  321 + //不是第一次定位状态
323 322 if (!isFirstLoc) {
324 323 if (currentPoints.size() > 0) {
325 324 //进行判断
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RunningMapFragment.java
... ... @@ -50,7 +50,7 @@ public class RunningMapFragment extends QMUIFragment&lt;RunningMapFragmentView, Run
50 50 private static final String TAG = "RunningMapFragment";
51 51 private RunningMapBean runningMapBean;
52 52 private SensorManager mSensorManager;
53   - private String test = "[{\"latitude\":39.933889208848,\"latitudeE6\":3.9933889208848E7,\"longitude\":116.30900265517,\"longitudeE6\":1.1630900265517001E8},{\"latitude\":39.933868507347,\"latitudeE6\":3.9933868507347E7,\"longitude\":116.30865416508,\"longitudeE6\":1.1630865416508E8},{\"latitude\":39.934756505077,\"latitudeE6\":3.9934756505077E7,\"longitude\":116.30860516469,\"longitudeE6\":1.1630860516468999E8},{\"latitude\":39.934781620502,\"latitudeE6\":3.9934781620502E7,\"longitude\":116.30961013007,\"longitudeE6\":1.1630961013007E8},{\"latitude\":39.934881620374,\"latitudeE6\":3.9934881620374E7,\"longitude\":116.30960513008,\"longitudeE6\":1.1630960513008E8},{\"latitude\":39.934077623132,\"latitudeE6\":3.9934077623132E7,\"longitude\":116.30965812942,\"longitudeE6\":1.1630965812942E8},{\"latitude\":39.933972618463,\"latitudeE6\":3.9933972618463E7,\"longitude\":116.30962113087,\"longitudeE6\":1.1630962113087E8},{\"latitude\":39.933932608856,\"latitudeE6\":3.9933932608856E7,\"longitude\":116.30953913383,\"longitudeE6\":1.1630953913383E8},{\"latitude\":39.933903844942,\"latitudeE6\":3.9933903844942E7,\"longitude\":116.30918357649,\"longitudeE6\":1.1630918357649E8}]";
  53 + private String test = "[{\"latitude\":39.933889208848,\"latitudeE6\":3.9933889208848E7,\"longitude\":116.30900265517,\"longitudeE6\":1.1630900265517001E8},{\"latitude\":39.933868507347,\"latitudeE6\":3.9933868507347E7,\"longitude\":116.30865416508,\"longitudeE6\":1.1630865416508E8},{\"latitude\":39.934756505077,\"latitudeE6\":3.9934756505077E7,\"longitude\":116.30860516469,\"longitudeE6\":1.1630860516468999E8},{\"latitude\":39.934781620502,\"latitudeE6\":3.9934781620502E7,\"longitude\":116.30961013007,\"longitudeE6\":1.1630961013007E8},{\"latitude\":39.934881620374,\"latitudeE6\":3.9934881620374E7,\"longitude\":116.30960513008,\"longitudeE6\":1.1630960513008E8},{\"latitude\":39.934077623132,\"latitudeE6\":3.9934077623132E7,\"longitude\":116.30965812942,\"longitudeE6\":1.1630965812942E8},{\"latitude\":39.933972618463,\"latitudeE6\":3.9933972618463E7,\"longitude\":116.30962113087,\"longitudeE6\":1.1630962113087E8},{\"latitude\":39.933932608856,\"latitudeE6\":3.9933932608856E7,\"longitude\":116.30953913383,\"longitudeE6\":1.1630953913383E8}]";
54 54 //创建震动服务对象
55 55 private Vibrator mVibrator;
56 56 private TipDialog tipDialog;
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/MyMapUtil.java
... ... @@ -14,6 +14,7 @@ import com.baidu.mapapi.model.LatLng;
14 14 import com.baidu.mapapi.utils.DistanceUtil;
15 15 import com.baidu.trace.model.SortType;
16 16 import com.cnlive.moudle.pedometer.model.RoutePoint;
  17 +import com.example.moudle_pedometer.R;
17 18  
18 19 import java.util.ArrayList;
19 20 import java.util.List;
... ... @@ -96,17 +97,23 @@ public class MyMapUtil {
96 97 /**
97 98 * 绘制服务器传过来的轨迹
98 99 */
99   - public static Overlay drawServerLineTrack(Context context, BaiduMap baiduMap, List<LatLng> points, SortType sortType, int lineColor, int startIconRes, int endIconRes) {
  100 + public static List<Overlay> drawServerLineTrack(Context context, BaiduMap baiduMap, List<LatLng> points, SortType sortType, int lineColor, int startIconRes, int endIconRes) {
100 101 // 绘制新覆盖物前,清空之前的覆盖物
101 102 if (points == null || points.size() == 0) {
102 103 return null;
103 104 }
  105 + List<Overlay> resultOverlays = new ArrayList<>();
104 106 //只有一个点
105 107 if (points.size() == 1) {
106   - Bitmap pointBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), startIconRes), 10, 16);
107   - OverlayOptions startOptions = new MarkerOptions().position(points.get(0)).icon(BitmapDescriptorFactory.fromBitmap(pointBitmap));
108   -// .zIndex(9).draggable(true);
109   - return baiduMap.addOverlay(startOptions);
  108 + Bitmap pointBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), startIconRes), 24, 30);
  109 + OverlayOptions startOptions = null;
  110 + if (pointBitmap != null) {
  111 + startOptions = new MarkerOptions().position(points.get(0)).icon(BitmapDescriptorFactory.fromBitmap(pointBitmap));
  112 + if (startOptions != null) {
  113 + resultOverlays.add(baiduMap.addOverlay(startOptions));
  114 + }
  115 + return resultOverlays;
  116 + }
110 117 }
111 118  
112 119 LatLng startPoint;
... ... @@ -120,31 +127,73 @@ public class MyMapUtil {
120 127 }
121 128  
122 129 // 添加起点图标
123   - Bitmap startPointBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), startIconRes), 30, 36);
124   - OverlayOptions startOptions = new MarkerOptions()
125   - .position(startPoint)
126   - .icon(BitmapDescriptorFactory.fromBitmap(startPointBitmap))
127   - .perspective(false)
128   - .animateType(MarkerOptions.MarkerAnimateType.grow)
129   - ;
130   -// .zIndex(9).draggable(true);
  130 + Bitmap startPointBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), startIconRes), 24, 30);
  131 + OverlayOptions startOptions = null;
  132 + if (startPointBitmap != null) {
  133 + startOptions = new MarkerOptions()
  134 + .position(startPoint)
  135 + .icon(BitmapDescriptorFactory.fromBitmap(startPointBitmap))
  136 + .perspective(false)
  137 + .animateType(MarkerOptions.MarkerAnimateType.grow);
  138 + }
131 139 // 添加终点图标
132   - Bitmap endPointBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), endIconRes), 30, 36);
133   - OverlayOptions endOptions = new MarkerOptions()
134   - .position(endPoint)
135   - .icon(BitmapDescriptorFactory.fromBitmap(endPointBitmap))
136   - .perspective(false)
137   - .anchor(0.6f,0.96f)
138   - .animateType(MarkerOptions.MarkerAnimateType.grow);
139   -// .zIndex(9).draggable(true);
140   -
  140 + Bitmap endPointBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), endIconRes), 24, 30);
  141 + OverlayOptions endOptions = null;
  142 + if (endPointBitmap != null) {
  143 + endOptions = new MarkerOptions()
  144 + .position(endPoint)
  145 + .icon(BitmapDescriptorFactory.fromBitmap(endPointBitmap))
  146 + .perspective(false)
  147 + .anchor(0.6f, 0.96f)
  148 + .animateType(MarkerOptions.MarkerAnimateType.grow);
  149 + }
  150 + // 添加圆形范围
  151 + Bitmap startCircleBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), R.drawable.circle_point_raduis), 60, 60);
  152 + OverlayOptions startCircleOptions = null;
  153 + OverlayOptions endCircleOptions = null;
  154 + if (startCircleBitmap != null) {
  155 + startCircleOptions = new MarkerOptions()
  156 + .position(startPoint)
  157 + .icon(BitmapDescriptorFactory.fromBitmap(startCircleBitmap))
  158 + .perspective(false)
  159 + .anchor(0.5f, 0.6f)
  160 + .animateType(MarkerOptions.MarkerAnimateType.grow);
  161 +
  162 + endCircleOptions = new MarkerOptions()
  163 + .position(endPoint)
  164 + .icon(BitmapDescriptorFactory.fromBitmap(startCircleBitmap))
  165 + .perspective(false)
  166 + .anchor(0.5f, 0.6f)
  167 + .animateType(MarkerOptions.MarkerAnimateType.grow);
  168 + }
141 169 // 添加路线(轨迹)
142   - OverlayOptions polylineOptions = new PolylineOptions().width(10)
143   - .color(context.getResources().getColor(lineColor)).points(points);
  170 + OverlayOptions polylineOptions = null;
  171 + if (points != null && points.size() > 1) {
  172 + polylineOptions = new PolylineOptions().width(10)
  173 + .color(context.getResources().getColor(lineColor)).points(points);
  174 + }
  175 + if (endCircleOptions != null) {
  176 + resultOverlays.add(baiduMap.addOverlay(endCircleOptions));
  177 + }
  178 + if (startCircleOptions != null) {
  179 + resultOverlays.add(baiduMap.addOverlay(startCircleOptions));
  180 + }
  181 + if (startOptions != null) {
  182 + resultOverlays.add(baiduMap.addOverlay(startOptions));
144 183  
145   - baiduMap.addOverlay(startOptions);
146   - baiduMap.addOverlay(endOptions);
147   - return baiduMap.addOverlay(polylineOptions);
  184 + }
  185 + if (endOptions != null) {
  186 + resultOverlays.add(baiduMap.addOverlay(endOptions));
  187 + }
  188 + if (polylineOptions != null) {
  189 + resultOverlays.add(baiduMap.addOverlay(polylineOptions));
  190 +
  191 + }
  192 + if (resultOverlays != null) {
  193 + return resultOverlays;
  194 + } else {
  195 + return null;
  196 + }
148 197 }
149 198  
150 199  
... ...
moudle_pedometer/src/main/res/drawable-hdpi/circle_point_raduis.png 0 → 100644

2.73 KB

moudle_pedometer/src/main/res/drawable-xhdpi/circle_point_raduis.png 0 → 100644

3.11 KB

moudle_pedometer/src/main/res/drawable-xxhdpi/circle_point_raduis.png 0 → 100644

6.3 KB

moudle_pedometer/src/main/res/drawable/shape_circle_green_25.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 + <solid android:color="@color/green_25" />
  5 +</shape>
0 6 \ No newline at end of file
... ...
moudle_pedometer/src/main/res/layout/fragment_run_main.xml
... ... @@ -164,7 +164,7 @@
164 164 android:text="配速"
165 165 android:textColor="@color/text_gray99"
166 166 android:textSize="15sp"
167   - android:textStyle="bold" />
  167 + />
168 168 </LinearLayout>
169 169 <!--用时-->
170 170 <LinearLayout
... ... @@ -197,7 +197,7 @@
197 197 android:text="用时"
198 198 android:textColor="@color/text_gray99"
199 199 android:textSize="15sp"
200   - android:textStyle="bold" />
  200 + />
201 201 </LinearLayout>
202 202 <!--热量-->
203 203 <LinearLayout
... ... @@ -231,7 +231,7 @@
231 231 android:text="步"
232 232 android:textColor="@color/text_gray99"
233 233 android:textSize="15sp"
234   - android:textStyle="bold" />
  234 + />
235 235 </LinearLayout>
236 236 </LinearLayout>
237 237  
... ...
moudle_pedometer/src/main/res/layout/fragment_running_map.xml
... ... @@ -42,13 +42,13 @@
42 42 android:layout_width="wrap_content"
43 43 android:layout_height="wrap_content"
44 44 android:layout_gravity="top|right"
45   - android:layout_marginTop="20dp"
  45 + android:layout_marginTop="15dp"
46 46 android:layout_marginRight="10dp"
47 47 android:orientation="vertical">
48 48  
49 49 <LinearLayout
50   - android:layout_width="75dp"
51   - android:layout_height="30dp"
  50 + android:layout_width="80dp"
  51 + android:layout_height="35dp"
52 52 android:layout_gravity="right"
53 53 android:background="@drawable/gps_white_shadow"
54 54 android:gravity="center">
... ... @@ -72,14 +72,16 @@
72 72 <!---->
73 73 <TextView
74 74 android:id="@+id/tv_gps_pop_bg"
75   - android:layout_width="150dp"
76   - android:layout_height="40dp"
  75 + android:layout_width="wrap_content"
  76 + android:layout_height="45dp"
77 77 android:layout_marginTop="-5dp"
78 78 android:background="@drawable/gps_tip_bg"
79 79 android:gravity="center"
  80 + android:paddingLeft="15dp"
  81 + android:paddingRight="15dp"
80 82 android:textColor="@color/text_black"
81   - android:textSize="10sp"
82   - android:visibility="gone" />
  83 + android:textSize="12sp"
  84 + android:visibility="gone"/>
83 85 <!---->
84 86 </LinearLayout>
85 87  
... ...
moudle_pedometer/src/main/res/values/colors.xml
... ... @@ -24,6 +24,8 @@
24 24  
25 25 <color name="green">#23D026</color>
26 26 <color name="green_50">#8023D026</color>
  27 + <color name="green_25">#4023D41E</color>
  28 +
27 29  
28 30 <color name="red">#EF5544</color>
29 31 <color name="bg">#012648</color>
... ...