Commit 850305f83c21e7a14a5493c3318b87eb63d13091

Authored by 韩亚云
2 parents 6b9d37b0 3917558f

页面修改3

Showing 27 changed files with 1373 additions and 233 deletions
app/src/main/java/com/example/modulepedometer/MainActivity.java
@@ -3,6 +3,8 @@ package com.example.modulepedometer; @@ -3,6 +3,8 @@ package com.example.modulepedometer;
3 import android.content.Intent; 3 import android.content.Intent;
4 import android.os.Bundle; 4 import android.os.Bundle;
5 import android.support.v7.app.AppCompatActivity; 5 import android.support.v7.app.AppCompatActivity;
  6 +
  7 +import com.cnlive.moudle.collectionTrace.ui.activity.CollRunRaceDetailActivity;
6 import com.cnlive.moudle.pedometer.ui.activity.RunLineActivity; 8 import com.cnlive.moudle.pedometer.ui.activity.RunLineActivity;
7 9
8 10
@@ -12,7 +14,8 @@ public class MainActivity extends AppCompatActivity { @@ -12,7 +14,8 @@ public class MainActivity extends AppCompatActivity {
12 protected void onCreate(Bundle savedInstanceState) { 14 protected void onCreate(Bundle savedInstanceState) {
13 super.onCreate(savedInstanceState); 15 super.onCreate(savedInstanceState);
14 setContentView(R.layout.activity_main); 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 startActivity(intent); 19 startActivity(intent);
17 // ARouter.getInstance() 20 // ARouter.getInstance()
18 //// .build("/moudle_pedometer/InterestActivity") 21 //// .build("/moudle_pedometer/InterestActivity")
moudle_pedometer/src/main/AndroidManifest.xml
@@ -61,10 +61,6 @@ @@ -61,10 +61,6 @@
61 <activity android:name="com.cnlive.moudle.pedometer.ui.activity.RegistrationInfoActivity" /> 61 <activity android:name="com.cnlive.moudle.pedometer.ui.activity.RegistrationInfoActivity" />
62 62
63 <service 63 <service
64 - android:name="com.baidu.location.f"  
65 - android:enabled="true"  
66 - android:process=":remote" />  
67 - <service  
68 android:name="com.cnlive.moudle.pedometer.service.StepService" 64 android:name="com.cnlive.moudle.pedometer.service.StepService"
69 android:enabled="true" 65 android:enabled="true"
70 android:exported="true" 66 android:exported="true"
@@ -98,6 +94,25 @@ @@ -98,6 +94,25 @@
98 </intent-filter> 94 </intent-filter>
99 </service> 95 </service>
100 96
  97 + <service
  98 + android:name="com.cnlive.moudle.pedometer.service.KeepLiveService"
  99 + android:enabled="true"
  100 + android:exported="true"
  101 + android:priority="1000"
  102 + android:process=":re" />
  103 +
  104 + <receiver
  105 + android:name="com.cnlive.moudle.pedometer.receivers.ServiceReceiver"
  106 + android:enabled="true"
  107 + android:exported="true">
  108 + <intent-filter android:priority="1000">
  109 + <action android:name="com.cnlive.strike.receiver.ServiceReceiver" />
  110 + <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
  111 + <action android:name="android.net.wifi.STATE_CHANGE" />
  112 + <action android:name="com.example.myservice.MyReceiver" />
  113 + </intent-filter>
  114 + </receiver>
  115 +
101 <activity 116 <activity
102 android:name="com.cnlive.moudle.pedometer.ui.activity.PedometerMainActivity" 117 android:name="com.cnlive.moudle.pedometer.ui.activity.PedometerMainActivity"
103 android:launchMode="singleTask" 118 android:launchMode="singleTask"
@@ -126,6 +141,9 @@ @@ -126,6 +141,9 @@
126 <activity 141 <activity
127 android:name="com.cnlive.moudle.collectionTrace.ui.activity.CollRunRaceDetailActivity" 142 android:name="com.cnlive.moudle.collectionTrace.ui.activity.CollRunRaceDetailActivity"
128 android:process=":step" /> 143 android:process=":step" />
  144 + <activity
  145 + android:name="com.cnlive.moudle.collectionTrace.ui.activity.StartCollectTraceActivity"
  146 + android:process=":step" />
129 </application> 147 </application>
130 148
131 </manifest> 149 </manifest>
132 \ No newline at end of file 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,13 +25,14 @@ import static com.cnlive.libs.base.logic.Config.STATE_LOAD;
25 25
26 public class CollRunRaceDetailFragmentPresenter extends MvpBasePresenter<CollRunRaceDetailFragmentView> { 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 Map<String, String> paramsMap = new HashMap<>(); 30 Map<String, String> paramsMap = new HashMap<>();
31 //赛事id 31 //赛事id
32 paramsMap.put("id", id); 32 paramsMap.put("id", id);
33 paramsMap.put("sid", userId); 33 paramsMap.put("sid", userId);
34 - 34 + //0-用户使用 1-运营使用
  35 + paramsMap.put("state", state);
35 // Logic.create(paramsMap) 36 // Logic.create(paramsMap)
36 // .action(new Logic.Action<Map<String, String>, BaseInfo<RunRaceDetailInfo>>() { 37 // .action(new Logic.Action<Map<String, String>, BaseInfo<RunRaceDetailInfo>>() {
37 // @Override 38 // @Override
@@ -96,7 +97,7 @@ public class CollRunRaceDetailFragmentPresenter extends MvpBasePresenter&lt;CollRun @@ -96,7 +97,7 @@ public class CollRunRaceDetailFragmentPresenter extends MvpBasePresenter&lt;CollRun
96 getView().showRetryView(code, new View.OnClickListener() { 97 getView().showRetryView(code, new View.OnClickListener() {
97 @Override 98 @Override
98 public void onClick(View view) { 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,6 +45,7 @@ import com.baidu.mapapi.search.route.WalkingRoutePlanOption;
45 import com.baidu.mapapi.search.route.WalkingRouteResult; 45 import com.baidu.mapapi.search.route.WalkingRouteResult;
46 import com.baidu.mapapi.utils.DistanceUtil; 46 import com.baidu.mapapi.utils.DistanceUtil;
47 import com.baidu.trace.model.SortType; 47 import com.baidu.trace.model.SortType;
  48 +import com.cnlive.moudle.collectionTrace.ui.activity.StartCollectTraceActivity;
48 import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunRaceDetailFragment; 49 import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunRaceDetailFragment;
49 import com.cnlive.moudle.pedometer.ui.activity.PedometerMainActivity; 50 import com.cnlive.moudle.pedometer.ui.activity.PedometerMainActivity;
50 import com.cnlive.moudle.pedometer.ui.activity.RaceRecordActivity; 51 import com.cnlive.moudle.pedometer.ui.activity.RaceRecordActivity;
@@ -126,8 +127,8 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen @@ -126,8 +127,8 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen
126 Log.e(TAG, "initView: 长度:" + runRaceDetailInfo.getLatLongitude().length()); 127 Log.e(TAG, "initView: 长度:" + runRaceDetailInfo.getLatLongitude().length());
127 trackPoints = GsonUtil.jsonToList(runRaceDetailInfo.getLatLongitude(), LatLng.class); 128 trackPoints = GsonUtil.jsonToList(runRaceDetailInfo.getLatLongitude(), LatLng.class);
128 Log.e(TAG, "initView: trackPoints" + trackPoints.size()); 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 MapStatus.Builder builder = new MapStatus.Builder(); 132 MapStatus.Builder builder = new MapStatus.Builder();
132 builder.target(MyMapUtil.getCenterZoomPosition(trackPoints)); 133 builder.target(MyMapUtil.getCenterZoomPosition(trackPoints));
133 builder.zoom(MyMapUtil.getZoom(trackPoints)); 134 builder.zoom(MyMapUtil.getZoom(trackPoints));
@@ -140,48 +141,11 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen @@ -140,48 +141,11 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen
140 fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED); 141 fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
141 //隐藏空视图 142 //隐藏空视图
142 fragment.binding.emptyLayout.setVisibility(View.GONE); 143 fragment.binding.emptyLayout.setVisibility(View.GONE);
143 - //显示立即报名按钮  
144 - fragment.binding.includeStreet.rlStartBtn.setVisibility(View.VISIBLE);  
145 //设置底部卡片第一次可滑动的位置 144 //设置底部卡片第一次可滑动的位置
146 fragment.binding.slidingLayout.setAnchorPoint(0.6f); 145 fragment.binding.slidingLayout.setAnchorPoint(0.6f);
147 fragment.binding.slidingLayout.addPanelSlideListener(new SlidingUpPanelLayout.PanelSlideListener() { 146 fragment.binding.slidingLayout.addPanelSlideListener(new SlidingUpPanelLayout.PanelSlideListener() {
148 @Override 147 @Override
149 public void onPanelSlide(View panel, float slideOffset) { 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 @Override 151 @Override
@@ -196,11 +160,12 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen @@ -196,11 +160,12 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen
196 //设置活动地点 160 //设置活动地点
197 if (!TextUtils.isEmpty(runRaceDetailInfo.getAddress())) { 161 if (!TextUtils.isEmpty(runRaceDetailInfo.getAddress())) {
198 fragment.binding.includeStreet.tvAddress.setText(runRaceDetailInfo.getAddress()); 162 fragment.binding.includeStreet.tvAddress.setText(runRaceDetailInfo.getAddress());
  163 + //设置活动距离
  164 + if (!TextUtils.isEmpty(runRaceDetailInfo.getMileage())) {
  165 + fragment.binding.includeStreet.tvAddress.append("\t\t" + runRaceDetailInfo.getMileage());
  166 + }
199 } 167 }
200 - //设置活动距离  
201 - if (!TextUtils.isEmpty(runRaceDetailInfo.getMileage())) {  
202 - fragment.binding.includeStreet.tvMileage.setText(runRaceDetailInfo.getMileage());  
203 - } 168 +
204 //设置起点 169 //设置起点
205 if (!TextUtils.isEmpty(runRaceDetailInfo.getStartLocation())) { 170 if (!TextUtils.isEmpty(runRaceDetailInfo.getStartLocation())) {
206 fragment.binding.includeStreet.tvStartAddr.setText(runRaceDetailInfo.getStartLocation()); 171 fragment.binding.includeStreet.tvStartAddr.setText(runRaceDetailInfo.getStartLocation());
@@ -226,172 +191,34 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen @@ -226,172 +191,34 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen
226 if (!TextUtils.isEmpty(TimeUtil.getStampToTime(runRaceDetailInfo.getEnd_time(), "yyyy-MM-dd"))) { 191 if (!TextUtils.isEmpty(TimeUtil.getStampToTime(runRaceDetailInfo.getEnd_time(), "yyyy-MM-dd"))) {
227 fragment.binding.includeStreet.tvActiveEndTime.setText(TimeUtil.getStampToTime(runRaceDetailInfo.getEnd_time(), "yyyy-MM-dd")); 192 fragment.binding.includeStreet.tvActiveEndTime.setText(TimeUtil.getStampToTime(runRaceDetailInfo.getEnd_time(), "yyyy-MM-dd"));
228 } 193 }
229 - //设置参加人数  
230 - fragment.binding.includeStreet.tvSignPerson.setText(runRaceDetailInfo.getSignupNum() + "");  
231 - //设置报名完成的头像  
232 - List<String> joinFaceIcon = runRaceDetailInfo.getFaceUrl();  
233 - if (joinFaceIcon != null && joinFaceIcon.size() > 0) {  
234 - fragment.binding.includeStreet.fiveJoinPerson.setVisibility(View.VISIBLE);  
235 - //设置头像数据  
236 - fragment.binding.includeStreet.fiveJoinPerson.initIconData(joinFaceIcon);  
237 - } else {  
238 - fragment.binding.includeStreet.fiveJoinPerson.setVisibility(View.INVISIBLE);  
239 - }  
240 194
241 - //判断是否显示个人排行榜  
242 - if (!TextUtils.isEmpty(runRaceDetailInfo.getUserMileage())) {  
243 - //显示  
244 - fragment.binding.includePersonScore.llPersonScoreRoot.setVisibility(View.VISIBLE);  
245 - //设置个人行走距离  
246 - if (!TextUtils.isEmpty(runRaceDetailInfo.getUserMileage())) {  
247 - fragment.binding.includePersonScore.tvUserDistance.setText(runRaceDetailInfo.getUserMileage());  
248 - }  
249 - //设置行走步数  
250 - if (!TextUtils.isEmpty(runRaceDetailInfo.getStep())) {  
251 - fragment.binding.includePersonScore.tvStep.setText(runRaceDetailInfo.getStep());  
252 - }  
253 - //设置用时  
254 - if (!TextUtils.isEmpty(runRaceDetailInfo.getEmployTime())) {  
255 - fragment.binding.includePersonScore.tvEmployTime.setText(runRaceDetailInfo.getEmployTime());  
256 - }  
257 - //设置配速  
258 - if (!TextUtils.isEmpty(runRaceDetailInfo.getPace())) {  
259 - fragment.binding.includePersonScore.tvSpeed.setText(runRaceDetailInfo.getPace());  
260 - }  
261 - } else {  
262 - //隐藏  
263 - fragment.binding.includePersonScore.llPersonScoreRoot.setVisibility(View.GONE);  
264 - }  
265 - //设置是否显示排行榜  
266 - if (!TextUtils.isEmpty(runRaceDetailInfo.getFirstFaceUrl())) {  
267 - fragment.binding.includeRank.llRankRoot.setVisibility(View.VISIBLE);  
268 - //设置第一名头像  
269 - GlideApp.with(getContext()).load(runRaceDetailInfo.getFirstFaceUrl()).into(fragment.binding.includeRank.ivFirstPersonUrl);  
270 - //设置排行榜头像  
271 - List<String> finishFaceUrl = runRaceDetailInfo.getFinishFaceUrl();  
272 - if (finishFaceUrl != null && finishFaceUrl.size() > 0) {  
273 - fragment.binding.includeRank.fiveRankPerson.initIconData(finishFaceUrl);  
274 - }  
275 - //设置第一名昵称  
276 - if (!TextUtils.isEmpty(runRaceDetailInfo.getFirstName())) {  
277 - fragment.binding.includeRank.tvKingNickName.setText(runRaceDetailInfo.getFirstName());  
278 - }  
279 - } else {  
280 - fragment.binding.includeRank.llRankRoot.setVisibility(View.GONE);  
281 195
282 - }  
283 //设置路线介绍的图片 196 //设置路线介绍的图片
284 if (!TextUtils.isEmpty(runRaceDetailInfo.getRoadmap())) { 197 if (!TextUtils.isEmpty(runRaceDetailInfo.getRoadmap())) {
285 //设置路线图 198 //设置路线图
286 GlideApp.with(getContext()).load(runRaceDetailInfo.getRoadmap()).into(fragment.binding.includeStreetIntroduce.ivRoadMao); 199 GlideApp.with(getContext()).load(runRaceDetailInfo.getRoadmap()).into(fragment.binding.includeStreetIntroduce.ivRoadMao);
287 200
288 } 201 }
289 - //开始按钮点击事件(未滑动)  
290 - fragment.binding.includeStreet.rlStartBtn.setOnClickListener(new View.OnClickListener() {  
291 - @Override  
292 - public void onClick(View view) {  
293 - if (fragment.getActivity() == null) {  
294 - return;  
295 - }  
296 - //立即报名  
297 - if ("0".equals(fragment.binding.includeStreet.rlStartBtn.getTag())) {  
298 - fragment.binding.includeStreet.rlStartBtn.setTag("1");  
299 - fragment.binding.includeStreet.tvRunNow.setText(getContext().getResources().getString(R.string.run_race_btn_start_now));  
300 - fragment.binding.includeStreet.tvGoTip.setVisibility(View.VISIBLE);  
301 -  
302 - //设置滑动  
303 - fragment.binding.rlScrollViewStartBtn.setTag("1");  
304 - fragment.binding.tvRunNow.setText(getContext().getResources().getString(R.string.run_race_btn_start_now));  
305 - fragment.binding.tvGoTip.setVisibility(View.VISIBLE);  
306 - RegistrationInfoActivity.newInstance(fragment.getActivity(), 1001);  
307 - } else {  
308 - //计算当前位置与起点坐标距离  
309 - if (firstLatLng != null && trackPoints != null && trackPoints.size() > 0) {  
310 - double distance = DistanceUtil.getDistance(firstLatLng, trackPoints.get(0));  
311 - if (distance < 20) {  
312 - //开始运动  
313 - fragment.binding.includeStreet.rlStartBtn.setTag("0");  
314 - fragment.binding.includeStreet.tvRunNow.setText(getContext().getResources().getString(R.string.run_race_btn_sign_up));  
315 - fragment.binding.includeStreet.tvGoTip.setVisibility(View.GONE);  
316 - fragment.getActivity().startActivity(new Intent(getContext(), PedometerMainActivity.class));  
317 - //设置滑动  
318 - fragment.binding.rlScrollViewStartBtn.setTag("0");  
319 - fragment.binding.tvRunNow.setText(getContext().getResources().getString(R.string.run_race_btn_sign_up));  
320 - fragment.binding.tvGoTip.setVisibility(View.GONE);  
321 - } else {  
322 - TipDialog tipDialog = new TipDialog(getContext(), getContext().getResources().getString(R.string.run_race_far_tip), "我知道了", R.color.green_round, new TipDialog.DialogInterface() {  
323 - @Override  
324 - public void onClick(TipDialog dialog) {  
325 - dialog.dismiss();  
326 - }  
327 - });  
328 - tipDialog.show();  
329 - tipDialog.setCancelable(false);  
330 - tipDialog.setCanceledOnTouchOutside(false);  
331 - }  
332 - }  
333 - }  
334 - }  
335 - });  
336 //开始按钮点击事件(用户进行滑动滑动) 202 //开始按钮点击事件(用户进行滑动滑动)
337 fragment.binding.rlScrollViewStartBtn.setOnClickListener(new View.OnClickListener() { 203 fragment.binding.rlScrollViewStartBtn.setOnClickListener(new View.OnClickListener() {
338 @Override 204 @Override
339 public void onClick(View view) { 205 public void onClick(View view) {
340 - //立即报名  
341 - if ("0".equals(fragment.binding.rlScrollViewStartBtn.getTag())) {  
342 - fragment.binding.rlScrollViewStartBtn.setTag("1");  
343 - fragment.binding.tvRunNow.setText("现在开始");  
344 - fragment.binding.tvGoTip.setVisibility(View.VISIBLE);  
345 - //设置未滑动  
346 - fragment.binding.includeStreet.rlStartBtn.setTag("1");  
347 - fragment.binding.includeStreet.tvRunNow.setText("现在开始");  
348 - fragment.binding.includeStreet.tvGoTip.setVisibility(View.VISIBLE);  
349 - RegistrationInfoActivity.newInstance(fragment.getActivity(), 1001);  
350 - } else {  
351 - //开始运动  
352 - fragment.binding.rlScrollViewStartBtn.setTag("0");  
353 - fragment.binding.tvRunNow.setText("立即报名");  
354 - fragment.binding.tvGoTip.setVisibility(View.GONE);  
355 - fragment.getActivity().startActivity(new Intent(getContext(), PedometerMainActivity.class));  
356 - //设置未滑动  
357 - fragment.binding.includeStreet.rlStartBtn.setTag("0");  
358 - fragment.binding.includeStreet.tvRunNow.setText("立即报名");  
359 - fragment.binding.includeStreet.tvGoTip.setVisibility(View.GONE);  
360 - fragment.getActivity().startActivity(new Intent(getContext(), PedometerMainActivity.class));  
361 -  
362 - }  
363 } 206 }
364 }); 207 });
365 - //查看全部成绩点击事件  
366 - fragment.binding.includePersonScore.checkAllCord.setOnClickListener(v -> {  
367 - RaceRecordActivity.newInstance(fragment.getActivity(),runRaceDetailInfo.getTitle());  
368 - });  
369 -  
370 - fragment.binding.includeStreet.fiveJoinPerson.setOnClickListener(v -> {  
371 - TakePartActivity.newInstance(fragment.getActivity());  
372 - });  
373 - //返回按钮  
374 - fragment.binding.ivBack.setOnClickListener(new View.OnClickListener() { 208 + //添加轨迹按钮点击事件
  209 + fragment.binding.btnAddTrace.setOnClickListener(new View.OnClickListener() {
375 @Override 210 @Override
376 public void onClick(View view) { 211 public void onClick(View view) {
377 - if (fragment.getActivity() == null) {  
378 - return;  
379 - }  
380 - fragment.getActivity().finish(); 212 + StartCollectTraceActivity.startActivity(fragment.getActivity());
381 } 213 }
382 }); 214 });
  215 +
  216 +
383 } 217 }
384 218
385 public void initMap() { 219 public void initMap() {
386 - List<String> icons = new ArrayList<>();  
387 - icons.add("http://yweb0.cnliveimg.com/images/headImg/2019/0505/1557039035723_small.jpg");  
388 - icons.add("http://yweb0.cnliveimg.com/images/headImg/2019/0505/1557034319038_small.jpg");  
389 - icons.add("http://yweb0.cnliveimg.com/images/headImg/2018/0902/1535858459612_small.jpg");  
390 - icons.add("http://yweb0.cnliveimg.com/images/headImg/2019/0523/1558599016203_small.jpg");  
391 - icons.add("http://yweb0.cnliveimg.com/images/headImg/2019/0505/1557039035723_small.jpg");  
392 //隐藏底部滑动卡片 220 //隐藏底部滑动卡片
393 fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN); 221 fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
394 - fragment.binding.includeStreet.fiveJoinPerson.initIconData(icons);  
395 this.mMapView = fragment.binding.mapView; 222 this.mMapView = fragment.binding.mapView;
396 if (baiduMap == null) { 223 if (baiduMap == null) {
397 baiduMap = mMapView.getMap(); 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,6 +7,7 @@ import android.support.annotation.Nullable;
7 import com.alibaba.android.arouter.facade.annotation.Route; 7 import com.alibaba.android.arouter.facade.annotation.Route;
8 import com.cnlive.libs.base.ui.QMUIFragment; 8 import com.cnlive.libs.base.ui.QMUIFragment;
9 import com.cnlive.libs.base.ui.QMUIFragmentActivity; 9 import com.cnlive.libs.base.ui.QMUIFragmentActivity;
  10 +import com.cnlive.libs.base.util.StatusBarUtil;
10 import com.cnlive.libs.base.util.StatusBarUtil2; 11 import com.cnlive.libs.base.util.StatusBarUtil2;
11 import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunRaceDetailFragment; 12 import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunRaceDetailFragment;
12 import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; 13 import com.cnlive.moudle.pedometer.commonInfo.CommonInfo;
@@ -31,7 +32,8 @@ public class CollRunRaceDetailActivity extends QMUIFragmentActivity { @@ -31,7 +32,8 @@ public class CollRunRaceDetailActivity extends QMUIFragmentActivity {
31 @Override 32 @Override
32 protected void onCreate(Bundle savedInstanceState) { 33 protected void onCreate(Bundle savedInstanceState) {
33 super.onCreate(savedInstanceState); 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 boolean isRunStep = CommonInfo.getIsRunStepService(this); 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 package com.cnlive.moudle.collectionTrace.ui.fragment; 1 package com.cnlive.moudle.collectionTrace.ui.fragment;
2 2
  3 +import android.content.Intent;
3 import android.hardware.Sensor; 4 import android.hardware.Sensor;
4 import android.hardware.SensorManager; 5 import android.hardware.SensorManager;
5 import android.os.Bundle; 6 import android.os.Bundle;
6 import android.support.annotation.Nullable; 7 import android.support.annotation.Nullable;
7 import android.view.View; 8 import android.view.View;
  9 +import android.widget.Button;
8 10
9 import com.cnlive.libs.base.ui.QMUIFragment; 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 import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; 14 import com.cnlive.moudle.pedometer.commonInfo.CommonInfo;
11 import com.cnlive.moudle.pedometer.frame.presenter.RunRaceDetailFragmentPresenter; 15 import com.cnlive.moudle.pedometer.frame.presenter.RunRaceDetailFragmentPresenter;
12 import com.cnlive.moudle.pedometer.frame.view.RunRaceDetailFragmentView; 16 import com.cnlive.moudle.pedometer.frame.view.RunRaceDetailFragmentView;
  17 +import com.cnlive.moudle.pedometer.ui.activity.RunLineActivity;
13 import com.example.moudle_pedometer.R; 18 import com.example.moudle_pedometer.R;
  19 +import com.example.moudle_pedometer.databinding.FragmentCollectRunRaceDetailBinding;
14 import com.example.moudle_pedometer.databinding.FragmentRunRaceDetailBinding; 20 import com.example.moudle_pedometer.databinding.FragmentRunRaceDetailBinding;
  21 +import com.qmuiteam.qmui.widget.QMUITopBar;
15 22
16 import static android.content.Context.SENSOR_SERVICE; 23 import static android.content.Context.SENSOR_SERVICE;
17 24
@@ -20,23 +27,37 @@ import static android.content.Context.SENSOR_SERVICE; @@ -20,23 +27,37 @@ import static android.content.Context.SENSOR_SERVICE;
20 * 27 *
21 * @author ShinnyYang 28 * @author ShinnyYang
22 */ 29 */
23 -public class CollRunRaceDetailFragment extends QMUIFragment<RunRaceDetailFragmentView, RunRaceDetailFragmentPresenter, FragmentRunRaceDetailBinding> { 30 +public class CollRunRaceDetailFragment extends QMUIFragment<CollRunRaceDetailFragmentView, CollRunRaceDetailFragmentPresenter, FragmentCollectRunRaceDetailBinding> {
24 private static final String TAG = "CollRunRaceDetailFragment"; 31 private static final String TAG = "CollRunRaceDetailFragment";
25 private SensorManager mSensorManager; 32 private SensorManager mSensorManager;
26 33
27 @Override 34 @Override
28 protected int getToolbarId() { 35 protected int getToolbarId() {
29 - return 0; 36 + return R.id.topbar;
30 } 37 }
31 38
32 @Override 39 @Override
33 public String getTitle() { 40 public String getTitle() {
34 - return null; 41 + return "赛事名称";
35 } 42 }
36 43
37 @Override 44 @Override
38 protected int getLayoutId() { 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 @Override 63 @Override
@@ -45,10 +66,11 @@ public class CollRunRaceDetailFragment extends QMUIFragment&lt;RunRaceDetailFragmen @@ -45,10 +66,11 @@ public class CollRunRaceDetailFragment extends QMUIFragment&lt;RunRaceDetailFragmen
45 66
46 mSensorManager = (SensorManager) getActivity().getSystemService(SENSOR_SERVICE);//获取传感器管理服务 67 mSensorManager = (SensorManager) getActivity().getSystemService(SENSOR_SERVICE);//获取传感器管理服务
47 if (getMvpView() != null) { 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/commonInfo/CommonInfo.java
@@ -70,6 +70,26 @@ public class CommonInfo { @@ -70,6 +70,26 @@ public class CommonInfo {
70 } 70 }
71 71
72 /** 72 /**
  73 + * 设置是否运行保活服务
  74 + *
  75 + * @param context
  76 + * @param isAllow
  77 + */
  78 + public static void setIsRunKeepAliveService(Context context, boolean isAllow) {
  79 + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).putBoolean("KeepAliveService", isAllow);
  80 +
  81 + }
  82 +
  83 + /**
  84 + * 获取是否运行保活服务
  85 + *
  86 + * @param context
  87 + */
  88 + public static boolean getIsRunKeepAliveService(Context context) {
  89 + return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getBoolean("KeepAliveService", false);
  90 + }
  91 +
  92 + /**
73 * 获取是否运行计步服务 93 * 获取是否运行计步服务
74 * 94 *
75 * @param context 95 * @param context
@@ -97,6 +117,25 @@ public class CommonInfo { @@ -97,6 +117,25 @@ public class CommonInfo {
97 return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getString("streetId", ""); 117 return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getString("streetId", "");
98 } 118 }
99 119
  120 + /**
  121 + * 设置是否运行鹰眼服务
  122 + *
  123 + * @param context
  124 + * @param isRun
  125 + */
  126 + public static void setTsRunBaiduTraceService(Context context, boolean isRun) {
  127 + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).putBoolean("RunBaiduTraceService", isRun);
  128 + }
  129 +
  130 + /**
  131 + * 获取是否运行鹰眼服务
  132 + *
  133 + * @param context
  134 + */
  135 + public static boolean getIsRunBaiduTraceService(Context context) {
  136 + return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getBoolean("RunBaiduTraceService", false);
  137 + }
  138 +
100 /*重置 139 /*重置
101 * @param context 140 * @param context
102 */ 141 */
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,13 +30,14 @@ import static com.cnlive.libs.base.logic.Config.STATE_LOAD;
30 30
31 public class RunRaceDetailFragmentPresenter extends MvpBasePresenter<RunRaceDetailFragmentView> { 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 Map<String, String> paramsMap = new HashMap<>(); 35 Map<String, String> paramsMap = new HashMap<>();
36 //赛事id 36 //赛事id
37 paramsMap.put("id", id); 37 paramsMap.put("id", id);
38 paramsMap.put("sid", userId); 38 paramsMap.put("sid", userId);
39 - 39 +// 0-用户使用 1-运营使用
  40 + paramsMap.put("state", state);
40 // Logic.create(paramsMap) 41 // Logic.create(paramsMap)
41 // .action(new Logic.Action<Map<String, String>, BaseInfo<RunRaceDetailInfo>>() { 42 // .action(new Logic.Action<Map<String, String>, BaseInfo<RunRaceDetailInfo>>() {
42 // @Override 43 // @Override
@@ -101,7 +102,7 @@ public class RunRaceDetailFragmentPresenter extends MvpBasePresenter&lt;RunRaceDeta @@ -101,7 +102,7 @@ public class RunRaceDetailFragmentPresenter extends MvpBasePresenter&lt;RunRaceDeta
101 getView().showRetryView(code, new View.OnClickListener() { 102 getView().showRetryView(code, new View.OnClickListener() {
102 @Override 103 @Override
103 public void onClick(View view) { 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/frame/view/RunRaceDetailFragmentView.java
@@ -205,11 +205,12 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { @@ -205,11 +205,12 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
205 //设置活动地点 205 //设置活动地点
206 if (!TextUtils.isEmpty(runRaceDetailInfo.getAddress())) { 206 if (!TextUtils.isEmpty(runRaceDetailInfo.getAddress())) {
207 fragment.binding.includeStreet.tvAddress.setText(runRaceDetailInfo.getAddress()); 207 fragment.binding.includeStreet.tvAddress.setText(runRaceDetailInfo.getAddress());
  208 + //设置活动距离
  209 + if (!TextUtils.isEmpty(runRaceDetailInfo.getMileage())) {
  210 + fragment.binding.includeStreet.tvAddress.append("\t\t"+runRaceDetailInfo.getMileage());
  211 + }
208 } 212 }
209 - //设置活动距离  
210 - if (!TextUtils.isEmpty(runRaceDetailInfo.getMileage())) {  
211 - fragment.binding.includeStreet.tvMileage.setText(runRaceDetailInfo.getMileage());  
212 - } 213 +
213 //设置起点 214 //设置起点
214 if (!TextUtils.isEmpty(runRaceDetailInfo.getStartLocation())) { 215 if (!TextUtils.isEmpty(runRaceDetailInfo.getStartLocation())) {
215 fragment.binding.includeStreet.tvStartAddr.setText(runRaceDetailInfo.getStartLocation()); 216 fragment.binding.includeStreet.tvStartAddr.setText(runRaceDetailInfo.getStartLocation());
@@ -255,6 +256,10 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { @@ -255,6 +256,10 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
255 if (!TextUtils.isEmpty(runRaceDetailInfo.getUserMileage())) { 256 if (!TextUtils.isEmpty(runRaceDetailInfo.getUserMileage())) {
256 //显示 257 //显示
257 fragment.binding.includePersonScore.llPersonScoreRoot.setVisibility(View.VISIBLE); 258 fragment.binding.includePersonScore.llPersonScoreRoot.setVisibility(View.VISIBLE);
  259 + //设置完成人数
  260 + if (!TextUtils.isEmpty(runRaceDetailInfo.getFinishNum())){
  261 + fragment.binding.includeRank.tvFinishPerson.setText(runRaceDetailInfo.getFinishNum());
  262 + }
258 //设置个人行走距离 263 //设置个人行走距离
259 if (!TextUtils.isEmpty(runRaceDetailInfo.getUserMileage())) { 264 if (!TextUtils.isEmpty(runRaceDetailInfo.getUserMileage())) {
260 fragment.binding.includePersonScore.tvUserDistance.setText(runRaceDetailInfo.getUserMileage()); 265 fragment.binding.includePersonScore.tvUserDistance.setText(runRaceDetailInfo.getUserMileage());
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/receivers/ServiceReceiver.java
@@ -8,6 +8,9 @@ import android.os.Build; @@ -8,6 +8,9 @@ import android.os.Build;
8 import android.os.PowerManager; 8 import android.os.PowerManager;
9 import android.util.Log; 9 import android.util.Log;
10 10
  11 +import com.cnlive.moudle.pedometer.commonInfo.CommonInfo;
  12 +import com.cnlive.moudle.pedometer.service.KeepLiveService;
  13 +import com.cnlive.moudle.pedometer.service.StepService;
11 import com.cnlive.moudle.pedometer.utils.MySpHelper; 14 import com.cnlive.moudle.pedometer.utils.MySpHelper;
12 import com.cnlive.moudle.pedometer.utils.ServiceUtils; 15 import com.cnlive.moudle.pedometer.utils.ServiceUtils;
13 16
@@ -34,17 +37,44 @@ public class ServiceReceiver extends BroadcastReceiver { @@ -34,17 +37,44 @@ public class ServiceReceiver extends BroadcastReceiver {
34 public void onReceive(Context context, Intent intent) { 37 public void onReceive(Context context, Intent intent) {
35 Log.e(TAG, "接收到广播:" + intent.getAction()); 38 Log.e(TAG, "接收到广播:" + intent.getAction());
36 //todo 这里判断要保活的服务 39 //todo 这里判断要保活的服务
37 -// UserService.getUid(context)  
38 - boolean isRun = MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getBoolean("keepService", false);  
39 - Log.e("isRun", "" + isRun);  
40 - if (isRun) { 40 + boolean isRunStepService = CommonInfo.getIsRunStepService(context);
  41 + if (isRunStepService) {
  42 + if (!ServiceUtils.isServiceRunning(context, "com.cnlive.moudle.pedometer.service.StepService")) {
  43 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
  44 + context.startForegroundService(new Intent(context, StepService.class));
  45 + } else {
  46 + context.startService(new Intent(context, StepService.class));
  47 + }
  48 + }else {
  49 + Log.e(TAG, "计步服务已经在运行");
  50 +
  51 + }
  52 + //判断百度鹰眼是否运行
  53 + boolean isRunBaiduTrace = CommonInfo.getIsRunBaiduTraceService(context);
  54 + if (isRunBaiduTrace) {
  55 + if (!ServiceUtils.isServiceRunning(context, "com.baidu.trace.LBSTraceService")) {
  56 + if (StepService.mClient != null && StepService.mTrace != null && StepService.traceListener != null) {
  57 + StepService.mClient.startTrace(StepService.mTrace, StepService.traceListener);
  58 + }
  59 + }else {
  60 + Log.e(TAG, "鹰眼服务已经在运行");
  61 +
  62 + }
  63 + }
  64 + }
  65 + //todo 保活
  66 + boolean isRunKeepAliveService = CommonInfo.getIsRunKeepAliveService(context);
  67 + if (isRunKeepAliveService) {
41 if (!ServiceUtils.isServiceRunning(context, "com.cnlive.moudle.pedometer.service.KeepLiveService")) { 68 if (!ServiceUtils.isServiceRunning(context, "com.cnlive.moudle.pedometer.service.KeepLiveService")) {
42 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { 69 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
43 -// context.startForegroundService(new Intent(context, KeepLiveService.class)); 70 + context.startForegroundService(new Intent(context, KeepLiveService.class));
44 } else { 71 } else {
45 -// context.startService(new Intent(context, KeepLiveService.class)); 72 + context.startService(new Intent(context, KeepLiveService.class));
46 } 73 }
47 Log.e(TAG, "启动KeepLiveService"); 74 Log.e(TAG, "启动KeepLiveService");
  75 + } else {
  76 + Log.e(TAG, "KeepLiveService已经在运行");
  77 +
48 } 78 }
49 String action = intent.getAction(); 79 String action = intent.getAction();
50 //锁屏 80 //锁屏
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/service/KeepLiveService.java 0 → 100644
  1 +package com.cnlive.moudle.pedometer.service;
  2 +
  3 +import android.annotation.SuppressLint;
  4 +import android.app.Notification;
  5 +import android.app.NotificationChannel;
  6 +import android.app.NotificationManager;
  7 +import android.app.Service;
  8 +import android.content.ComponentName;
  9 +import android.content.Context;
  10 +import android.content.Intent;
  11 +import android.content.IntentFilter;
  12 +import android.media.MediaPlayer;
  13 +import android.os.Build;
  14 +import android.os.Handler;
  15 +import android.os.IBinder;
  16 +import android.os.PowerManager;
  17 +import android.support.v4.app.NotificationCompat;
  18 +import android.util.Log;
  19 +
  20 +import com.cnlive.moudle.pedometer.commonInfo.CommonInfo;
  21 +import com.cnlive.moudle.pedometer.receivers.ServiceReceiver;
  22 +import com.cnlive.moudle.pedometer.utils.ServiceUtils;
  23 +import com.example.moudle_pedometer.R;
  24 +
  25 +
  26 +/**
  27 + * @author ShinnyYang
  28 + * 维持后台运行的服务
  29 + */
  30 +public class KeepLiveService extends Service implements MediaPlayer.OnCompletionListener {
  31 + //唤醒锁
  32 + private PowerManager.WakeLock wakeLock = null;
  33 + //电源管理器
  34 + private PowerManager powerManager = null;
  35 + //音频播放器
  36 + public static MediaPlayer mMediaPlayer;
  37 + //广播
  38 + private static ServiceReceiver myReceiver;
  39 + private String CHANNEL_ONE_ID = "com.cnlive.keep";
  40 + private String CHANNEL_ONE_NAME = "KeepLive";
  41 + private NotificationManager mNM;
  42 + private Notification notification = null;
  43 + //是否在后台运行
  44 + public static boolean isKeepService = true;
  45 + public static KeepLiveService instance;
  46 + private int startId;
  47 + private final String TAG = "KeepLiveService";
  48 + private Handler handler;
  49 + private Runnable runnable;
  50 +
  51 + public KeepLiveService() {
  52 + }
  53 +
  54 + public static KeepLiveService getInstance() {
  55 + if (instance == null) {
  56 + instance = new KeepLiveService();
  57 + return instance;
  58 + } else {
  59 + return instance;
  60 + }
  61 + }
  62 +
  63 + @Override
  64 + public void onCreate() {
  65 + super.onCreate();
  66 + instance = this;
  67 +// if (!ServiceUtils.isServiceRunning(getApplicationContext(), "com.cnlive.moudle.pedometer.service.StepService")) {
  68 +// startService(new Intent(getApplicationContext(), StepService.class));
  69 +// }
  70 + init();
  71 + initBroadCastReceiver();
  72 + handler = new Handler();
  73 + runnable = new Runnable() {
  74 + @Override
  75 + public void run() {
  76 + //跨进程读取配置文件
  77 + boolean isRun = CommonInfo.getIsRunKeepAliveService(getApplicationContext());
  78 + if (isRun) {
  79 + handler.postDelayed(this, 5000);
  80 + } else {
  81 +// try {
  82 +// if (myReceiver != null) {
  83 +// unregisterReceiver(myReceiver);
  84 +// }
  85 +// } catch (Exception e) {
  86 +// Log.e(TAG, "run: ");
  87 +// }
  88 + stopPlaySong();
  89 + stopForeground(true);
  90 + }
  91 +
  92 + }
  93 + };
  94 +
  95 + }
  96 +
  97 + @Override
  98 + public void onTaskRemoved(Intent rootIntent) {
  99 + super.onTaskRemoved(rootIntent);
  100 + Log.e("onTaskRemoved", "onTaskRemoved");
  101 + }
  102 +
  103 + /**
  104 + * 初始化广播
  105 + */
  106 + private void initBroadCastReceiver() {
  107 + if (wakeLock != null) {
  108 + myReceiver = new ServiceReceiver(wakeLock);
  109 + } else {
  110 + myReceiver = new ServiceReceiver();
  111 + }
  112 + IntentFilter intentFilter = new IntentFilter();
  113 + intentFilter.addAction(Intent.ACTION_SCREEN_OFF);
  114 + intentFilter.addAction(Intent.ACTION_SCREEN_ON);
  115 +// intentFilter.addAction(Intent.ACTION_BATTERY_CHANGED);
  116 +// intentFilter.addAction(Intent.ACTION_TIME_CHANGED);
  117 +// intentFilter.addAction(Intent.ACTION_POWER_CONNECTED);
  118 +// intentFilter.addAction(Intent.ACTION_POWER_DISCONNECTED);
  119 + intentFilter.addAction("com.cnlive.strike.receiver.ServiceReceiver");
  120 + intentFilter.addAction("close.KeepService");
  121 + registerReceiver(myReceiver, intentFilter);
  122 + }
  123 +
  124 + /**
  125 + * 初始化相关参数
  126 + */
  127 + @SuppressLint("InvalidWakeLockTag")
  128 + private void init() {
  129 + if (null == powerManager) {
  130 + powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
  131 + }
  132 + if (null == wakeLock) {
  133 + wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "track upload");
  134 + }
  135 + if (null == mNM) {
  136 + mNM = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
  137 + }
  138 +
  139 + }
  140 +
  141 + @SuppressLint("WrongConstant")
  142 + @Override
  143 + public int onStartCommand(Intent intent, int flags, int startId) {
  144 + //判断是否运行计步服务
  145 + boolean isRunStepService = CommonInfo.getIsRunStepService(getApplicationContext());
  146 + if (isRunStepService) {
  147 + if (!ServiceUtils.isServiceRunning(getApplicationContext(), "com.cnlive.moudle.pedometer.service.StepService")) {
  148 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
  149 + startForegroundService(new Intent(getApplicationContext(), StepService.class));
  150 + } else {
  151 + startService(new Intent(getApplicationContext(), StepService.class));
  152 + }
  153 + }
  154 + }
  155 + this.startId = startId;
  156 + //跨进程读取配置文件
  157 + boolean isRun = CommonInfo.getIsRunKeepAliveService(getApplicationContext());
  158 + Log.e("isRun onStartCommand", "" + isRun);
  159 +
  160 + if (isRun) {
  161 + if (runnable != null) {
  162 + handler.postDelayed(runnable, 5000);
  163 + }
  164 + showHideForegroundNotification();
  165 +// startService(new Intent(getApplicationContext(), HideKeepTipService.class));
  166 + Log.e(TAG, "启动HideKeepTipService");
  167 + startPlaySong();
  168 + }
  169 + return START_STICKY;
  170 + }
  171 +
  172 + //开始、暂停播放
  173 + public void startPlaySong() {
  174 + if (mMediaPlayer == null) {
  175 + mMediaPlayer = MediaPlayer.create(getApplicationContext(), R.raw.no_kill);
  176 + }
  177 + mMediaPlayer.setWakeMode(getApplicationContext(), PowerManager.PARTIAL_WAKE_LOCK);
  178 + mMediaPlayer.setOnCompletionListener(this);
  179 +// mMediaPlayer.setOnErrorListener(new MediaPlayer.OnErrorListener() {
  180 +// @Override
  181 +// public boolean onError(MediaPlayer mediaPlayer, int i, int i1) {
  182 +// mMediaPlayer.reset();
  183 +// mMediaPlayer.release();
  184 +// mMediaPlayer = null;
  185 +// startPlaySong();
  186 +// return false;
  187 +// }
  188 +// });
  189 + if (!mMediaPlayer.isPlaying()) {
  190 + mMediaPlayer.start();
  191 + Log.e(TAG, "开始播放");
  192 + }
  193 +
  194 + }
  195 +
  196 + //停止播放销毁对象
  197 + public void stopPlaySong() {
  198 +
  199 + if (mMediaPlayer != null) {
  200 + mMediaPlayer.stop();
  201 + mMediaPlayer.release();
  202 + mMediaPlayer = null;
  203 + Log.e("停止播放", "停止");
  204 + }
  205 + }
  206 +
  207 +
  208 + private void showHideForegroundNotification() {
  209 + NotificationChannel channel = null;
  210 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
  211 + channel = new NotificationChannel(CHANNEL_ONE_ID, CHANNEL_ONE_NAME,
  212 + NotificationManager.IMPORTANCE_HIGH);
  213 + channel.enableLights(false);
  214 + channel.enableVibration(false);
  215 + channel.setVibrationPattern(new long[]{0});
  216 + channel.setSound(null, null);
  217 + channel.setLockscreenVisibility(NotificationCompat.VISIBILITY_PRIVATE);
  218 + mNM.createNotificationChannel(channel);
  219 + }
  220 + notification = new NotificationCompat.Builder(this, CHANNEL_ONE_ID)
  221 + .setWhen(System.currentTimeMillis())
  222 + .setSound(null)
  223 + .build();
  224 + // 0 隐藏前台服务通知
  225 + startForeground(100, notification);
  226 +// stopForeground(true);
  227 + }
  228 +
  229 + @Override
  230 + public void onDestroy() {
  231 + super.onDestroy();
  232 + Log.e("onDestroy", "onDestroy:" + notification);
  233 + if (myReceiver != null) {
  234 + unregisterReceiver(myReceiver);
  235 + }
  236 + try {
  237 +// stopForeground(true);
  238 + } catch (Exception e) {
  239 + }
  240 + stopPlaySong();
  241 + // 重启自己
  242 + if (isKeepService) {
  243 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
  244 + startForegroundService(new Intent(getApplicationContext(), KeepLiveService.class));
  245 + } else {
  246 + startService(new Intent(getApplicationContext(), KeepLiveService.class));
  247 + }
  248 + //发送重启广播
  249 + sendRestartBroadCast();
  250 + }
  251 +
  252 +
  253 + }
  254 +
  255 +
  256 + /**
  257 + * 发送重启广播
  258 + */
  259 + private void sendRestartBroadCast() {
  260 + Intent intent = new Intent(" com.cnlive.moudle.pedometer.receivers.MyReceiver");
  261 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
  262 + intent.setComponent(new ComponentName(getPackageName(), " com.cnlive.moudle.pedometer.receivers.MyReceiver"));//高版本Android发送广播需要加这句
  263 + }
  264 + sendBroadcast(intent);
  265 + }
  266 +
  267 + @Override
  268 + public IBinder onBind(Intent intent) {
  269 + // TODO: Return the communication channel to the service.
  270 + throw new UnsupportedOperationException("Not yet implemented");
  271 + }
  272 +
  273 +
  274 + /**
  275 + * 歌曲播放完成
  276 + *
  277 + * @param mediaPlayer
  278 + */
  279 + @Override
  280 + public void onCompletion(MediaPlayer mediaPlayer) {
  281 + boolean isRun = CommonInfo.getIsRunKeepAliveService(getApplicationContext());
  282 +
  283 + if (isRun) {
  284 + Log.e(TAG, "重新播放");
  285 + mediaPlayer.start();
  286 + Intent intent = new Intent("com.cnlive.strike.receiver.ServiceReceiver");
  287 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
  288 + intent.setComponent(new ComponentName(getPackageName(), "com.cnlive.strike.receiver.ServiceReceiver"));//高版本Android发送广播需要加这句
  289 + }
  290 + sendBroadcast(intent);
  291 + } else {
  292 + Log.e(TAG, "停止重新播放");
  293 + stopPlaySong();
  294 + }
  295 +
  296 +
  297 + }
  298 +}
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,6 +47,7 @@ import com.cnlive.moudle.pedometer.sql.db.DbCore;
47 import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; 47 import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity;
48 import com.cnlive.moudle.pedometer.ui.activity.PedometerMainActivity; 48 import com.cnlive.moudle.pedometer.ui.activity.PedometerMainActivity;
49 import com.cnlive.moudle.pedometer.utils.MySpHelper; 49 import com.cnlive.moudle.pedometer.utils.MySpHelper;
  50 +import com.cnlive.moudle.pedometer.utils.ServiceUtils;
50 import com.example.moudle_pedometer.R; 51 import com.example.moudle_pedometer.R;
51 52
52 import org.greenrobot.eventbus.EventBus; 53 import org.greenrobot.eventbus.EventBus;
@@ -169,6 +170,14 @@ public class StepService extends Service implements SensorEventListener { @@ -169,6 +170,14 @@ public class StepService extends Service implements SensorEventListener {
169 init(); 170 init();
170 showStartForegroundNotification(); 171 showStartForegroundNotification();
171 initBroadcastReceiver(); 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 private void initTrace() { 183 private void initTrace() {
@@ -232,7 +241,6 @@ public class StepService extends Service implements SensorEventListener { @@ -232,7 +241,6 @@ public class StepService extends Service implements SensorEventListener {
232 if (mClient != null) { 241 if (mClient != null) {
233 mClient.startGather(traceListener); 242 mClient.startGather(traceListener);
234 Toast.makeText(getApplicationContext(), "开启轨迹服务", Toast.LENGTH_LONG).show(); 243 Toast.makeText(getApplicationContext(), "开启轨迹服务", Toast.LENGTH_LONG).show();
235 -  
236 } 244 }
237 } 245 }
238 } 246 }
@@ -273,6 +281,8 @@ public class StepService extends Service implements SensorEventListener { @@ -273,6 +281,8 @@ public class StepService extends Service implements SensorEventListener {
273 public void onStartGatherCallback(int errorNo, String message) { 281 public void onStartGatherCallback(int errorNo, String message) {
274 if (StatusCodes.SUCCESS == errorNo || StatusCodes.GATHER_STARTED == errorNo) { 282 if (StatusCodes.SUCCESS == errorNo || StatusCodes.GATHER_STARTED == errorNo) {
275 Toast.makeText(getApplicationContext(), "开始采集", Toast.LENGTH_LONG).show(); 283 Toast.makeText(getApplicationContext(), "开始采集", Toast.LENGTH_LONG).show();
  284 + CommonInfo.setTsRunBaiduTraceService(getApplicationContext(), true);
  285 +
276 } 286 }
277 } 287 }
278 288
@@ -292,6 +302,7 @@ public class StepService extends Service implements SensorEventListener { @@ -292,6 +302,7 @@ public class StepService extends Service implements SensorEventListener {
292 Toast.makeText(getApplicationContext(), "停止采集", Toast.LENGTH_LONG).show(); 302 Toast.makeText(getApplicationContext(), "停止采集", Toast.LENGTH_LONG).show();
293 if (mClient != null) { 303 if (mClient != null) {
294 mClient.stopTrace(mTrace, traceListener); 304 mClient.stopTrace(mTrace, traceListener);
  305 + CommonInfo.setTsRunBaiduTraceService(getApplicationContext(), false);
295 } 306 }
296 } 307 }
297 } 308 }
@@ -356,7 +367,7 @@ public class StepService extends Service implements SensorEventListener { @@ -356,7 +367,7 @@ public class StepService extends Service implements SensorEventListener {
356 @SuppressLint("WrongConstant") 367 @SuppressLint("WrongConstant")
357 @Override 368 @Override
358 public int onStartCommand(Intent intent, int flags, int startId) { 369 public int onStartCommand(Intent intent, int flags, int startId) {
359 - userId =CommonInfo.getUserId(getApplicationContext()); 370 + userId = CommonInfo.getUserId(getApplicationContext());
360 if (userId != null && !TextUtils.isEmpty(userId)) { 371 if (userId != null && !TextUtils.isEmpty(userId)) {
361 if (!EventBus.getDefault().isRegistered(this)) { 372 if (!EventBus.getDefault().isRegistered(this)) {
362 EventBus.getDefault().register(this); 373 EventBus.getDefault().register(this);
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/fragment/RunRaceDetailFragment.java
@@ -7,6 +7,7 @@ import android.support.annotation.NonNull; @@ -7,6 +7,7 @@ import android.support.annotation.NonNull;
7 import android.support.annotation.Nullable; 7 import android.support.annotation.Nullable;
8 import android.support.design.widget.BottomSheetBehavior; 8 import android.support.design.widget.BottomSheetBehavior;
9 import android.support.design.widget.BottomSheetDialog; 9 import android.support.design.widget.BottomSheetDialog;
  10 +import android.text.TextUtils;
10 import android.util.Log; 11 import android.util.Log;
11 import android.view.View; 12 import android.view.View;
12 import android.widget.FrameLayout; 13 import android.widget.FrameLayout;
@@ -62,10 +63,11 @@ public class RunRaceDetailFragment extends QMUIFragment&lt;RunRaceDetailFragmentVie @@ -62,10 +63,11 @@ public class RunRaceDetailFragment extends QMUIFragment&lt;RunRaceDetailFragmentVie
62 63
63 mSensorManager = (SensorManager) getActivity().getSystemService(SENSOR_SERVICE);//获取传感器管理服务 64 mSensorManager = (SensorManager) getActivity().getSystemService(SENSOR_SERVICE);//获取传感器管理服务
64 if (getMvpView() != null) { 65 if (getMvpView() != null) {
65 - getMvpView().initMap(); 66 + getMvpView().initMap();;
66 } 67 }
67 if (getPresenter()!=null){ 68 if (getPresenter()!=null){
68 - getPresenter().getRunRaceDetailInfo(getActivity(), CommonInfo.getStreetId(getActivity()),"10513196"); 69 + if (!TextUtils.isEmpty(CommonInfo.getStreetId(getActivity())))
  70 + getPresenter().getRunRaceDetailInfo(getActivity(),CommonInfo.getStreetId(getActivity()),"10513196","0");
69 } 71 }
70 72
71 } 73 }
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/widget/SelectDialog.java
@@ -48,6 +48,10 @@ public class SelectDialog extends Dialog { @@ -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 public SelectDialog(@NonNull Context context, View customview, int themeResId) { 55 public SelectDialog(@NonNull Context context, View customview, int themeResId) {
52 super(context, themeResId); 56 super(context, themeResId);
53 this.context = context; 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 \ No newline at end of file 6 \ No newline at end of file
moudle_pedometer/src/main/res/layout/dialog_select.xml
@@ -11,16 +11,17 @@ @@ -11,16 +11,17 @@
11 android:layout_height="wrap_content" 11 android:layout_height="wrap_content"
12 android:background="@drawable/free_dialog_bg" 12 android:background="@drawable/free_dialog_bg"
13 android:orientation="vertical" 13 android:orientation="vertical"
14 - android:paddingTop="10dp"  
15 - > 14 + android:paddingTop="10dp">
16 15
17 <TextView 16 <TextView
18 android:id="@+id/tv_dialog_tip" 17 android:id="@+id/tv_dialog_tip"
19 android:layout_width="wrap_content" 18 android:layout_width="wrap_content"
20 android:layout_height="wrap_content" 19 android:layout_height="wrap_content"
21 - android:minHeight="75dp"  
22 - android:gravity="center"  
23 android:layout_gravity="center" 20 android:layout_gravity="center"
  21 + android:layout_marginLeft="10dp"
  22 + android:layout_marginRight="10dp"
  23 + android:gravity="center"
  24 + android:minHeight="75dp"
24 android:text="标题" 25 android:text="标题"
25 android:textColor="@color/black" 26 android:textColor="@color/black"
26 android:textSize="17sp" 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 \ No newline at end of file 130 \ No newline at end of file
moudle_pedometer/src/main/res/layout/fragment_run_race_detail.xml
@@ -49,15 +49,16 @@ @@ -49,15 +49,16 @@
49 android:layout_height="35dp" 49 android:layout_height="35dp"
50 android:layout_gravity="right" 50 android:layout_gravity="right"
51 android:layout_margin="10dp" 51 android:layout_margin="10dp"
52 - android:background="@drawable/xqt_share" /> 52 + android:background="@drawable/xqt_share"
  53 + android:visibility="gone" />
53 <!----> 54 <!---->
54 <com.cnlive.strike.ui.widget.UIEmptyView 55 <com.cnlive.strike.ui.widget.UIEmptyView
55 android:id="@+id/empty_layout" 56 android:id="@+id/empty_layout"
56 android:layout_width="match_parent" 57 android:layout_width="match_parent"
57 android:layout_height="match_parent" 58 android:layout_height="match_parent"
  59 + android:background="@color/color_fff"
58 android:focusable="true" 60 android:focusable="true"
59 android:focusableInTouchMode="true" 61 android:focusableInTouchMode="true"
60 - android:background="@color/color_fff"  
61 android:visibility="gone" /> 62 android:visibility="gone" />
62 63
63 </FrameLayout> 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 \ No newline at end of file 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 \ No newline at end of file 319 \ No newline at end of file
moudle_pedometer/src/main/res/layout/layout_run_detail_street.xml
@@ -76,14 +76,6 @@ @@ -76,14 +76,6 @@
76 android:textColor="@color/text_black" 76 android:textColor="@color/text_black"
77 android:textSize="15sp" /> 77 android:textSize="15sp" />
78 78
79 - <TextView  
80 - android:id="@+id/tv_mileage"  
81 - android:layout_width="wrap_content"  
82 - android:layout_height="wrap_content"  
83 - android:layout_marginLeft="25dp"  
84 - android:text="-"  
85 - android:textColor="@color/text_black"  
86 - android:textSize="15sp" />  
87 </LinearLayout> 79 </LinearLayout>
88 </LinearLayout> 80 </LinearLayout>
89 <!--按钮--> 81 <!--按钮-->
moudle_pedometer/src/main/res/values/ids.xml
@@ -6,5 +6,7 @@ @@ -6,5 +6,7 @@
6 <item name="fragment_back" type="id" /> 6 <item name="fragment_back" type="id" />
7 <item name="fragment_more" type="id" /> 7 <item name="fragment_more" type="id" />
8 <item name="fragment_finish_run_map" type="id" /> 8 <item name="fragment_finish_run_map" type="id" />
  9 + <!--路径工具-->
  10 + <item name="fragment_start_collect_trace" type="id" />
9 11
10 </resources> 12 </resources>
moudle_pedometer/src/main/res/values/strings.xml
@@ -73,6 +73,8 @@ @@ -73,6 +73,8 @@
73 <!--网络请求--> 73 <!--网络请求-->
74 <string name="retry">重试</string> 74 <string name="retry">重试</string>
75 <string name="later_finish">天后结束</string> 75 <string name="later_finish">天后结束</string>
  76 + <string name="layout_collect_bind_trace">绑定轨迹</string>
  77 + <string name="identify_the_start_point">确认开始地点</string>
76 78
77 79
78 </resources> 80 </resources>