Commit 3917558f111daff7a98f1b711aa69c53315bc8be

Authored by 杨帅
1 parent 88aa7c12

1.对接运动赛事详情页接口

2.新增接口签名验证
Showing 24 changed files with 970 additions and 205 deletions
app/src/main/java/com/example/modulepedometer/MainActivity.java
... ... @@ -3,6 +3,8 @@ package com.example.modulepedometer;
3 3 import android.content.Intent;
4 4 import android.os.Bundle;
5 5 import android.support.v7.app.AppCompatActivity;
  6 +
  7 +import com.cnlive.moudle.collectionTrace.ui.activity.CollRunRaceDetailActivity;
6 8 import com.cnlive.moudle.pedometer.ui.activity.RunLineActivity;
7 9  
8 10  
... ... @@ -12,7 +14,8 @@ public class MainActivity extends AppCompatActivity {
12 14 protected void onCreate(Bundle savedInstanceState) {
13 15 super.onCreate(savedInstanceState);
14 16 setContentView(R.layout.activity_main);
15   - Intent intent = new Intent(this, RunLineActivity.class);
  17 +// Intent intent = new Intent(this, RunLineActivity.class);
  18 + Intent intent = new Intent(this, CollRunRaceDetailActivity.class);
16 19 startActivity(intent);
17 20 // ARouter.getInstance()
18 21 //// .build("/moudle_pedometer/InterestActivity")
... ...
moudle_pedometer/src/main/AndroidManifest.xml
... ... @@ -141,6 +141,9 @@
141 141 <activity
142 142 android:name="com.cnlive.moudle.collectionTrace.ui.activity.CollRunRaceDetailActivity"
143 143 android:process=":step" />
  144 + <activity
  145 + android:name="com.cnlive.moudle.collectionTrace.ui.activity.StartCollectTraceActivity"
  146 + android:process=":step" />
144 147 </application>
145 148  
146 149 </manifest>
147 150 \ No newline at end of file
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/presenter/CollRunRaceDetailFragmentPresenter.java
... ... @@ -25,13 +25,14 @@ import static com.cnlive.libs.base.logic.Config.STATE_LOAD;
25 25  
26 26 public class CollRunRaceDetailFragmentPresenter extends MvpBasePresenter<CollRunRaceDetailFragmentView> {
27 27  
28   - public void getRunRaceDetailInfo(Context context, String id, String userId) {
  28 + public void getRunRaceDetailInfo(Context context, String id, String userId,String state) {
29 29 //设置请求参数
30 30 Map<String, String> paramsMap = new HashMap<>();
31 31 //赛事id
32 32 paramsMap.put("id", id);
33 33 paramsMap.put("sid", userId);
34   -
  34 + //0-用户使用 1-运营使用
  35 + paramsMap.put("state", state);
35 36 // Logic.create(paramsMap)
36 37 // .action(new Logic.Action<Map<String, String>, BaseInfo<RunRaceDetailInfo>>() {
37 38 // @Override
... ... @@ -96,7 +97,7 @@ public class CollRunRaceDetailFragmentPresenter extends MvpBasePresenter&lt;CollRun
96 97 getView().showRetryView(code, new View.OnClickListener() {
97 98 @Override
98 99 public void onClick(View view) {
99   - getRunRaceDetailInfo(context, id, userId);
  100 + getRunRaceDetailInfo(context, id, userId,state);
100 101 }
101 102 });
102 103 }
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/presenter/StartTraceFragmentPresenter.java 0 → 100644
  1 +package com.cnlive.moudle.collectionTrace.frame.presenter;
  2 +
  3 +import com.cnlive.moudle.collectionTrace.frame.view.StartTraceFragmentView;
  4 +import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter;
  5 +
  6 +public class StartTraceFragmentPresenter extends MvpBasePresenter<StartTraceFragmentView> {
  7 +}
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollRunRaceDetailFragmentView.java
... ... @@ -45,6 +45,7 @@ import com.baidu.mapapi.search.route.WalkingRoutePlanOption;
45 45 import com.baidu.mapapi.search.route.WalkingRouteResult;
46 46 import com.baidu.mapapi.utils.DistanceUtil;
47 47 import com.baidu.trace.model.SortType;
  48 +import com.cnlive.moudle.collectionTrace.ui.activity.StartCollectTraceActivity;
48 49 import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunRaceDetailFragment;
49 50 import com.cnlive.moudle.pedometer.ui.activity.PedometerMainActivity;
50 51 import com.cnlive.moudle.pedometer.ui.activity.RaceRecordActivity;
... ... @@ -126,8 +127,8 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen
126 127 Log.e(TAG, "initView: 长度:" + runRaceDetailInfo.getLatLongitude().length());
127 128 trackPoints = GsonUtil.jsonToList(runRaceDetailInfo.getLatLongitude(), LatLng.class);
128 129 Log.e(TAG, "initView: trackPoints" + trackPoints.size());
129   - MyMapUtil.drawServerLineTrack(getContext(), baiduMap, trackPoints, SortType.asc, R.color.green_round, R.drawable.icon_start, R.drawable.icon_end);
130   - //自动计算地图缩放
  130 +// MyMapUtil.drawServerLineTrack(getContext(), baiduMap, trackPoints, SortType.asc, R.color.green_round, R.drawable.icon_start, R.drawable.icon_end);
  131 +// //自动计算地图缩放
131 132 MapStatus.Builder builder = new MapStatus.Builder();
132 133 builder.target(MyMapUtil.getCenterZoomPosition(trackPoints));
133 134 builder.zoom(MyMapUtil.getZoom(trackPoints));
... ... @@ -140,48 +141,11 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen
140 141 fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
141 142 //隐藏空视图
142 143 fragment.binding.emptyLayout.setVisibility(View.GONE);
143   - //显示立即报名按钮
144   - fragment.binding.includeStreet.rlStartBtn.setVisibility(View.VISIBLE);
145 144 //设置底部卡片第一次可滑动的位置
146 145 fragment.binding.slidingLayout.setAnchorPoint(0.6f);
147 146 fragment.binding.slidingLayout.addPanelSlideListener(new SlidingUpPanelLayout.PanelSlideListener() {
148 147 @Override
149 148 public void onPanelSlide(View panel, float slideOffset) {
150   - if (slideOffset >= 0 && slideOffset <= 1) {
151   - int leakWidth = (int) (ScreenUtil.dip2px(getContext(), 15) / 0.6);
152   - LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
153   - int current = (int) (leakWidth * slideOffset);
154   -// Log.e(TAG, "current: " + current + ",leakWidth:" + leakWidth + ",ScreenUtil:" + ScreenUtil.dip2px(getContext(), 15));
155   - if (slideOffset == 0) {
156   - layoutParams.setMargins(ScreenUtil.dip2px(getContext(), 15), 0, ScreenUtil.dip2px(getContext(), 15), 0);
157   - fragment.binding.includeStreet.llFirstPanelRoot.setLayoutParams(layoutParams);
158   - fragment.binding.includeStreet.llBottomPanel.setLayoutParams(layoutParams);
159   - }
160   - if (leakWidth - ScreenUtil.dip2px(getContext(), current) <= ScreenUtil.dip2px(getContext(), 15)) {
161   - if (leakWidth - ScreenUtil.dip2px(getContext(), current) >= 0) {
162   - layoutParams.setMargins(leakWidth - ScreenUtil.dip2px(getContext(), current), 0, leakWidth - ScreenUtil.dip2px(getContext(), current), 0);
163   - } else {
164   - layoutParams.setMargins(0, 0, 0, 0);
165   - }
166   -
167   - fragment.binding.includeStreet.llFirstPanelRoot.setLayoutParams(layoutParams);
168   - fragment.binding.includeStreet.llBottomPanel.setLayoutParams(layoutParams);
169   - }
170   -
171   - }
172   -
173   - if (slideOffset == 0) {
174   - //在初始位置
175   - if (fragment.binding.includeStreet.rlStartBtn.getVisibility() == View.GONE) {
176   - fragment.binding.includeStreet.rlStartBtn.setVisibility(View.VISIBLE);
177   - }
178   -
179   - } else {
180   - //用户进行滑动
181   - if (fragment.binding.includeStreet.rlStartBtn.getVisibility() == View.VISIBLE) {
182   - fragment.binding.includeStreet.rlStartBtn.setVisibility(View.GONE);
183   - }
184   - }
185 149 }
186 150  
187 151 @Override
... ... @@ -227,172 +191,34 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen
227 191 if (!TextUtils.isEmpty(TimeUtil.getStampToTime(runRaceDetailInfo.getEnd_time(), "yyyy-MM-dd"))) {
228 192 fragment.binding.includeStreet.tvActiveEndTime.setText(TimeUtil.getStampToTime(runRaceDetailInfo.getEnd_time(), "yyyy-MM-dd"));
229 193 }
230   - //设置参加人数
231   - fragment.binding.includeStreet.tvSignPerson.setText(runRaceDetailInfo.getSignupNum() + "");
232   - //设置报名完成的头像
233   - List<String> joinFaceIcon = runRaceDetailInfo.getFaceUrl();
234   - if (joinFaceIcon != null && joinFaceIcon.size() > 0) {
235   - fragment.binding.includeStreet.fiveJoinPerson.setVisibility(View.VISIBLE);
236   - //设置头像数据
237   - fragment.binding.includeStreet.fiveJoinPerson.initIconData(joinFaceIcon);
238   - } else {
239   - fragment.binding.includeStreet.fiveJoinPerson.setVisibility(View.INVISIBLE);
240   - }
241 194  
242   - //判断是否显示个人排行榜
243   - if (!TextUtils.isEmpty(runRaceDetailInfo.getUserMileage())) {
244   - //显示
245   - fragment.binding.includePersonScore.llPersonScoreRoot.setVisibility(View.VISIBLE);
246   - //设置个人行走距离
247   - if (!TextUtils.isEmpty(runRaceDetailInfo.getUserMileage())) {
248   - fragment.binding.includePersonScore.tvUserDistance.setText(runRaceDetailInfo.getUserMileage());
249   - }
250   - //设置行走步数
251   - if (!TextUtils.isEmpty(runRaceDetailInfo.getStep())) {
252   - fragment.binding.includePersonScore.tvStep.setText(runRaceDetailInfo.getStep());
253   - }
254   - //设置用时
255   - if (!TextUtils.isEmpty(runRaceDetailInfo.getEmployTime())) {
256   - fragment.binding.includePersonScore.tvEmployTime.setText(runRaceDetailInfo.getEmployTime());
257   - }
258   - //设置配速
259   - if (!TextUtils.isEmpty(runRaceDetailInfo.getPace())) {
260   - fragment.binding.includePersonScore.tvSpeed.setText(runRaceDetailInfo.getPace());
261   - }
262   - } else {
263   - //隐藏
264   - fragment.binding.includePersonScore.llPersonScoreRoot.setVisibility(View.GONE);
265   - }
266   - //设置是否显示排行榜
267   - if (!TextUtils.isEmpty(runRaceDetailInfo.getFirstFaceUrl())) {
268   - fragment.binding.includeRank.llRankRoot.setVisibility(View.VISIBLE);
269   - //设置第一名头像
270   - GlideApp.with(getContext()).load(runRaceDetailInfo.getFirstFaceUrl()).into(fragment.binding.includeRank.ivFirstPersonUrl);
271   - //设置排行榜头像
272   - List<String> finishFaceUrl = runRaceDetailInfo.getFinishFaceUrl();
273   - if (finishFaceUrl != null && finishFaceUrl.size() > 0) {
274   - fragment.binding.includeRank.fiveRankPerson.initIconData(finishFaceUrl);
275   - }
276   - //设置第一名昵称
277   - if (!TextUtils.isEmpty(runRaceDetailInfo.getFirstName())) {
278   - fragment.binding.includeRank.tvKingNickName.setText(runRaceDetailInfo.getFirstName());
279   - }
280   - } else {
281   - fragment.binding.includeRank.llRankRoot.setVisibility(View.GONE);
282 195  
283   - }
284 196 //设置路线介绍的图片
285 197 if (!TextUtils.isEmpty(runRaceDetailInfo.getRoadmap())) {
286 198 //设置路线图
287 199 GlideApp.with(getContext()).load(runRaceDetailInfo.getRoadmap()).into(fragment.binding.includeStreetIntroduce.ivRoadMao);
288 200  
289 201 }
290   - //开始按钮点击事件(未滑动)
291   - fragment.binding.includeStreet.rlStartBtn.setOnClickListener(new View.OnClickListener() {
292   - @Override
293   - public void onClick(View view) {
294   - if (fragment.getActivity() == null) {
295   - return;
296   - }
297   - //立即报名
298   - if ("0".equals(fragment.binding.includeStreet.rlStartBtn.getTag())) {
299   - fragment.binding.includeStreet.rlStartBtn.setTag("1");
300   - fragment.binding.includeStreet.tvRunNow.setText(getContext().getResources().getString(R.string.run_race_btn_start_now));
301   - fragment.binding.includeStreet.tvGoTip.setVisibility(View.VISIBLE);
302   -
303   - //设置滑动
304   - fragment.binding.rlScrollViewStartBtn.setTag("1");
305   - fragment.binding.tvRunNow.setText(getContext().getResources().getString(R.string.run_race_btn_start_now));
306   - fragment.binding.tvGoTip.setVisibility(View.VISIBLE);
307   - RegistrationInfoActivity.newInstance(fragment.getActivity(), 1001);
308   - } else {
309   - //计算当前位置与起点坐标距离
310   - if (firstLatLng != null && trackPoints != null && trackPoints.size() > 0) {
311   - double distance = DistanceUtil.getDistance(firstLatLng, trackPoints.get(0));
312   - if (distance < 20) {
313   - //开始运动
314   - fragment.binding.includeStreet.rlStartBtn.setTag("0");
315   - fragment.binding.includeStreet.tvRunNow.setText(getContext().getResources().getString(R.string.run_race_btn_sign_up));
316   - fragment.binding.includeStreet.tvGoTip.setVisibility(View.GONE);
317   - fragment.getActivity().startActivity(new Intent(getContext(), PedometerMainActivity.class));
318   - //设置滑动
319   - fragment.binding.rlScrollViewStartBtn.setTag("0");
320   - fragment.binding.tvRunNow.setText(getContext().getResources().getString(R.string.run_race_btn_sign_up));
321   - fragment.binding.tvGoTip.setVisibility(View.GONE);
322   - } else {
323   - TipDialog tipDialog = new TipDialog(getContext(), getContext().getResources().getString(R.string.run_race_far_tip), "我知道了", R.color.green_round, new TipDialog.DialogInterface() {
324   - @Override
325   - public void onClick(TipDialog dialog) {
326   - dialog.dismiss();
327   - }
328   - });
329   - tipDialog.show();
330   - tipDialog.setCancelable(false);
331   - tipDialog.setCanceledOnTouchOutside(false);
332   - }
333   - }
334   - }
335   - }
336   - });
337 202 //开始按钮点击事件(用户进行滑动滑动)
338 203 fragment.binding.rlScrollViewStartBtn.setOnClickListener(new View.OnClickListener() {
339 204 @Override
340 205 public void onClick(View view) {
341   - //立即报名
342   - if ("0".equals(fragment.binding.rlScrollViewStartBtn.getTag())) {
343   - fragment.binding.rlScrollViewStartBtn.setTag("1");
344   - fragment.binding.tvRunNow.setText("现在开始");
345   - fragment.binding.tvGoTip.setVisibility(View.VISIBLE);
346   - //设置未滑动
347   - fragment.binding.includeStreet.rlStartBtn.setTag("1");
348   - fragment.binding.includeStreet.tvRunNow.setText("现在开始");
349   - fragment.binding.includeStreet.tvGoTip.setVisibility(View.VISIBLE);
350   - RegistrationInfoActivity.newInstance(fragment.getActivity(), 1001);
351   - } else {
352   - //开始运动
353   - fragment.binding.rlScrollViewStartBtn.setTag("0");
354   - fragment.binding.tvRunNow.setText("立即报名");
355   - fragment.binding.tvGoTip.setVisibility(View.GONE);
356   - fragment.getActivity().startActivity(new Intent(getContext(), PedometerMainActivity.class));
357   - //设置未滑动
358   - fragment.binding.includeStreet.rlStartBtn.setTag("0");
359   - fragment.binding.includeStreet.tvRunNow.setText("立即报名");
360   - fragment.binding.includeStreet.tvGoTip.setVisibility(View.GONE);
361   - fragment.getActivity().startActivity(new Intent(getContext(), PedometerMainActivity.class));
362   -
363   - }
364 206 }
365 207 });
366   - //查看全部成绩点击事件
367   - fragment.binding.includePersonScore.checkAllCord.setOnClickListener(v -> {
368   - RaceRecordActivity.newInstance(fragment.getActivity(),runRaceDetailInfo.getTitle());
369   - });
370   -
371   - fragment.binding.includeStreet.fiveJoinPerson.setOnClickListener(v -> {
372   - TakePartActivity.newInstance(fragment.getActivity());
373   - });
374   - //返回按钮
375   - fragment.binding.ivBack.setOnClickListener(new View.OnClickListener() {
  208 + //添加轨迹按钮点击事件
  209 + fragment.binding.btnAddTrace.setOnClickListener(new View.OnClickListener() {
376 210 @Override
377 211 public void onClick(View view) {
378   - if (fragment.getActivity() == null) {
379   - return;
380   - }
381   - fragment.getActivity().finish();
  212 + StartCollectTraceActivity.startActivity(fragment.getActivity());
382 213 }
383 214 });
  215 +
  216 +
384 217 }
385 218  
386 219 public void initMap() {
387   - List<String> icons = new ArrayList<>();
388   - icons.add("http://yweb0.cnliveimg.com/images/headImg/2019/0505/1557039035723_small.jpg");
389   - icons.add("http://yweb0.cnliveimg.com/images/headImg/2019/0505/1557034319038_small.jpg");
390   - icons.add("http://yweb0.cnliveimg.com/images/headImg/2018/0902/1535858459612_small.jpg");
391   - icons.add("http://yweb0.cnliveimg.com/images/headImg/2019/0523/1558599016203_small.jpg");
392   - icons.add("http://yweb0.cnliveimg.com/images/headImg/2019/0505/1557039035723_small.jpg");
393 220 //隐藏底部滑动卡片
394 221 fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
395   - fragment.binding.includeStreet.fiveJoinPerson.initIconData(icons);
396 222 this.mMapView = fragment.binding.mapView;
397 223 if (baiduMap == null) {
398 224 baiduMap = mMapView.getMap();
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/StartTraceFragmentView.java 0 → 100644
  1 +package com.cnlive.moudle.collectionTrace.frame.view;
  2 +
  3 +import android.content.Context;
  4 +import android.graphics.Bitmap;
  5 +import android.graphics.BitmapFactory;
  6 +import android.hardware.Sensor;
  7 +import android.hardware.SensorEvent;
  8 +import android.hardware.SensorEventListener;
  9 +import android.hardware.SensorManager;
  10 +import android.text.TextUtils;
  11 +import android.view.View;
  12 +import android.widget.Toast;
  13 +
  14 +import com.baidu.location.BDAbstractLocationListener;
  15 +import com.baidu.location.BDLocation;
  16 +import com.baidu.location.LocationClient;
  17 +import com.baidu.location.LocationClientOption;
  18 +import com.baidu.mapapi.map.BaiduMap;
  19 +import com.baidu.mapapi.map.BitmapDescriptor;
  20 +import com.baidu.mapapi.map.BitmapDescriptorFactory;
  21 +import com.baidu.mapapi.map.MapStatus;
  22 +import com.baidu.mapapi.map.MapStatusUpdateFactory;
  23 +import com.baidu.mapapi.map.MapView;
  24 +import com.baidu.mapapi.map.MyLocationConfiguration;
  25 +import com.baidu.mapapi.map.MyLocationData;
  26 +import com.baidu.mapapi.map.UiSettings;
  27 +import com.baidu.mapapi.model.LatLng;
  28 +import com.baidu.mapapi.search.route.RoutePlanSearch;
  29 +import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunRaceDetailFragment;
  30 +import com.cnlive.moudle.collectionTrace.ui.fragment.StartTraceFragment;
  31 +import com.cnlive.moudle.pedometer.ui.widget.SelectDialog;
  32 +import com.cnlive.moudle.pedometer.ui.widget.TipDialog;
  33 +import com.cnlive.moudle.pedometer.utils.BitmapUtil;
  34 +import com.example.moudle_pedometer.R;
  35 +import com.hannesdorfmann.mosby3.mvp.MvpView;
  36 +
  37 +public class StartTraceFragmentView implements MvpView, SensorEventListener {
  38 + private StartTraceFragment fragment;
  39 + private BaiduMap baiduMap;
  40 + private MapView mMapView;
  41 + private UiSettings mUiSettings;
  42 + private MyLocationConfiguration.LocationMode mCurrentMode;//定位模式
  43 + private BitmapDescriptor mCurrentMarker;//定位图标
  44 + private static int accuracyCircleFillColor;
  45 + private static int accuracyCircleStrokeColor;
  46 + private static MyLocationData followMyLocation;
  47 + private LatLng firstLatLng;
  48 + private Double lastX = 0.0;
  49 + private int mCurrentDirection = 0;
  50 + private float mCurrentAccracy;
  51 + // 定位相关
  52 + private LocationClient mLocClient;
  53 + public MyLocationListenner myListener = new MyLocationListenner();
  54 + private final int DEFULT_ZOOM = 17;
  55 + boolean isFirstLoc = true; // 是否首次定位
  56 + private String currentAddress;
  57 + private SelectDialog selectDialog;
  58 + private boolean isShowFollowAddress = false;//是否显示跟随地址
  59 +
  60 + public StartTraceFragmentView(StartTraceFragment fragment) {
  61 + this.fragment = fragment;
  62 + }
  63 +
  64 + public Context getContext() {
  65 + return fragment == null ? null : fragment.getActivity();
  66 + }
  67 +
  68 + public void initView() {
  69 + if (getContext() == null) {
  70 + return;
  71 + }
  72 + if (selectDialog == null) {
  73 + selectDialog = new SelectDialog(getContext(), "确定将", "否", new SelectDialog.DialogInterface() {
  74 + @Override
  75 + public void onClick(SelectDialog dialog) {
  76 + dialog.dismiss();
  77 + isShowFollowAddress = false;
  78 + }
  79 + }, "是", new SelectDialog.DialogInterface() {
  80 + @Override
  81 + public void onClick(SelectDialog dialog) {
  82 + isShowFollowAddress = false;
  83 + }
  84 + });
  85 + selectDialog.setCancelable(false);
  86 + selectDialog.setCanceledOnTouchOutside(false);
  87 + }
  88 + //确定按钮点击
  89 + fragment.binding.btnIdentify.setOnClickListener(new View.OnClickListener() {
  90 + @Override
  91 + public void onClick(View view) {
  92 + isShowFollowAddress = true;
  93 + //获取当前地点
  94 + if (!TextUtils.isEmpty(currentAddress)) {
  95 + selectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设置开始地点?");
  96 + selectDialog.show();
  97 + } else {
  98 + Toast.makeText(getContext(), "正在获取当前地点信息,请稍后", Toast.LENGTH_SHORT).show();
  99 + }
  100 + }
  101 + });
  102 + }
  103 +
  104 + /**
  105 + * 初始化地图
  106 + */
  107 + public void initMap() {
  108 + this.mMapView = fragment.binding.mapView;
  109 + if (baiduMap == null) {
  110 + baiduMap = mMapView.getMap();
  111 + }
  112 + if (mUiSettings == null) {
  113 + mUiSettings = baiduMap.getUiSettings();
  114 + }
  115 + //设置定位模式, 默认为 LocationMode.NORMAL 普通态
  116 + mCurrentMode = MyLocationConfiguration.LocationMode.NORMAL;
  117 + // 设置定位图标修改为自定义marker
  118 + Bitmap pointBitmap = BitmapUtil.getBitmapFromDp(getContext(), BitmapFactory.decodeResource(getContext().getResources(), R.drawable.rt_ic_location), 50, 50);
  119 + mCurrentMarker = BitmapDescriptorFactory.fromBitmap(pointBitmap);
  120 + //设置定位蓝点精度圆圈的填充颜色为透明色
  121 + accuracyCircleFillColor = getContext().getResources().getColor(R.color.transparent);
  122 + //设置定位蓝点精度圆圈的边框颜色的为透明色
  123 + accuracyCircleStrokeColor = getContext().getResources().getColor(R.color.transparent);
  124 + MyLocationConfiguration locationConfiguration = new MyLocationConfiguration(mCurrentMode,
  125 + true, mCurrentMarker, accuracyCircleFillColor, accuracyCircleStrokeColor);
  126 + //设置样式
  127 + baiduMap.setMyLocationConfiguration(locationConfiguration);
  128 + //启动所有手势
  129 + mUiSettings.setAllGesturesEnabled(true);
  130 + //通过设置enable为true或false 选择是否显示缩放按钮
  131 + mMapView.showZoomControls(false);
  132 + mUiSettings.setEnlargeCenterWithDoubleClickEnable(true);
  133 + //隐藏自带的指南针,改用自定义指南针 杨帅
  134 + baiduMap.getUiSettings().setCompassEnabled(true);
  135 + //显示定位图层
  136 + baiduMap.setMyLocationEnabled(true);
  137 + // 定位初始化
  138 + mLocClient = new LocationClient(getContext());
  139 + mLocClient.registerLocationListener(myListener);
  140 + LocationClientOption option = new LocationClientOption();
  141 + option.setOpenGps(true); // 打开gps
  142 + option.setCoorType("gcj02"); // 设置坐标类型
  143 + //可选,默认false,设置是否开启Gps定位
  144 + option.setOpenGps(true);
  145 + //设置打开自动回调位置模式,该开关打开后,期间只要定位SDK检测到位置变化就会主动回调给开发者,该模式下开发者无需再关心定位间隔是多少,定位SDK本身发现位置变化就会及时回调给开发者
  146 + option.setOpenAutoNotifyMode();
  147 + //可选,默认高精度,设置定位模式,高精度,低功耗,仅设备
  148 + option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy);
  149 + //可选,设置是否需要地址信息,默认不需要
  150 + option.setIsNeedAddress(true);
  151 + //可选,设置是否需要地址描述
  152 + option.setIsNeedLocationDescribe(true);
  153 + //可选,设置是否需要设备方向结果
  154 + option.setNeedDeviceDirect(false);
  155 + //设置打开自动回调位置模式,该开关打开后,期间只要定位SDK检测到位置变化就会主动回调给开发者
  156 + option.setOpenAutoNotifyMode(3000, 1, LocationClientOption.LOC_SENSITIVITY_HIGHT);
  157 + mLocClient.setLocOption(option);
  158 + mLocClient.start();
  159 + //设置地图加载完毕监听
  160 + baiduMap.setOnMapLoadedCallback(new BaiduMap.OnMapLoadedCallback() {
  161 + @Override
  162 + public void onMapLoaded() {
  163 +//
  164 +
  165 + }
  166 + });
  167 + }
  168 +
  169 + public void onResume() {
  170 + if (mMapView != null) {
  171 + mMapView.onResume();
  172 + }
  173 + }
  174 +
  175 + public void onPause() {
  176 + if (mMapView != null) {
  177 + mMapView.onPause();
  178 + }
  179 + }
  180 +
  181 + public void onDestroy() {
  182 + if (mMapView != null) {
  183 + mMapView.onDestroy();
  184 + mMapView = null;
  185 + }
  186 + if (mLocClient != null) {
  187 + mLocClient.stop();
  188 + }
  189 + }
  190 +
  191 + @Override
  192 + public void onSensorChanged(SensorEvent sensorEvent) {
  193 + double x = sensorEvent.values[SensorManager.DATA_X];
  194 + if (Math.abs(x - lastX) > 1.0) {
  195 + mCurrentDirection = (int) x;
  196 + if (firstLatLng != null) {
  197 + followMyLocation = new MyLocationData.Builder()
  198 + .accuracy(mCurrentAccracy)
  199 + // 此处设置开发者获取到的方向信息,顺时针0-360
  200 + .direction(mCurrentDirection).latitude(firstLatLng.latitude)
  201 + .longitude(firstLatLng.longitude).build();
  202 + baiduMap.setMyLocationData(followMyLocation);
  203 + }
  204 + }
  205 + lastX = x;
  206 + }
  207 +
  208 + @Override
  209 + public void onAccuracyChanged(Sensor sensor, int i) {
  210 +
  211 + }
  212 +
  213 + /**
  214 + * //设置定位监听器,获取到用户当前位置 杨帅
  215 + * 定位SDK监听函数
  216 + */
  217 + public class MyLocationListenner extends BDAbstractLocationListener {
  218 +
  219 + @Override
  220 + public void onReceiveLocation(BDLocation location) {
  221 + // map view 销毁后不在处理新接收的位置
  222 + if (location == null || mMapView == null) {
  223 + return;
  224 + }
  225 + if (isFirstLoc) {
  226 + isFirstLoc = false;
  227 + if (location.getRadius() > 20) {
  228 + Toast.makeText(getContext(), "当前定位精度为:" + location.getRadius() + "米,请您移动至空旷地带!", Toast.LENGTH_SHORT).show();
  229 + }
  230 + } else {
  231 + //过滤定位精度
  232 + if (location.getRadius() > 20) {
  233 + return;
  234 + }
  235 + }
  236 + followMyLocation = new MyLocationData.Builder()
  237 + .accuracy(location.getRadius())
  238 + // 此处设置开发者获取到的方向信息,顺时针0-360
  239 + .direction(location.getDirection()).latitude(location.getLatitude())
  240 + .longitude(location.getLongitude()).build();
  241 + currentAddress = location.getLocationDescribe();
  242 + if (selectDialog != null && selectDialog.isShowing()) {
  243 + selectDialog.setTipMessage(currentAddress);
  244 + }
  245 + if (isShowFollowAddress && selectDialog != null && !selectDialog.isShowing()) {
  246 + if (!TextUtils.isEmpty(currentAddress)) {
  247 + selectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设置开始地点?");
  248 + selectDialog.show();
  249 + }
  250 + }
  251 + if (followMyLocation == null || followMyLocation.latitude == 0 || followMyLocation.longitude == 0) {
  252 + return;
  253 + }
  254 +
  255 + MapStatus.Builder builder = new MapStatus.Builder();
  256 +
  257 +// if (isFirstLoc) {
  258 +// isFirstLoc = false;
  259 + firstLatLng = new LatLng(location.getLatitude(),
  260 + location.getLongitude());
  261 + baiduMap.setMyLocationData(followMyLocation);
  262 + builder.target(firstLatLng).zoom(DEFULT_ZOOM);
  263 + baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
  264 +
  265 + }
  266 + }
  267 +}
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/CollRunRaceDetailActivity.java
... ... @@ -7,6 +7,7 @@ import android.support.annotation.Nullable;
7 7 import com.alibaba.android.arouter.facade.annotation.Route;
8 8 import com.cnlive.libs.base.ui.QMUIFragment;
9 9 import com.cnlive.libs.base.ui.QMUIFragmentActivity;
  10 +import com.cnlive.libs.base.util.StatusBarUtil;
10 11 import com.cnlive.libs.base.util.StatusBarUtil2;
11 12 import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunRaceDetailFragment;
12 13 import com.cnlive.moudle.pedometer.commonInfo.CommonInfo;
... ... @@ -31,7 +32,8 @@ public class CollRunRaceDetailActivity extends QMUIFragmentActivity {
31 32 @Override
32 33 protected void onCreate(Bundle savedInstanceState) {
33 34 super.onCreate(savedInstanceState);
34   - StatusBarUtil2.setColor(this, getResources().getColor(R.color.run_main_bg), 0);
  35 + StatusBarUtil.setStatusBarWrite(this);
  36 + StatusBarUtil2.setColor(this, getResources().getColor(R.color.white), 0);
35 37 //判断用户是否结束运动
36 38 boolean isRunStep = CommonInfo.getIsRunStepService(this);
37 39 //没有找到相关记录
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/StartCollectTraceActivity.java 0 → 100644
  1 +package com.cnlive.moudle.collectionTrace.ui.activity;
  2 +
  3 +import android.app.Activity;
  4 +import android.content.Intent;
  5 +import android.os.Bundle;
  6 +
  7 +import com.cnlive.libs.base.ui.QMUIFragment;
  8 +import com.cnlive.libs.base.ui.QMUIFragmentActivity;
  9 +import com.cnlive.libs.base.util.StatusBarUtil;
  10 +import com.cnlive.libs.base.util.StatusBarUtil2;
  11 +import com.cnlive.moudle.collectionTrace.ui.fragment.StartTraceFragment;
  12 +import com.example.moudle_pedometer.R;
  13 +
  14 +public class StartCollectTraceActivity extends QMUIFragmentActivity {
  15 + @Override
  16 + protected int getContextViewId() {
  17 + return R.id.fragment_start_collect_trace;
  18 + }
  19 +
  20 + @Override
  21 + protected void onCreate(Bundle savedInstanceState) {
  22 + super.onCreate(savedInstanceState);
  23 + StatusBarUtil.setStatusBarWrite(this);
  24 + StatusBarUtil2.setColor(this, getResources().getColor(R.color.white), 0);
  25 + addFragment(new StartTraceFragment());
  26 + }
  27 +
  28 + private void addFragment(QMUIFragment fragment) {
  29 + getSupportFragmentManager().beginTransaction()
  30 + .add(getContextViewId(), fragment, fragment.getClass().getSimpleName())
  31 + .addToBackStack(fragment.getClass().getSimpleName())
  32 + .commit();
  33 + }
  34 +
  35 + public static void startActivity(Activity activity) {
  36 + Intent intent = new Intent(activity, StartCollectTraceActivity.class);
  37 + activity.startActivity(intent);
  38 + activity.finish();
  39 + }
  40 +}
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/fragment/CollRunRaceDetailFragment.java
1 1 package com.cnlive.moudle.collectionTrace.ui.fragment;
2 2  
  3 +import android.content.Intent;
3 4 import android.hardware.Sensor;
4 5 import android.hardware.SensorManager;
5 6 import android.os.Bundle;
6 7 import android.support.annotation.Nullable;
7 8 import android.view.View;
  9 +import android.widget.Button;
8 10  
9 11 import com.cnlive.libs.base.ui.QMUIFragment;
  12 +import com.cnlive.moudle.collectionTrace.frame.presenter.CollRunRaceDetailFragmentPresenter;
  13 +import com.cnlive.moudle.collectionTrace.frame.view.CollRunRaceDetailFragmentView;
10 14 import com.cnlive.moudle.pedometer.commonInfo.CommonInfo;
11 15 import com.cnlive.moudle.pedometer.frame.presenter.RunRaceDetailFragmentPresenter;
12 16 import com.cnlive.moudle.pedometer.frame.view.RunRaceDetailFragmentView;
  17 +import com.cnlive.moudle.pedometer.ui.activity.RunLineActivity;
13 18 import com.example.moudle_pedometer.R;
  19 +import com.example.moudle_pedometer.databinding.FragmentCollectRunRaceDetailBinding;
14 20 import com.example.moudle_pedometer.databinding.FragmentRunRaceDetailBinding;
  21 +import com.qmuiteam.qmui.widget.QMUITopBar;
15 22  
16 23 import static android.content.Context.SENSOR_SERVICE;
17 24  
... ... @@ -20,23 +27,37 @@ import static android.content.Context.SENSOR_SERVICE;
20 27 *
21 28 * @author ShinnyYang
22 29 */
23   -public class CollRunRaceDetailFragment extends QMUIFragment<RunRaceDetailFragmentView, RunRaceDetailFragmentPresenter, FragmentRunRaceDetailBinding> {
  30 +public class CollRunRaceDetailFragment extends QMUIFragment<CollRunRaceDetailFragmentView, CollRunRaceDetailFragmentPresenter, FragmentCollectRunRaceDetailBinding> {
24 31 private static final String TAG = "CollRunRaceDetailFragment";
25 32 private SensorManager mSensorManager;
26 33  
27 34 @Override
28 35 protected int getToolbarId() {
29   - return 0;
  36 + return R.id.topbar;
30 37 }
31 38  
32 39 @Override
33 40 public String getTitle() {
34   - return null;
  41 + return "赛事名称";
35 42 }
36 43  
37 44 @Override
38 45 protected int getLayoutId() {
39   - return R.layout.fragment_run_race_detail;
  46 + return R.layout.fragment_collect_run_race_detail;
  47 + }
  48 +
  49 + @Override
  50 + public void onSetupToolBar(QMUITopBar toolbar) {
  51 + super.onSetupToolBar(toolbar);
  52 + Button addTraceBtn = toolbar.addRightTextButton("轨迹列表", R.id.qmui_dialog_edit_right_icon);
  53 + addTraceBtn.setTextSize(13);
  54 + addTraceBtn.setOnClickListener(new View.OnClickListener() {
  55 + @Override
  56 + public void onClick(View view) {
  57 + //todo 自己测试用
  58 + getActivity().startActivity(new Intent(getActivity(), RunLineActivity.class));
  59 + }
  60 + });
40 61 }
41 62  
42 63 @Override
... ... @@ -45,10 +66,11 @@ public class CollRunRaceDetailFragment extends QMUIFragment&lt;RunRaceDetailFragmen
45 66  
46 67 mSensorManager = (SensorManager) getActivity().getSystemService(SENSOR_SERVICE);//获取传感器管理服务
47 68 if (getMvpView() != null) {
48   - getMvpView().initMap();;
  69 + getMvpView().initMap();
  70 + ;
49 71 }
50   - if (getPresenter()!=null){
51   - getPresenter().getRunRaceDetailInfo(getActivity(), CommonInfo.getStreetId(getActivity()),"10513196");
  72 + if (getPresenter() != null) {
  73 + getPresenter().getRunRaceDetailInfo(getActivity(), "116", "10513196", "1");
52 74 }
53 75  
54 76 }
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/fragment/StartTraceFragment.java 0 → 100644
  1 +package com.cnlive.moudle.collectionTrace.ui.fragment;
  2 +
  3 +import android.hardware.Sensor;
  4 +import android.hardware.SensorManager;
  5 +import android.os.Bundle;
  6 +import android.support.annotation.Nullable;
  7 +import android.view.View;
  8 +
  9 +import com.cnlive.libs.base.ui.QMUIFragment;
  10 +import com.cnlive.moudle.collectionTrace.frame.presenter.StartTraceFragmentPresenter;
  11 +import com.cnlive.moudle.collectionTrace.frame.view.StartTraceFragmentView;
  12 +import com.example.moudle_pedometer.R;
  13 +import com.example.moudle_pedometer.databinding.FragmentStartCollectTraceBinding;
  14 +
  15 +import static android.content.Context.SENSOR_SERVICE;
  16 +
  17 +public class StartTraceFragment extends QMUIFragment<StartTraceFragmentView, StartTraceFragmentPresenter, FragmentStartCollectTraceBinding> {
  18 + private SensorManager mSensorManager;
  19 +
  20 + @Override
  21 + protected int getToolbarId() {
  22 + return R.id.topbar;
  23 + }
  24 +
  25 + @Override
  26 + public String getTitle() {
  27 + return "路径工具";
  28 + }
  29 +
  30 + @Override
  31 + protected int getLayoutId() {
  32 + return R.layout.fragment_start_collect_trace;
  33 + }
  34 +
  35 + @Override
  36 + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
  37 + super.onViewCreated(view, savedInstanceState);
  38 + mSensorManager = (SensorManager) getActivity().getSystemService(SENSOR_SERVICE);//获取传感器管理服务
  39 +
  40 + if (getMvpView() != null) {
  41 + getMvpView().initMap();
  42 + getMvpView().initView();
  43 + }
  44 + }
  45 +
  46 + @Override
  47 + public void onResume() {
  48 + super.onResume();
  49 + if (getMvpView() != null) {
  50 + getMvpView().onResume();
  51 + //为系统的方向传感器注册监听器
  52 + mSensorManager.registerListener(getMvpView(), mSensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION),
  53 + SensorManager.SENSOR_DELAY_UI);
  54 + }
  55 + }
  56 +
  57 + @Override
  58 + public void onPause() {
  59 + super.onPause();
  60 + if (getMvpView() != null) {
  61 + getMvpView().onPause();
  62 + }
  63 + }
  64 +
  65 + @Override
  66 + public void onDestroy() {
  67 + super.onDestroy();
  68 + if (getMvpView() != null) {
  69 + getMvpView().onDestroy();
  70 + }
  71 + }
  72 +}
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/RunRaceDetailFragmentPresenter.java
... ... @@ -30,13 +30,14 @@ import static com.cnlive.libs.base.logic.Config.STATE_LOAD;
30 30  
31 31 public class RunRaceDetailFragmentPresenter extends MvpBasePresenter<RunRaceDetailFragmentView> {
32 32  
33   - public void getRunRaceDetailInfo(Context context, String id, String userId) {
  33 + public void getRunRaceDetailInfo(Context context, String id, String userId, String state) {
34 34 //设置请求参数
35 35 Map<String, String> paramsMap = new HashMap<>();
36 36 //赛事id
37 37 paramsMap.put("id", id);
38 38 paramsMap.put("sid", userId);
39   -
  39 +// 0-用户使用 1-运营使用
  40 + paramsMap.put("state", state);
40 41 // Logic.create(paramsMap)
41 42 // .action(new Logic.Action<Map<String, String>, BaseInfo<RunRaceDetailInfo>>() {
42 43 // @Override
... ... @@ -101,7 +102,7 @@ public class RunRaceDetailFragmentPresenter extends MvpBasePresenter&lt;RunRaceDeta
101 102 getView().showRetryView(code, new View.OnClickListener() {
102 103 @Override
103 104 public void onClick(View view) {
104   - getRunRaceDetailInfo(context, id, userId);
  105 + getRunRaceDetailInfo(context, id, userId,state);
105 106 }
106 107 });
107 108 }
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/receivers/ServiceReceiver.java
... ... @@ -45,6 +45,9 @@ public class ServiceReceiver extends BroadcastReceiver {
45 45 } else {
46 46 context.startService(new Intent(context, StepService.class));
47 47 }
  48 + }else {
  49 + Log.e(TAG, "计步服务已经在运行");
  50 +
48 51 }
49 52 //判断百度鹰眼是否运行
50 53 boolean isRunBaiduTrace = CommonInfo.getIsRunBaiduTraceService(context);
... ... @@ -53,6 +56,9 @@ public class ServiceReceiver extends BroadcastReceiver {
53 56 if (StepService.mClient != null && StepService.mTrace != null && StepService.traceListener != null) {
54 57 StepService.mClient.startTrace(StepService.mTrace, StepService.traceListener);
55 58 }
  59 + }else {
  60 + Log.e(TAG, "鹰眼服务已经在运行");
  61 +
56 62 }
57 63 }
58 64 }
... ... @@ -66,6 +72,9 @@ public class ServiceReceiver extends BroadcastReceiver {
66 72 context.startService(new Intent(context, KeepLiveService.class));
67 73 }
68 74 Log.e(TAG, "启动KeepLiveService");
  75 + } else {
  76 + Log.e(TAG, "KeepLiveService已经在运行");
  77 +
69 78 }
70 79 String action = intent.getAction();
71 80 //锁屏
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/service/KeepLiveService.java
... ... @@ -148,7 +148,7 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion
148 148 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
149 149 startForegroundService(new Intent(getApplicationContext(), StepService.class));
150 150 } else {
151   - startService(new Intent(getApplicationContext(), StepService.class));
  151 + startService(new Intent(getApplicationContext(), StepService.class));
152 152 }
153 153 }
154 154 }
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/service/StepService.java
... ... @@ -47,6 +47,7 @@ import com.cnlive.moudle.pedometer.sql.db.DbCore;
47 47 import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity;
48 48 import com.cnlive.moudle.pedometer.ui.activity.PedometerMainActivity;
49 49 import com.cnlive.moudle.pedometer.utils.MySpHelper;
  50 +import com.cnlive.moudle.pedometer.utils.ServiceUtils;
50 51 import com.example.moudle_pedometer.R;
51 52  
52 53 import org.greenrobot.eventbus.EventBus;
... ... @@ -169,6 +170,14 @@ public class StepService extends Service implements SensorEventListener {
169 170 init();
170 171 showStartForegroundNotification();
171 172 initBroadcastReceiver();
  173 + CommonInfo.setIsRunKeepAliveService(getApplicationContext(), true);
  174 + if (!ServiceUtils.isServiceRunning(getApplicationContext(), "com.cnlive.moudle.pedometer.service.KeepLiveService")) {
  175 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
  176 + startForegroundService(new Intent(getApplicationContext(), KeepLiveService.class));
  177 + } else {
  178 + startService(new Intent(getApplicationContext(), KeepLiveService.class));
  179 + }
  180 + }
172 181 }
173 182  
174 183 private void initTrace() {
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RunRaceDetailFragment.java
... ... @@ -67,7 +67,7 @@ public class RunRaceDetailFragment extends QMUIFragment&lt;RunRaceDetailFragmentVie
67 67 }
68 68 if (getPresenter()!=null){
69 69 if (!TextUtils.isEmpty(CommonInfo.getStreetId(getActivity())))
70   - getPresenter().getRunRaceDetailInfo(getActivity(),CommonInfo.getStreetId(getActivity()),"10513196");
  70 + getPresenter().getRunRaceDetailInfo(getActivity(),CommonInfo.getStreetId(getActivity()),"10513196","0");
71 71 }
72 72  
73 73 }
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/widget/SelectDialog.java
... ... @@ -48,6 +48,10 @@ public class SelectDialog extends Dialog {
48 48  
49 49 }
50 50  
  51 + public void setTipMessage(String message) {
  52 + tv_dialog_tip.setText(message);
  53 + }
  54 +
51 55 public SelectDialog(@NonNull Context context, View customview, int themeResId) {
52 56 super(context, themeResId);
53 57 this.context = context;
... ...
moudle_pedometer/src/main/res/drawable/shape_30dp_green_raduis_btn_bg.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<shape xmlns:android="http://schemas.android.com/apk/res/android">
  3 + <solid android:color="@color/green_round" />
  4 + <corners android:radius="30dp" />
  5 +</shape>
0 6 \ No newline at end of file
... ...
moudle_pedometer/src/main/res/layout/dialog_select.xml
... ... @@ -11,16 +11,17 @@
11 11 android:layout_height="wrap_content"
12 12 android:background="@drawable/free_dialog_bg"
13 13 android:orientation="vertical"
14   - android:paddingTop="10dp"
15   - >
  14 + android:paddingTop="10dp">
16 15  
17 16 <TextView
18 17 android:id="@+id/tv_dialog_tip"
19 18 android:layout_width="wrap_content"
20 19 android:layout_height="wrap_content"
21   - android:minHeight="75dp"
22   - android:gravity="center"
23 20 android:layout_gravity="center"
  21 + android:layout_marginLeft="10dp"
  22 + android:layout_marginRight="10dp"
  23 + android:gravity="center"
  24 + android:minHeight="75dp"
24 25 android:text="标题"
25 26 android:textColor="@color/black"
26 27 android:textSize="17sp"
... ...
moudle_pedometer/src/main/res/layout/fragment_collect_run_race_detail.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<layout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + xmlns:app="http://schemas.android.com/apk/res-auto">
  4 +
  5 + <com.sothree.slidinguppanel.SlidingUpPanelLayout xmlns:sothree="http://schemas.android.com/apk/res-auto"
  6 + android:id="@+id/sliding_layout"
  7 + android:layout_width="match_parent"
  8 + android:layout_height="match_parent"
  9 + android:gravity="bottom"
  10 + sothree:umanoDragView="@+id/dragView"
  11 + sothree:umanoFadeColor="@color/black_20"
  12 + sothree:umanoOverlay="true"
  13 + sothree:umanoPanelHeight="141dp"
  14 + sothree:umanoParallaxOffset="250dp"
  15 + sothree:umanoScrollableView="@+id/scrollView"
  16 + sothree:umanoShadowHeight="0dp">
  17 +
  18 + <!-- MAIN CONTENT -->
  19 + <LinearLayout
  20 + android:layout_width="match_parent"
  21 + android:layout_height="match_parent"
  22 + android:orientation="vertical">
  23 +
  24 + <com.qmuiteam.qmui.widget.QMUITopBar
  25 + android:id="@+id/topbar"
  26 + android:layout_width="match_parent"
  27 + android:layout_height="?attr/qmui_topbar_height"
  28 + app:qmui_topbar_text_btn_color_state_list="@color/text_black" />
  29 +
  30 + <FrameLayout
  31 + android:id="@+id/fl_root"
  32 + android:layout_width="match_parent"
  33 + android:layout_height="match_parent">
  34 +
  35 + <com.baidu.mapapi.map.MapView
  36 + android:id="@+id/mapView"
  37 + android:layout_width="match_parent"
  38 + android:layout_height="match_parent"></com.baidu.mapapi.map.MapView>
  39 +
  40 + <!--地图上面加一层类似于全透明黑色蒙版-->
  41 + <LinearLayout
  42 + android:layout_width="match_parent"
  43 + android:layout_height="match_parent"
  44 + android:background="#0D000000"
  45 + android:clickable="false"
  46 + android:focusable="false"
  47 + android:focusableInTouchMode="false"></LinearLayout>
  48 +
  49 + <Button
  50 + android:id="@+id/btn_add_trace"
  51 + android:layout_width="wrap_content"
  52 + android:layout_height="wrap_content"
  53 + android:layout_gravity="center"
  54 + android:layout_marginBottom="100dp"
  55 + android:text="@string/layout_collect_bind_trace"
  56 + android:textSize="15sp" />
  57 + <!---->
  58 + <com.cnlive.strike.ui.widget.UIEmptyView
  59 + android:id="@+id/empty_layout"
  60 + android:layout_width="match_parent"
  61 + android:layout_height="match_parent"
  62 + android:background="@color/color_fff"
  63 + android:focusable="true"
  64 + android:focusableInTouchMode="true"
  65 + android:visibility="gone" />
  66 +
  67 + </FrameLayout>
  68 + </LinearLayout>
  69 + <!-- SLIDING LAYOUT -->
  70 + <FrameLayout
  71 + android:id="@+id/dragView"
  72 + android:layout_width="match_parent"
  73 + android:layout_height="match_parent"
  74 + android:clickable="false"
  75 + android:focusable="false">
  76 +
  77 + <ScrollView
  78 + android:id="@+id/scrollView"
  79 + android:layout_width="match_parent"
  80 + android:layout_height="match_parent"
  81 + android:scrollbars="none">
  82 +
  83 + <LinearLayout
  84 + android:id="@+id/ll_root"
  85 + android:layout_width="match_parent"
  86 + android:layout_height="wrap_content"
  87 + android:orientation="vertical">
  88 + <!--跑道-->
  89 + <include
  90 + android:id="@+id/include_street"
  91 + layout="@layout/layout_collect_run_detail_street" />
  92 + <!---->
  93 + <View
  94 + android:layout_width="match_parent"
  95 + android:layout_height="20dp"
  96 + android:background="#F4F4F4" />
  97 + <!--路线介绍-->
  98 + <include
  99 + android:id="@+id/include_street_introduce"
  100 + layout="@layout/layout_run_detail_street_introduce" />
  101 + </LinearLayout>
  102 +
  103 + </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 + </FrameLayout>
  126 + </com.sothree.slidinguppanel.SlidingUpPanelLayout>
  127 +
  128 +
  129 +</layout>
0 130 \ No newline at end of file
... ...
moudle_pedometer/src/main/res/layout/fragment_run_race_detail.xml
... ... @@ -49,15 +49,16 @@
49 49 android:layout_height="35dp"
50 50 android:layout_gravity="right"
51 51 android:layout_margin="10dp"
52   - android:background="@drawable/xqt_share" />
  52 + android:background="@drawable/xqt_share"
  53 + android:visibility="gone" />
53 54 <!---->
54 55 <com.cnlive.strike.ui.widget.UIEmptyView
55 56 android:id="@+id/empty_layout"
56 57 android:layout_width="match_parent"
57 58 android:layout_height="match_parent"
  59 + android:background="@color/color_fff"
58 60 android:focusable="true"
59 61 android:focusableInTouchMode="true"
60   - android:background="@color/color_fff"
61 62 android:visibility="gone" />
62 63  
63 64 </FrameLayout>
... ...
moudle_pedometer/src/main/res/layout/fragment_start_collect_trace.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<layout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + xmlns:app="http://schemas.android.com/apk/res-auto">
  4 +
  5 + <LinearLayout
  6 + android:layout_width="match_parent"
  7 + android:layout_height="match_parent"
  8 + android:orientation="vertical">
  9 +
  10 + <com.qmuiteam.qmui.widget.QMUITopBar
  11 + android:id="@+id/topbar"
  12 + android:layout_width="match_parent"
  13 + android:layout_height="?attr/qmui_topbar_height"
  14 + app:qmui_topbar_text_btn_color_state_list="@color/text_black" />
  15 +
  16 + <FrameLayout
  17 + android:layout_width="match_parent"
  18 + android:layout_height="match_parent">
  19 +
  20 + <com.baidu.mapapi.map.MapView
  21 + android:id="@+id/mapView"
  22 + android:layout_width="match_parent"
  23 + android:layout_height="match_parent"></com.baidu.mapapi.map.MapView>
  24 +
  25 + <Button
  26 + android:id="@+id/btn_identify"
  27 + android:layout_width="match_parent"
  28 + android:layout_height="40dp"
  29 + android:layout_gravity="bottom"
  30 + android:layout_marginLeft="10dp"
  31 + android:layout_marginRight="10dp"
  32 + android:layout_marginBottom="20dp"
  33 + android:background="@drawable/shape_30dp_green_raduis_btn_bg"
  34 + android:text="@string/identify_the_start_point"
  35 + android:textColor="@color/white"
  36 + android:textSize="15sp"
  37 + android:textStyle="bold" />
  38 + </FrameLayout>
  39 +
  40 + </LinearLayout>
  41 +</layout>
0 42 \ No newline at end of file
... ...
moudle_pedometer/src/main/res/layout/layout_collect_run_detail_street.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<layout xmlns:android="http://schemas.android.com/apk/res/android">
  3 +
  4 + <LinearLayout xmlns:FivePersonIconView="http://schemas.android.com/apk/res-auto"
  5 + android:layout_width="match_parent"
  6 + android:layout_height="wrap_content">
  7 +
  8 + <LinearLayout
  9 + android:id="@+id/ll_run_detail_street_root"
  10 + android:layout_width="match_parent"
  11 + android:layout_height="wrap_content"
  12 + android:orientation="vertical">
  13 +
  14 + <LinearLayout
  15 + android:id="@+id/ll_bottom_first_panel"
  16 + android:layout_width="match_parent"
  17 + android:layout_height="wrap_content"
  18 + android:background="@color/transparent"
  19 + android:orientation="vertical">
  20 +
  21 + <LinearLayout
  22 + android:id="@+id/ll_first_panel_root"
  23 + android:layout_width="match_parent"
  24 + android:layout_height="wrap_content"
  25 + android:background="@drawable/shape_left_right_10dp_white_raduis_bg"
  26 + android:orientation="vertical">
  27 + <!--活动标题-->
  28 + <TextView
  29 + android:id="@+id/tv_race_title"
  30 + android:layout_width="wrap_content"
  31 + android:layout_height="wrap_content"
  32 + android:layout_marginLeft="10dp"
  33 + android:layout_marginTop="10dp"
  34 + android:text="--"
  35 + android:textColor="@color/text_black"
  36 + android:textSize="18sp"
  37 + android:textStyle="bold" />
  38 + <!--活动地点-->
  39 + <LinearLayout
  40 + android:layout_width="match_parent"
  41 + android:layout_height="wrap_content"
  42 + android:layout_marginLeft="10dp"
  43 + android:layout_marginTop="10dp"
  44 + android:gravity="center_vertical">
  45 +
  46 + <ImageView
  47 + android:layout_width="14dp"
  48 + android:layout_height="16dp"
  49 + android:background="@drawable/sport_location" />
  50 +
  51 + <TextView
  52 + android:layout_width="wrap_content"
  53 + android:layout_height="wrap_content"
  54 + android:layout_marginLeft="5dp"
  55 + android:text="@string/layout_street_active_point"
  56 + android:textColor="@color/bottom_sheet_dialog_race_location_text"
  57 + android:textSize="14sp" />
  58 + </LinearLayout>
  59 + <!--活动地点详情-->
  60 + <LinearLayout
  61 + android:layout_width="match_parent"
  62 + android:layout_height="wrap_content"
  63 + android:layout_marginLeft="10dp"
  64 + android:layout_marginTop="10dp"
  65 + android:layout_marginBottom="10dp">
  66 +
  67 +
  68 + <TextView
  69 + android:id="@+id/tv_address"
  70 + android:layout_width="wrap_content"
  71 + android:layout_height="wrap_content"
  72 + android:layout_marginLeft="25dp"
  73 + android:text="--"
  74 + android:textColor="@color/text_black"
  75 + android:textSize="15sp" />
  76 +
  77 + </LinearLayout>
  78 + </LinearLayout>
  79 + </LinearLayout>
  80 + <!---->
  81 + <LinearLayout
  82 + android:id="@+id/ll_bottom_panel"
  83 + android:layout_width="match_parent"
  84 + android:layout_height="wrap_content"
  85 + android:background="@color/white"
  86 + android:orientation="vertical">
  87 + <!--起点-->
  88 + <LinearLayout
  89 + android:layout_width="match_parent"
  90 + android:layout_height="wrap_content"
  91 + android:layout_marginLeft="10dp"
  92 + android:gravity="center_vertical">
  93 +
  94 + <View
  95 + android:layout_width="10dp"
  96 + android:layout_height="10dp"
  97 + android:layout_marginLeft="25dp"
  98 + android:background="@drawable/shape_circle_green" />
  99 +
  100 + <TextView
  101 + android:layout_width="wrap_content"
  102 + android:layout_height="wrap_content"
  103 + android:layout_marginLeft="10dp"
  104 + android:text="@string/layout_street_start_point"
  105 + android:textColor="@color/bottom_sheet_dialog_race_location_text"
  106 + android:textSize="14sp" />
  107 +
  108 + <TextView
  109 + android:id="@+id/tv_start_addr"
  110 + android:layout_width="wrap_content"
  111 + android:layout_height="wrap_content"
  112 + android:layout_marginLeft="10dp"
  113 + android:text="--"
  114 + android:textColor="@color/text_black"
  115 + android:textSize="15sp" />
  116 + </LinearLayout>
  117 + <!--终点-->
  118 + <LinearLayout
  119 + android:id="@+id/ll_end_point"
  120 + android:layout_width="match_parent"
  121 + android:layout_height="wrap_content"
  122 + android:layout_marginLeft="10dp"
  123 + android:layout_marginTop="10dp"
  124 + android:gravity="center_vertical">
  125 +
  126 + <View
  127 + android:layout_width="10dp"
  128 + android:layout_height="10dp"
  129 + android:layout_marginLeft="25dp"
  130 + android:background="@drawable/shape_circle_red" />
  131 +
  132 + <TextView
  133 + android:layout_width="wrap_content"
  134 + android:layout_height="wrap_content"
  135 + android:layout_marginLeft="10dp"
  136 + android:text="@string/layout_street_end_point"
  137 + android:textColor="@color/bottom_sheet_dialog_race_location_text"
  138 + android:textSize="14sp" />
  139 +
  140 + <TextView
  141 + android:id="@+id/tv_end_addr"
  142 + android:layout_width="wrap_content"
  143 + android:layout_height="wrap_content"
  144 + android:layout_marginLeft="10dp"
  145 + android:text="--"
  146 + android:textColor="@color/text_black"
  147 + android:textSize="15sp" />
  148 + </LinearLayout>
  149 +
  150 +
  151 + <!--报名时间-->
  152 + <LinearLayout
  153 + android:layout_width="match_parent"
  154 + android:layout_height="wrap_content"
  155 + android:layout_marginLeft="10dp"
  156 + android:layout_marginTop="10dp"
  157 + android:gravity="center_vertical">
  158 +
  159 + <ImageView
  160 + android:layout_width="14dp"
  161 + android:layout_height="14dp"
  162 + android:background="@drawable/sport_time" />
  163 +
  164 + <TextView
  165 + android:layout_width="wrap_content"
  166 + android:layout_height="wrap_content"
  167 + android:layout_marginLeft="5dp"
  168 + android:text="@string/layout_street_sign_up_time"
  169 + android:textColor="@color/bottom_sheet_dialog_race_location_text"
  170 + android:textSize="14sp" />
  171 + </LinearLayout>
  172 + <!--时间-->
  173 + <LinearLayout
  174 + android:layout_width="match_parent"
  175 + android:layout_height="wrap_content"
  176 + android:layout_marginLeft="10dp"
  177 + android:layout_marginTop="10dp">
  178 +
  179 + <TextView
  180 + android:id="@+id/tv_sign_up_start_time"
  181 + android:layout_width="wrap_content"
  182 + android:layout_height="wrap_content"
  183 + android:layout_marginLeft="25dp"
  184 + android:text="--"
  185 + android:textColor="@color/text_black"
  186 + android:textSize="15sp" />
  187 +
  188 + <TextView
  189 + android:layout_width="wrap_content"
  190 + android:layout_height="match_parent"
  191 + android:layout_marginLeft="5dp"
  192 + android:text="——"
  193 + android:textColor="@color/text_black"
  194 + android:textSize="15sp" />
  195 +
  196 + <TextView
  197 + android:id="@+id/tv_sign_up_end_time"
  198 + android:layout_width="wrap_content"
  199 + android:layout_height="wrap_content"
  200 + android:layout_marginLeft="5dp"
  201 + android:text="--"
  202 + android:textColor="@color/text_black"
  203 + android:textSize="15sp" />
  204 + </LinearLayout>
  205 +
  206 + <View
  207 + android:layout_width="match_parent"
  208 + android:layout_height="1dp"
  209 + android:layout_marginLeft="10dp"
  210 + android:layout_marginTop="5dp"
  211 + android:layout_marginRight="10dp"
  212 + android:background="@color/line" />
  213 + <!--活动时间-->
  214 + <LinearLayout
  215 + android:layout_width="match_parent"
  216 + android:layout_height="wrap_content"
  217 + android:layout_marginLeft="10dp"
  218 + android:layout_marginTop="10dp"
  219 + android:gravity="center_vertical">
  220 +
  221 + <ImageView
  222 + android:layout_width="14dp"
  223 + android:layout_height="14dp"
  224 + android:background="@drawable/sport_time" />
  225 +
  226 + <TextView
  227 + android:layout_width="wrap_content"
  228 + android:layout_height="wrap_content"
  229 + android:layout_marginLeft="5dp"
  230 + android:text="@string/layout_street_active_time"
  231 + android:textColor="@color/bottom_sheet_dialog_race_location_text"
  232 + android:textSize="14sp" />
  233 + </LinearLayout>
  234 + <!--活动时间的具体日期-->
  235 + <LinearLayout
  236 + android:layout_width="match_parent"
  237 + android:layout_height="wrap_content"
  238 + android:layout_marginLeft="10dp"
  239 + android:layout_marginTop="10dp">
  240 +
  241 + <TextView
  242 + android:id="@+id/tv_active_start_time"
  243 + android:layout_width="wrap_content"
  244 + android:layout_height="wrap_content"
  245 + android:layout_marginLeft="25dp"
  246 + android:text="--"
  247 + android:textColor="@color/text_black"
  248 + android:textSize="15sp" />
  249 +
  250 + <TextView
  251 + android:layout_width="wrap_content"
  252 + android:layout_height="match_parent"
  253 + android:layout_marginLeft="5dp"
  254 + android:text="——"
  255 + android:textColor="@color/text_black"
  256 + android:textSize="15sp" />
  257 +
  258 + <TextView
  259 + android:id="@+id/tv_active_end_time"
  260 + android:layout_width="wrap_content"
  261 + android:layout_height="wrap_content"
  262 + android:layout_marginLeft="5dp"
  263 + android:text="--"
  264 + android:textColor="@color/text_black"
  265 + android:textSize="15sp" />
  266 + </LinearLayout>
  267 +
  268 + <View
  269 + android:layout_width="match_parent"
  270 + android:layout_height="1dp"
  271 + android:layout_marginLeft="10dp"
  272 + android:layout_marginTop="5dp"
  273 + android:layout_marginRight="10dp"
  274 + android:background="@color/line" />
  275 + <!--活动类型-->
  276 + <LinearLayout
  277 + android:layout_width="match_parent"
  278 + android:layout_height="wrap_content"
  279 + android:layout_marginLeft="10dp"
  280 + android:layout_marginTop="10dp"
  281 + android:gravity="center_vertical">
  282 +
  283 + <ImageView
  284 + android:layout_width="14dp"
  285 + android:layout_height="14dp"
  286 + android:background="@drawable/sport_type" />
  287 +
  288 + <TextView
  289 + android:layout_width="wrap_content"
  290 + android:layout_height="wrap_content"
  291 + android:layout_marginLeft="5dp"
  292 + android:text="@string/layout_street_active_type"
  293 + android:textColor="@color/bottom_sheet_dialog_race_location_text"
  294 + android:textSize="14sp" />
  295 + </LinearLayout>
  296 + <!--类型-->
  297 + <LinearLayout
  298 + android:layout_width="match_parent"
  299 + android:layout_height="wrap_content"
  300 + android:layout_marginLeft="10dp"
  301 + android:layout_marginTop="10dp">
  302 +
  303 + <TextView
  304 + android:id="@+id/tv_event_type"
  305 + android:layout_width="wrap_content"
  306 + android:layout_height="wrap_content"
  307 + android:layout_marginLeft="25dp"
  308 + android:text="--"
  309 + android:textColor="@color/text_black"
  310 + android:textSize="15sp"
  311 + android:textStyle="bold" />
  312 +
  313 + </LinearLayout>
  314 + </LinearLayout>
  315 + <!---->
  316 + </LinearLayout>
  317 + </LinearLayout>
  318 +</layout>
0 319 \ No newline at end of file
... ...
moudle_pedometer/src/main/res/values/ids.xml
... ... @@ -6,5 +6,7 @@
6 6 <item name="fragment_back" type="id" />
7 7 <item name="fragment_more" type="id" />
8 8 <item name="fragment_finish_run_map" type="id" />
  9 + <!--路径工具-->
  10 + <item name="fragment_start_collect_trace" type="id" />
9 11  
10 12 </resources>
... ...
moudle_pedometer/src/main/res/values/strings.xml
... ... @@ -72,6 +72,8 @@
72 72 <!---->
73 73 <!--网络请求-->
74 74 <string name="retry">重试</string>
  75 + <string name="layout_collect_bind_trace">绑定轨迹</string>
  76 + <string name="identify_the_start_point">确认开始地点</string>
75 77  
76 78  
77 79 </resources>
... ...