Commit c19c91bc98144643b37af2337df9c6ec83f4f3fc

Authored by 杨帅
1 parent 04e2c880

1 路径工具

Showing 36 changed files with 2301 additions and 849 deletions
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/commonInfo/CollCommonInfo.java renamed to moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/commonInfo/CollCommonInfo.java
1   -package com.cnlive.moudle.pedometer.commonInfo;
  1 +package com.cnlive.moudle.collectionTrace.commonInfo;
2 2  
3 3 import android.content.Context;
4 4  
... ... @@ -132,7 +132,7 @@ public class CollCommonInfo {
132 132 * @param context
133 133 */
134 134 public static boolean getIsRunBaiduTraceService(Context context) {
135   - return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getBoolean("CollRunBaiduTraceService", false);
  135 + return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getBoolean("CollRunBaiduTraceService", true);
136 136 }
137 137  
138 138 /**
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollRunMainFragmentView.java
... ... @@ -4,9 +4,7 @@ import android.content.Context;
4 4 import android.content.Intent;
5 5 import android.os.Handler;
6 6 import android.os.SystemClock;
7   -import android.support.v4.content.ContextCompat;
8 7 import android.text.TextUtils;
9   -import android.util.Log;
10 8 import android.view.MotionEvent;
11 9 import android.view.View;
12 10 import android.widget.Chronometer;
... ... @@ -15,26 +13,24 @@ import com.baidu.location.BDAbstractLocationListener;
15 13 import com.baidu.location.BDLocation;
16 14 import com.baidu.location.LocationClient;
17 15 import com.baidu.location.LocationClientOption;
18   -import com.cnlive.moudle.collectionTrace.service.CollKeepLiveService;
  16 +import com.baidu.mapapi.model.LatLng;
19 17 import com.cnlive.moudle.collectionTrace.service.CollStepService;
20   -import com.cnlive.moudle.collectionTrace.ui.activity.CollRunningMapActivity;
21 18 import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunMainFragment;
22   -import com.cnlive.moudle.pedometer.commonInfo.CollCommonInfo;
  19 +import com.cnlive.moudle.collectionTrace.commonInfo.CollCommonInfo;
23 20 import com.cnlive.moudle.pedometer.model.Constant;
24   -import com.cnlive.moudle.pedometer.model.MessageEvent;
25 21 import com.cnlive.moudle.pedometer.model.RunningFinishBean;
26 22 import com.cnlive.moudle.pedometer.model.RunningMapBean;
  23 +import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo;
  24 +import com.cnlive.moudle.pedometer.sql.entity.CollFailedEntity;
27 25 import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity;
28   -import com.cnlive.moudle.pedometer.ui.activity.RunningMapActivity;
29 26 import com.cnlive.moudle.pedometer.ui.widget.SelectDialog;
  27 +import com.cnlive.moudle.pedometer.ui.widget.TipDialog;
30 28 import com.cnlive.moudle.pedometer.utils.ButtonAnimUtil;
31   -import com.cnlive.moudle.pedometer.utils.CollStepUtil;
32   -import com.cnlive.moudle.pedometer.utils.GsonUtil;
  29 +import com.cnlive.moudle.collectionTrace.utils.CollStepUtil;
33 30 import com.cnlive.moudle.pedometer.utils.TimeUtil;
34 31 import com.example.moudle_pedometer.R;
35 32 import com.hannesdorfmann.mosby3.mvp.MvpView;
36 33  
37   -import org.greenrobot.eventbus.EventBus;
38 34  
39 35 public class CollRunMainFragmentView implements MvpView {
40 36 private final String TAG = "CollRunMainFragmentView";
... ... @@ -51,9 +47,13 @@ public class CollRunMainFragmentView implements MvpView {
51 47 private int timeCountDown;//时间倒计时
52 48 private String uid;
53 49 private boolean needWriteDataFlag = true;//是否需要将计时器基值写入到数据库
  50 + private CollUserStepEntity userStepEntity;
54 51 // 定位相关
55 52 private LocationClient mLocClient;
56   - public MyLocationListenner myListener = new MyLocationListenner();
  53 + public CollRunMainFragmentView.MyLocationListenner myListener = new CollRunMainFragmentView.MyLocationListenner();
  54 + private String employTime = "";
  55 + private LatLng endLatLng;//终点坐标
  56 + private TipDialog tipDialog;
57 57  
58 58 public CollRunMainFragmentView(CollRunMainFragment fragment) {
59 59 this.fragment = fragment;
... ... @@ -106,51 +106,67 @@ public class CollRunMainFragmentView implements MvpView {
106 106 /**
107 107 * 初始化相关视图
108 108 */
109   - public void initView() {
110   - uid = "yangshuai";
  109 + public void initView(RunRaceDetailInfo runRaceDetailInfo) {
111 110 initLocationClient();
112   - CollUserStepEntity userStepEntity = CollStepUtil.getCollUserStepData(getContext(), uid);
  111 + uid = CollCommonInfo.getUserId(getContext());
  112 + userStepEntity = CollStepUtil.getCollUserStepData(getContext(), uid);
  113 + //设置数据
113 114 if (userStepEntity != null) {
114   - CollStepUtil.clearRunData(getContext(), CollCommonInfo.getUserId(getContext()));
  115 + //设置赛事标题
  116 + if (TextUtils.isEmpty(userStepEntity.getStreetTitle())) {
  117 + CollStepUtil.setCollStreetTitle(getContext(), CollCommonInfo.getUserId(getContext()), runRaceDetailInfo.getTitle());
  118 + }
  119 + //设置开始时间和赛事id
  120 + if (TextUtils.isEmpty(userStepEntity.getStreetId())) {
  121 + CollStepUtil.setCollStepStartData(getContext(), uid, TimeUtil.getNowTimeStamp(), CollCommonInfo.getStreetId(getContext()));
  122 + }
  123 + //设置步数
  124 + if (!TextUtils.isEmpty(userStepEntity.getStepCount())) {
  125 + //设置行走步数
  126 + fragment.binding.tvStepCount.setText(userStepEntity.getStepCount());
  127 + //设置行走公里
  128 + fragment.binding.tvRunDistance.setText(CollStepUtil.getWalkDistanceKM(Long.parseLong(userStepEntity.getStepCount())) + "");
  129 + }
  130 +
  131 +
115 132 }
  133 +
116 134 fragment.binding.llRunMainRoot.setVisibility(View.GONE);
117   - ButtonAnimUtil.startAnimation(fragment.binding.llStartTimeTip, false);
118 135 firstTimeFlag = true;
119 136 handler = new Handler();
120 137 timeCountDown = 4;
121 138 //开始时间倒计时
122   - runnable = new Runnable() {
  139 + fragment.binding.llRunMainRoot.setVisibility(View.VISIBLE);
  140 + fragment.binding.llRunMainRoot.setBackgroundColor(getContext().getResources().getColor(R.color.run_main_bg));
  141 + new Handler().postDelayed(new Runnable() {
123 142 @Override
124 143 public void run() {
125   - if (fragment.getActivity() == null) {
126   - return;
  144 + if (userStepEntity != null) {
  145 + //没有暂停,从初始时间开始
  146 + if (userStepEntity.getChronometerBase() != 0) {
  147 + fragment.binding.chronometer.setBase(userStepEntity.getChronometerBase());
  148 + } else {
  149 + fragment.binding.chronometer.setFormat("00:00:01");
  150 + fragment.binding.chronometer.setBase(SystemClock.elapsedRealtime());
  151 + //设置计步开始时间
  152 + CollStepUtil.setCollChronometerBase(getContext(), uid, fragment.binding.chronometer.getBase());
  153 + }
  154 + fragment.binding.chronometer.start();
  155 + //设置步数
  156 + if (!TextUtils.isEmpty(userStepEntity.getStepCount())) {
  157 + fragment.binding.tvStepCount.setText(userStepEntity.getStepCount());
  158 + }
127 159 }
128   - if (timeCountDown > 1) {
129   - timeCountDown--;
130   - fragment.binding.tvTimeCountDown.setVisibility(View.VISIBLE);
131   - fragment.binding.tvTimeCountDown.setText(timeCountDown + "");
132   - ButtonAnimUtil.setTimeShowZoomIn(fragment.binding.tvTimeCountDown);
133   - //依次倒计时
134   - handler.postDelayed(runnable, 1000);
135   - } else {
136   - ButtonAnimUtil.startAnimation(fragment.binding.llStartTimeTip, true);
137   - fragment.binding.llRunMainRoot.setVisibility(View.VISIBLE);
138   - new Handler().postDelayed(new Runnable() {
139   - @Override
140   - public void run() {
141   - //开始计时
142   - if (firstTimeFlag) {
143   - firstTimeFlag = false;
144   - fragment.binding.chronometer.setFormat("00:00:01");
145   - fragment.binding.chronometer.setBase(SystemClock.elapsedRealtime());
146   - fragment.binding.chronometer.start();
147   - }
148   - }
149   - }, 10);
150   -
  160 + //没有数据
  161 + else {
  162 + fragment.binding.chronometer.setFormat("00:00:01");
  163 + fragment.binding.chronometer.setBase(SystemClock.elapsedRealtime());
  164 + //设置计步开始时间
  165 + CollStepUtil.setCollChronometerBase(getContext(), uid, fragment.binding.chronometer.getBase());
  166 + fragment.binding.chronometer.start();
151 167 }
152 168 }
153   - };
  169 + }, 10);
154 170 //设置计时监听
155 171 fragment.binding.chronometer.setOnChronometerTickListener(new Chronometer.OnChronometerTickListener() {
156 172 @Override
... ... @@ -158,135 +174,50 @@ public class CollRunMainFragmentView implements MvpView {
158 174 int hour = (int) ((SystemClock.elapsedRealtime() - chronometer.getBase()) / 1000 / 60 / 60);
159 175 int minute = (int) ((SystemClock.elapsedRealtime() - chronometer.getBase()) / 1000 / 60) % 60;
160 176 int second = (int) ((SystemClock.elapsedRealtime() - chronometer.getBase()) / 1000) % 60;
161   -// if (hour < 1) {
162   -// if (minute == 59 && second == 59) {
163   -// chronometer.setFormat("0" + "%s");
164   -// } else {
165   -// chronometer.setFormat("0" + String.valueOf(hour) + ":%s");
166   -// }
167   -// } else if (hour < 10) {
168   -// chronometer.setFormat("0" + "%s");
169   -// } else {
170   -// chronometer.setFormat("%s");
171   -// }
172   - String result = "";
  177 + employTime = (hour * 3600 + minute * 60 + second) + "";
173 178 if (hour < 1) {
174   - result += "0" + hour + ":";
175   - } else {
176   - result += hour + ":";
177   - }
178   - if (minute < 10) {
179   - result += "0" + minute + ":";
180   - } else {
181   - result += minute + ":";
182   - }
183   - if (second < 10) {
184   - result += "0" + second;
  179 + if (minute == 59 && second == 59) {
  180 + chronometer.setFormat("0" + "%s");
  181 + } else {
  182 + chronometer.setFormat("0" + String.valueOf(hour) + ":%s");
  183 + }
  184 + } else if (hour < 10) {
  185 + chronometer.setFormat("0" + "%s");
185 186 } else {
186   - result += second;
187   - }
188   - if (!TextUtils.isEmpty(result)) {
189   - chronometer.setFormat(result);
  187 + chronometer.setFormat("");
190 188 }
  189 +
191 190 }
192 191 });
193 192  
194   - boolean isRunStep = CollCommonInfo.getIsRunStepService(getContext());
195   - //当前用户已经在运动
196   -// if (!isRunStep) {
197   - //依次倒计时
198   - handler.postDelayed(runnable, 1000);
199   -// }
200   -// else {
201   -// //隐藏计时界面
202   -// fragment.binding.llStartTimeTip.setVisibility(View.GONE);
203   -// fragment.binding.llRunMainRoot.setVisibility(View.VISIBLE);
204   -// new Handler().postDelayed(new Runnable() {
205   -// @Override
206   -// public void run() {
207   -// //开始计时
208   -// if (firstTimeFlag) {
209   -// firstTimeFlag = false;
210   -// if (userStepEntity != null) {
211   -// Log.e(TAG, "run: "+ GsonUtil.GsonString(userStepEntity));
212   -// if ((userStepEntity.getPauseTimeStamp() != 0) && (userStepEntity.getRecordTime() != 0)) {
213   -// fragment.binding.chronometer.setBase(userStepEntity.getPauseTimeStamp() + (SystemClock.elapsedRealtime() - userStepEntity.getRecordTime()));
214   -// } else {
215   -// fragment.binding.chronometer.setFormat("00:00:01");
216   -// fragment.binding.chronometer.setBase(SystemClock.elapsedRealtime());
217   -// }
218   -// //设置步数
219   -// if (!TextUtils.isEmpty(userStepEntity.getStepCount())) {
220   -// fragment.binding.tvStepCount.setText(userStepEntity.getStepCount());
221   -// }
222   -// }
223   -// fragment.binding.chronometer.start();
224   -// }
225   -// }
226   -// }, 100);
227   -// //开启计步服务
228   -// startStepService(getContext(), uid);
229   -// }
230   -
231   - //设置继续按钮,缩放效果
232   - fragment.binding.flContinue.setOnTouchListener(new View.OnTouchListener() {
  193 + //隐藏计时界面
  194 + fragment.binding.llRunMainRoot.setVisibility(View.VISIBLE);
  195 + new Handler().postDelayed(new Runnable() {
233 196 @Override
234   - public boolean onTouch(View view, MotionEvent motionEvent) {
235   - //避免两个按钮事件同时响应
236   - if (stopStartFlag) {
237   - return false;
238   - }
239   - if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
240   - if (!continueStartFlag) {
241   - ButtonAnimUtil.setViewZoomIn(fragment.binding.flContinue);
242   - continueStartFlag = true;
243   -
  197 + public void run() {
  198 + //开始计时
  199 + if (firstTimeFlag) {
  200 + firstTimeFlag = false;
  201 + if (userStepEntity != null) {
  202 + //判断显示时间
  203 + //没有暂停,从初始时间开始
  204 + if (userStepEntity.getChronometerBase() != 0) {
  205 + fragment.binding.chronometer.setBase(userStepEntity.getChronometerBase());
  206 + } else {
  207 + fragment.binding.chronometer.setFormat("00:00:01");
  208 + fragment.binding.chronometer.setBase(SystemClock.elapsedRealtime());
  209 + }
  210 + //设置步数
  211 + if (!TextUtils.isEmpty(userStepEntity.getStepCount())) {
  212 + fragment.binding.tvStepCount.setText(userStepEntity.getStepCount());
  213 + }
244 214 }
245   - } else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
246   - ButtonAnimUtil.setViewZoomOut(fragment.binding.flContinue);
247   - continueStartFlag = false;
  215 + fragment.binding.chronometer.start();
248 216 }
249   - return false;
250 217 }
251   - });
252   - //设置继续按钮点击事件
253   - fragment.binding.flContinue.setOnClickListener(new View.OnClickListener() {
254   - @Override
255   - public void onClick(View view) {
256   - //继续记录轨迹
257   - if (CollStepService.mClient != null && CollStepService.traceListener != null) {
258   - CollCommonInfo.setTsRunBaiduTraceService(getContext(), true);
259   - CollStepService.mClient.startTrace(CollStepService.mTrace, CollStepService.traceListener);
260   - }
261   - needWriteDataFlag = true;
262   - //将当前计时器时间戳写入数据库
263   - setSQLPauseTime(uid);
264   - //为了点击时可以显示缩放动画,这里延迟一个动画时间进行(包括放大和缩小)
265   - handler.postDelayed(new Runnable() {
266   - @Override
267   - public void run() {
268   - //
269   - //隐藏两个按钮
270   - fragment.binding.flStopTip.setVisibility(View.INVISIBLE);
271   - fragment.binding.llTwoBottomButton.setVisibility(View.GONE);
272   -// ButtonAnimUtil.setViewShowZoomIn(fragment.binding.llPause);
273   - //显示暂停按钮
274   - fragment.binding.flPause.setVisibility(View.VISIBLE);
275   - //
276   - }
277   - }, ButtonAnimUtil.DEFAULT_ZOOM_DURATION * 2);
278   - //继续计步
279   - EventBus.getDefault().post(new MessageEvent(Constant.SERVICE_STEP_COUNT_CONTINUE, ""));
280   - //开始计时
281   - if (!firstTimeFlag) {
282   - fragment.binding.chronometer.setBase(fragment.binding.chronometer.getBase() + (SystemClock.elapsedRealtime() - mRecordTime));
283   - }
284   - fragment.binding.chronometer.start();
285   -
  218 + }, 10);
286 219  
287   - }
288   - });
289   - //设置停止按钮缩放特效
  220 +//设置停止按钮缩放特效
290 221 fragment.binding.flStop.setOnTouchListener(new View.OnTouchListener() {
291 222 @Override
292 223 public boolean onTouch(View view, MotionEvent motionEvent) {
... ... @@ -321,27 +252,46 @@ public class CollRunMainFragmentView implements MvpView {
321 252 SelectDialog selectDialog = new SelectDialog(fragment.getActivity(), "确定结束运动吗?", "确定", new SelectDialog.DialogInterface() {
322 253 @Override
323 254 public void onClick(SelectDialog dialog) {
324   - CollCommonInfo.setIsRunKeepAliveService(getContext(), false);
325   - CollCommonInfo.setIsWriteUserStep(getContext(), false);
  255 + //停止计时
  256 + fragment.binding.chronometer.stop();
  257 + //设置状态标志位
  258 + setStopStartFlag();
  259 + //设置运动结束时间戳
  260 +// CollStepUtil.setUserFinishTimeStamp(getContext(), uid);
326 261 fragment.binding.cpCurrent.setVisibility(View.GONE);
327 262 ButtonAnimUtil.setViewDefault(fragment.binding.flStop);
328   - //清空数据
329   - CollCommonInfo.reset(getContext());
330 263 dialog.dismiss();
331   - if (CollStepService.mClient != null) {
332   - CollStepService.mClient.stopGather(CollStepService.traceListener);
333   - }
334   - fragment.getActivity().stopService(new Intent(fragment.getActivity(), CollStepService.class));
335 264 RunningFinishBean runningFinishBean = new RunningFinishBean();
336   - runningFinishBean.setStartPoint("开始地点");
337   - runningFinishBean.setEndPoint("结束地点");
  265 +// runningFinishBean.setStartPoint(userStepEntity.getStartPoint());
  266 +// runningFinishBean.setEndPoint(userStepEntity.getEndPoint());
338 267 runningFinishBean.setRunDistance(fragment.binding.tvRunDistance.getText().toString());
339   - runningFinishBean.setSpeed(fragment.binding.tvSpeed.getText().toString());
340   - runningFinishBean.setStep(fragment.binding.tvStepCount.getText().toString());
  268 + //必须先设置步数,然后设置配速
  269 + if ("--".equals(fragment.binding.tvStepCount.getText().toString())) {
  270 + runningFinishBean.setStep("0");
  271 + } else {
  272 + runningFinishBean.setStep(fragment.binding.tvStepCount.getText().toString());
  273 + }
  274 + if ("--".equals(fragment.binding.tvSpeed.getText().toString())) {
  275 + String speed = CollStepUtil.getPaceSpeed(Double.parseDouble(employTime), Double.parseDouble(fragment.binding.tvRunDistance.getText().toString()));
  276 + runningFinishBean.setSpeed(speed);
  277 + } else {
  278 + runningFinishBean.setSpeed(fragment.binding.tvSpeed.getText().toString());
  279 + }
341 280 runningFinishBean.setTime(fragment.binding.chronometer.getText().toString());
342   - runningFinishBean.setDate(TimeUtil.getFormatNowTime());
343   -// RunningFinishActivity.startActivity(fragment.getActivity(), runningFinishBean);
344   - fragment.getActivity().finish();
  281 + runningFinishBean.setDate(TimeUtil.getStampToTime(userStepEntity.getFinishTimeStamp() * 1000, "yyyy/MM/dd HH:mm"));
  282 + runningFinishBean.setStreetTitle(userStepEntity.getStreetTitle());
  283 + //设置用时
  284 + runningFinishBean.setEmployTime(employTime);
  285 +
  286 + //先将失败数据保存起来
  287 + if (runningFinishBean != null && userStepEntity != null) {
  288 + setFailData(getContext(), userStepEntity, runningFinishBean);
  289 + }
  290 +// FailedEntity failedEntity = CollStepUtil.getTempSaveFailData(getContext(), CollCommonInfo.getUserId(getContext()), userStepEntity.getStartTimeStamp());
  291 +// if (failedEntity != null) {
  292 +// CollRunningFinishActivity.startActivity(fragment.getActivity(), runningFinishBean);
  293 +// fragment.getActivity().finish();
  294 +// }
345 295 }
346 296 }, "取消", new SelectDialog.DialogInterface() {
347 297 @Override
... ... @@ -372,56 +322,6 @@ public class CollRunMainFragmentView implements MvpView {
372 322 return true;
373 323 }
374 324 });
375   - //设置暂停按钮,缩放效果
376   - fragment.binding.flPause.setOnTouchListener(new View.OnTouchListener() {
377   - @Override
378   - public boolean onTouch(View view, MotionEvent motionEvent) {
379   - if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
380   - if (!pauseStartFlag) {
381   - ButtonAnimUtil.setViewZoomIn(fragment.binding.flPause);
382   - pauseStartFlag = true;
383   -
384   - }
385   - } else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
386   - ButtonAnimUtil.setViewZoomOut(fragment.binding.flPause);
387   - pauseStartFlag = false;
388   - }
389   - return false;
390   - }
391   - });
392   - //设置暂停按钮点击事件
393   - fragment.binding.flPause.setOnClickListener(new View.OnClickListener() {
394   - @Override
395   - public void onClick(View view) {
396   - //暂停轨迹记录
397   - if (CollStepService.mClient != null && CollStepService.traceListener != null) {
398   - CollCommonInfo.setTsRunBaiduTraceService(getContext(), false);
399   - CollStepService.mClient.stopGather(CollStepService.traceListener);
400   - }
401   - //将当前计时器时间戳写入数据库
402   - setSQLPauseTime(uid);
403   - needWriteDataFlag = false;
404   -// ButtonAnimUtil.setViewHideZoomOut(fragment.binding.llPause);
405   - handler.postDelayed(new Runnable() {
406   - @Override
407   - public void run() {
408   - //隐藏本身
409   - fragment.binding.flPause.setVisibility(View.GONE);
410   - }
411   - }, ButtonAnimUtil.HIDE_VIEW_ZOOM_DURATION);
412   - //显示继续按钮
413   - fragment.binding.llTwoBottomButton.setVisibility(View.VISIBLE);
414   - ButtonAnimUtil.setViewShowZoomIn(fragment.binding.flContinue);
415   - ButtonAnimUtil.setViewShowZoomIn(fragment.binding.flStop);
416   - //停止计时
417   - fragment.binding.chronometer.stop();
418   - mRecordTime = SystemClock.elapsedRealtime();
419   - //暂停计步
420   - EventBus.getDefault().post(new MessageEvent(Constant.SERVICE_STEP_COUNT_PAUSE, ""));
421   - //重置速度
422   -// resetSpeed();
423   - }
424   - });
425 325 //gps点击事件
426 326 fragment.binding.rlGps.setOnClickListener(new View.OnClickListener() {
427 327 @Override
... ... @@ -441,7 +341,19 @@ public class CollRunMainFragmentView implements MvpView {
441 341 }
442 342 runningMapBean.setDistance(fragment.binding.tvRunDistance.getText().toString());
443 343 runningMapBean.setCurrentSpeed(fragment.binding.tvSpeed.getText().toString());
444   - CollRunningMapActivity.startActivity(fragment.getActivity(), runningMapBean);
  344 +// CollRunningMapActivity.startActivity(fragment.getActivity(), runningMapBean);
  345 + }
  346 + });
  347 + //返回按钮点击事件
  348 + fragment.binding.llBack.setOnClickListener(new View.OnClickListener() {
  349 + @Override
  350 + public void onClick(View view) {
  351 +
  352 + if (getContext() == null) {
  353 + return;
  354 + }
  355 +// setSQLPauseTime(CollCommonInfo.getUserId(getContext()));
  356 + fragment.getActivity().finish();
445 357 }
446 358 });
447 359  
... ... @@ -453,22 +365,41 @@ public class CollRunMainFragmentView implements MvpView {
453 365 });
454 366 }
455 367  
456   - public void setSQLPauseTime(String id) {
457   - if (needWriteDataFlag) {
458   - //将当前计时器时间戳写入数据库
459   -// String id = MySpHelper.getInstance(getContext(), Context.MODE_MULTI_PROCESS).getString("userId", "");
460   - if (!TextUtils.isEmpty(id)) {
461   - CollUserStepEntity userStepEntity = CollStepUtil.getCollUserStepData(fragment.getActivity(), uid);
462   - if (userStepEntity != null) {
463   - userStepEntity.setPauseTimeStamp(fragment.binding.chronometer.getBase());
464   - //设置当前暂停的时间戳
465   - userStepEntity.setRecordTime(SystemClock.elapsedRealtime());
466   - //更新数据
467   - CollStepUtil.updateStepData(fragment.getActivity(), userStepEntity);
468   - }
469   - }
470   - }
471   - }
  368 +
  369 +// public void setSQLPauseTime(String id) {
  370 +// Log.e(TAG, "setSQLPauseTime: ");
  371 +//// if (needWriteDataFlag) {
  372 +// //将当前计时器时间戳写入数据库
  373 +// if (!TextUtils.isEmpty(id)) {
  374 +// CollUserStepEntity userStepEntity = StepUtil.getCollUserStepData(fragment.getActivity(), uid);
  375 +// if (userStepEntity != null) {
  376 +//// userStepEntity.setChronometerBase(fragment.binding.chronometer.getBase());
  377 +// //设置当前暂停的时间戳
  378 +// userStepEntity.setRecordTime(SystemClock.elapsedRealtime());
  379 +// //设置当前用户暂停的时间戳
  380 +// userStepEntity.setUserPauseTimeStamp(TimeUtil.getNowTimeStamp());
  381 +// //设置暂停次数
  382 +// userStepEntity.setPauseCount(userStepEntity.getPauseCount() + 1);
  383 +// //更新数据
  384 +// StepUtil.updateCollStepData(fragment.getActivity(), userStepEntity);
  385 +// }
  386 +// }
  387 +//// }
  388 +// }
  389 +
  390 +// public void setFragmentPauseTime(String id) {
  391 +// if (!TextUtils.isEmpty(id)) {
  392 +// UserStepEntity userStepEntity = StepUtil.getUserStepData(fragment.getActivity(), uid);
  393 +// if (userStepEntity != null) {
  394 +// userStepEntity.setPauseTimeStamp(fragment.binding.chronometer.getBase());
  395 +// userStepEntity.setRecordTime(SystemClock.elapsedRealtime());
  396 +// //设置当前暂停的时间戳
  397 +// userStepEntity.setUserPauseTimeStamp(TimeUtil.getNowTimeStamp());
  398 +// //更新数据
  399 +// StepUtil.updateStepData(fragment.getActivity(), userStepEntity);
  400 +// }
  401 +// }
  402 +// }
472 403  
473 404  
474 405 /**
... ... @@ -505,7 +436,8 @@ public class CollRunMainFragmentView implements MvpView {
505 436  
506 437 @Override
507 438 public void onReceiveLocation(BDLocation location) {
508   - if (location == null) {
  439 + // map view 销毁后不在处理新接收的位置
  440 + if (location == null || getContext() == null) {
509 441 return;
510 442 }
511 443 //正在搜索GPS信号
... ... @@ -562,7 +494,27 @@ public class CollRunMainFragmentView implements MvpView {
562 494 fragment.binding.ivGps.setBackground(getContext().getResources().getDrawable(R.drawable.rt_training_gps_3));
563 495 }
564 496 }
  497 +
  498 + //进行精度过滤
  499 + if (location.getRadius() > Constant.LOCA_ACCURACY) {
  500 + return;
  501 + }
  502 + //开始比较
565 503 }
  504 +
  505 + }
  506 +
  507 + /**
  508 + * 设置停止状态标志位
  509 + */
  510 + private void setStopStartFlag() {
  511 + CollCommonInfo.setTsRunBaiduTraceService(getContext(), false);
  512 + CollCommonInfo.setIsRunKeepAliveService(getContext(), false);
  513 + CollCommonInfo.setIsWriteUserStep(getContext(), false);
  514 + if (CollStepService.mClient != null) {
  515 + CollStepService.mClient.stopGather(CollStepService.traceListener);
  516 + }
  517 + fragment.getActivity().stopService(new Intent(fragment.getActivity(), CollStepService.class));
566 518 }
567 519  
568 520 public void onDestroy() {
... ... @@ -570,6 +522,82 @@ public class CollRunMainFragmentView implements MvpView {
570 522 mLocClient.stop();
571 523 }
572 524 }
  525 +
  526 + /**
  527 + * 暂存失败数据
  528 + *
  529 + * @param context
  530 + * @param userStepEntity
  531 + * @param runningFinishBean
  532 + */
  533 + public void setFailData(Context context, CollUserStepEntity userStepEntity, RunningFinishBean runningFinishBean) {
  534 + if (userStepEntity == null || runningFinishBean == null || context == null) {
  535 + return;
  536 + }
  537 + //设置数据
  538 + CollFailedEntity failedEntity = new CollFailedEntity();
  539 + //设置主键
  540 + failedEntity.setUuid(CollStepUtil.getUUID());
  541 + //设置用户id
  542 + failedEntity.setUid(userStepEntity.getUserId());
  543 + //设置当前数据创建时间戳
  544 + failedEntity.setCreatTimeStamp(TimeUtil.getNowTimeStamp());
  545 + //设置是否暂停
  546 + if (userStepEntity.getPauseCount() != 0) {
  547 + failedEntity.setIsPause(true);
  548 + //设置暂停时间
  549 + failedEntity.setUserPauseTime(userStepEntity.getUserPauseTimeStamp());
  550 + //设置继续时间戳
  551 + failedEntity.setUsrContinueTime(userStepEntity.getContinueTime());
  552 + } else {
  553 + failedEntity.setIsPause(false);
  554 + }
  555 + //设置用时
  556 + failedEntity.setTime(runningFinishBean.getEmployTime());
  557 + //设置配速
  558 + if ("--".equals(runningFinishBean.getSpeed())) {
  559 + failedEntity.setSpeed("0");
  560 + } else {
  561 + failedEntity.setSpeed(runningFinishBean.getSpeed());
  562 + }
  563 + //设置步数
  564 + if ("--".equals(runningFinishBean.getStep())) {
  565 + failedEntity.setStep("0");
  566 + } else {
  567 + failedEntity.setStep(runningFinishBean.getStep());
  568 + }
  569 + //设置距离
  570 + if ("--".equals(runningFinishBean.getRunDistance())) {
  571 + failedEntity.setDistance("0");
  572 + } else {
  573 + failedEntity.setDistance(runningFinishBean.getRunDistance());
  574 + }
  575 +// //设置开始地点
  576 +// failedEntity.setStartPoint(userStepEntity.getStartPoint());
  577 +// //设置结束地点
  578 +// failedEntity.setEndPoint(userStepEntity.getEndPoint());
  579 + //设置赛道开始时间
  580 + failedEntity.setStreetTraceStartTime(userStepEntity.getQueryTraceStartTime());
  581 + //设置赛道结束时间
  582 + failedEntity.setStreetTraceEndTime(userStepEntity.getQueryTraceEndTime());
  583 + //设置赛道查询实体
  584 + failedEntity.setEntityName(userStepEntity.getQueryEntityName());
  585 + //设置用户开始时间
  586 + failedEntity.setUserStartTime(userStepEntity.getStartTimeStamp());
  587 + //设置用户完成时间
  588 + failedEntity.setUserEndTime(userStepEntity.getFinishTimeStamp());
  589 + //设置关键点
  590 + failedEntity.setImportPoint(userStepEntity.getImportPoint());
  591 + //设置赛事id
  592 + failedEntity.setStreetId(userStepEntity.getStreetId());
  593 + //设置赛事标题
  594 + failedEntity.setStreetTitle(userStepEntity.getStreetTitle());
  595 + //设置是否完成
  596 + failedEntity.setIsArriveEndPoint(userStepEntity.getIsArriveEndPoint());
  597 + //设置数据
  598 +// CollStepUtil.setCollFailData(context, failedEntity);
  599 +
  600 + }
573 601 }
574 602  
575 603  
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollRunRaceDetailFragmentView.java
1 1 package com.cnlive.moudle.collectionTrace.frame.view;
2 2  
3 3 import android.content.Context;
4   -import android.content.Intent;
5 4 import android.graphics.Bitmap;
6 5 import android.graphics.BitmapFactory;
7 6 import android.hardware.Sensor;
8 7 import android.hardware.SensorEvent;
9 8 import android.hardware.SensorEventListener;
10 9 import android.hardware.SensorManager;
11   -import android.support.v4.content.ContextCompat;
12 10 import android.text.TextUtils;
13   -import android.util.Log;
14 11 import android.view.View;
  12 +import android.view.ViewTreeObserver;
15 13 import android.widget.Toast;
16 14  
17 15 import com.baidu.location.BDAbstractLocationListener;
... ... @@ -43,16 +41,13 @@ import com.baidu.mapapi.search.route.RoutePlanSearch;
43 41 import com.baidu.mapapi.search.route.TransitRouteResult;
44 42 import com.baidu.mapapi.search.route.WalkingRoutePlanOption;
45 43 import com.baidu.mapapi.search.route.WalkingRouteResult;
46   -import com.cnlive.moudle.collectionTrace.service.CollKeepLiveService;
47 44 import com.cnlive.moudle.collectionTrace.ui.activity.StartCollectTraceActivity;
48 45 import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunRaceDetailFragment;
49   -import com.cnlive.moudle.pedometer.commonInfo.CollCommonInfo;
  46 +import com.cnlive.moudle.collectionTrace.commonInfo.CollCommonInfo;
50 47 import com.cnlive.moudle.pedometer.model.Constant;
51 48 import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo;
52 49 import com.cnlive.moudle.pedometer.utils.BitmapUtil;
53   -import com.cnlive.moudle.pedometer.utils.GsonUtil;
54   -import com.cnlive.moudle.pedometer.utils.MyMapUtil;
55   -import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil;
  50 +import com.cnlive.moudle.pedometer.utils.ScreenUtil;
56 51 import com.cnlive.moudle.pedometer.utils.TimeUtil;
57 52 import com.cnlive.strike.application.GlideApp;
58 53 import com.example.moudle_pedometer.R;
... ... @@ -118,19 +113,6 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen
118 113 }
119 114 CollCommonInfo.setUserId(getContext(), uid);
120 115 this.runRaceDetailInfo = runRaceDetailInfo;
121   - //初始化地图点位
122   - if (runRaceDetailInfo.getLatLongitude() != null) {
123   -// Log.e(TAG, "initView: 长度:" + runRaceDetailInfo.getLatLongitude().length());
124   - trackPoints = GsonUtil.jsonToList(runRaceDetailInfo.getLatLongitude(), LatLng.class);
125   -// Log.e(TAG, "initView: trackPoints" + trackPoints.size());
126   -// MyMapUtil.drawServerLineTrack(getContext(), baiduMap, trackPoints, SortType.asc, R.color.green_round, R.drawable.icon_start, R.drawable.icon_end);
127   -// //自动计算地图缩放
128   - MapStatus.Builder builder = new MapStatus.Builder();
129   - builder.target(MyMapUtil.getCenterZoomPosition(trackPoints));
130   - builder.zoom(MyMapUtil.getZoom(trackPoints));
131   - baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
132   - }
133   -
134 116 //显示地图
135 117 fragment.binding.mapView.setVisibility(View.VISIBLE);
136 118 //隐藏底部滑动卡片
... ... @@ -153,6 +135,22 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen
153 135 if (!TextUtils.isEmpty(runRaceDetailInfo.getTitle())) {
154 136 fragment.binding.includeStreet.tvRaceTitle.setText(runRaceDetailInfo.getTitle());
155 137 }
  138 + fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(), 140));
  139 +// //根据标题行数,自动调整卡片大小
  140 + fragment.binding.includeStreet.tvRaceTitle.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
  141 + @Override
  142 + public boolean onPreDraw() {
  143 + int line = fragment.binding.includeStreet.tvRaceTitle.getLineCount();
  144 + int height = fragment.binding.includeStreet.tvRaceTitle.getHeight();
  145 + if (line > 1) {
  146 + int avgHeight = height / line;//平局高度
  147 + fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(), 140) + avgHeight * (line - 1));
  148 +
  149 + }
  150 + fragment.binding.includeStreet.tvRaceTitle.getViewTreeObserver().removeOnPreDrawListener(this);
  151 + return false;
  152 + }
  153 + });
156 154 //设置活动地点
157 155 if (!TextUtils.isEmpty(runRaceDetailInfo.getAddress())) {
158 156 fragment.binding.includeStreet.tvAddress.setText(runRaceDetailInfo.getAddress());
... ... @@ -196,10 +194,12 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen
196 194  
197 195 }
198 196 //添加轨迹按钮点击事件
199   - fragment.binding.btnAddTrace.setOnClickListener(new View.OnClickListener() {
  197 + fragment.binding.rlScrollViewAddTrace.setOnClickListener(new View.OnClickListener() {
200 198 @Override
201 199 public void onClick(View view) {
202   - StartCollectTraceActivity.startActivity(fragment.getActivity());
  200 + if (null != runRaceDetailInfo) {
  201 + StartCollectTraceActivity.startActivity(fragment.getActivity(), runRaceDetailInfo);
  202 + }
203 203 }
204 204 });
205 205  
... ... @@ -209,7 +209,7 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen
209 209  
210 210 public void initMap() {
211 211 //隐藏底部滑动卡片
212   - fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
  212 +// fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
213 213 this.mMapView = fragment.binding.mapView;
214 214 if (baiduMap == null) {
215 215 baiduMap = mMapView.getMap();
... ... @@ -643,7 +643,7 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen
643 643 //显示空视图
644 644 fragment.binding.emptyLayout.setVisibility(View.VISIBLE);
645 645 //隐藏底部卡片
646   - fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
  646 +// fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
647 647 if (fragment.binding.emptyLayout == null) return;
648 648 String titleText = "";
649 649 String detailText = "";
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollRunningMapFragmentView.java
... ... @@ -7,8 +7,8 @@ import android.hardware.Sensor;
7 7 import android.hardware.SensorEvent;
8 8 import android.hardware.SensorEventListener;
9 9 import android.hardware.SensorManager;
10   -import android.os.Handler;
11 10 import android.os.SystemClock;
  11 +import android.text.TextUtils;
12 12 import android.util.Log;
13 13 import android.view.MotionEvent;
14 14 import android.view.View;
... ... @@ -32,15 +32,18 @@ import com.baidu.mapapi.map.Overlay;
32 32 import com.baidu.mapapi.map.UiSettings;
33 33 import com.baidu.mapapi.model.LatLng;
34 34 import com.baidu.mapapi.utils.DistanceUtil;
35   -import com.baidu.trace.model.SortType;
36 35 import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunningMapFragment;
  36 +import com.cnlive.moudle.collectionTrace.commonInfo.CollCommonInfo;
37 37 import com.cnlive.moudle.pedometer.model.Constant;
38   -import com.cnlive.moudle.pedometer.model.RunningMapBean;
39   -import com.cnlive.moudle.pedometer.ui.fragment.RunningMapFragment;
  38 +import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo;
  39 +import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity;
40 40 import com.cnlive.moudle.pedometer.utils.BitmapUtil;
41 41 import com.cnlive.moudle.pedometer.utils.ButtonAnimUtil;
42   -import com.cnlive.moudle.pedometer.utils.CollStepUtil;
  42 +import com.cnlive.moudle.collectionTrace.utils.CollStepUtil;
  43 +import com.cnlive.moudle.pedometer.utils.GsonUtil;
43 44 import com.cnlive.moudle.pedometer.utils.MyMapUtil;
  45 +import com.cnlive.moudle.pedometer.utils.StepUtil;
  46 +import com.cnlive.moudle.pedometer.utils.TimeUtil;
44 47 import com.example.moudle_pedometer.R;
45 48 import com.hannesdorfmann.mosby3.mvp.MvpView;
46 49  
... ... @@ -71,9 +74,12 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener
71 74 public MyLocationListenner myListener = new MyLocationListenner();
72 75 private final int DEFULT_ZOOM = 17;
73 76 private boolean isFirstLoadMap = true;
74   - private List<LatLng> trackPoints;
75 77 private Overlay currentLine;
76 78 private List<LatLng> currentPoints;
  79 + private CollUserStepEntity userStepEntity;
  80 + private String uid;
  81 + private RunRaceDetailInfo runRaceDetailInfo;
  82 + private List<Overlay> overlays;
77 83  
78 84 public CollRunningMapFragmentView(CollRunningMapFragment fragment) {
79 85 this.fragment = fragment;
... ... @@ -83,9 +89,139 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener
83 89 return fragment == null ? null : fragment.getActivity();
84 90 }
85 91  
86   - public void initView(List<LatLng> trackPoints) {
  92 + public void initView(RunRaceDetailInfo runRaceDetailInfo) {
87 93 currentPoints = new ArrayList<>();
88   - this.trackPoints = trackPoints;
  94 + this.runRaceDetailInfo = runRaceDetailInfo;
  95 + uid = CollCommonInfo.getUserId(getContext());
  96 + userStepEntity = CollStepUtil.getCollUserStepData(getContext(), uid);
  97 + //在地图上显示起点
  98 +
  99 + //设置数据
  100 + if (userStepEntity != null) {
  101 + //设置赛事标题
  102 + if (TextUtils.isEmpty(userStepEntity.getStreetTitle())) {
  103 + CollStepUtil.setCollStreetTitle(getContext(), CollCommonInfo.getUserId(getContext()), runRaceDetailInfo.getTitle());
  104 + }
  105 + //设置开始时间和赛事id
  106 + if (TextUtils.isEmpty(userStepEntity.getStreetId())) {
  107 + CollStepUtil.setCollStepStartData(getContext(), uid, TimeUtil.getNowTimeStamp(), CollCommonInfo.getStreetId(getContext()));
  108 + }
  109 + //设置步数
  110 + if (!TextUtils.isEmpty(userStepEntity.getStepCount())) {
  111 + //设置行走公里
  112 + fragment.binding.tvCurrentDiatance.setText(CollStepUtil.getWalkDistanceKM(Long.parseLong(userStepEntity.getStepCount())) + "");
  113 + }
  114 + //设置是否需要设置起点信息
  115 + if (TextUtils.isEmpty(userStepEntity.getCollStartLatLng())||TextUtils.isEmpty(userStepEntity.getCollStartLatLngName())) {
  116 + //开始设置
  117 + if (!TextUtils.isEmpty(runRaceDetailInfo.getCollStartLatLng()) && !TextUtils.isEmpty(runRaceDetailInfo.getCollStartLntLngName())) {
  118 + CollStepUtil.setCollStartPointData(getContext(), uid, runRaceDetailInfo.getCollStartLntLngName(), runRaceDetailInfo.getCollStartLatLng());
  119 + }
  120 + }
  121 + initChrom();
  122 + //初始化起点
  123 + overlays = new ArrayList<>();
  124 + //打起点
  125 + if (!TextUtils.isEmpty(userStepEntity.getCollStartLatLng())) {
  126 + LatLng startLatLng = GsonUtil.GsonToBean(userStepEntity.getCollStartLatLng(), LatLng.class);
  127 + if (null != startLatLng) {
  128 + List<Overlay> resultOverlays = MyMapUtil.setStartMarker(getContext(), baiduMap, startLatLng, R.drawable.icon_start);
  129 + if (null != resultOverlays) {
  130 + this.overlays.addAll(resultOverlays);
  131 + }
  132 + }
  133 + }
  134 + }
  135 + //返回键
  136 + fragment.binding.flBack.setOnTouchListener(new View.OnTouchListener() {
  137 + @Override
  138 + public boolean onTouch(View view, MotionEvent motionEvent) {
  139 + Log.e(TAG, "onTouch: " + motionEvent.getAction());
  140 + if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
  141 + ButtonAnimUtil.setViewZoomIn(fragment.binding.flBack);
  142 + } else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
  143 + ButtonAnimUtil.setViewZoomOut(fragment.binding.flBack);
  144 + }
  145 + return false;
  146 + }
  147 + });
  148 + //返回键点击事件
  149 + fragment.binding.flBack.setOnClickListener(new View.OnClickListener() {
  150 + @Override
  151 + public void onClick(View view) {
  152 + fragment.getActivity().finish();
  153 + }
  154 + });
  155 + //重新定位
  156 + fragment.binding.flLocation.setOnTouchListener(new View.OnTouchListener() {
  157 + @Override
  158 + public boolean onTouch(View view, MotionEvent motionEvent) {
  159 + if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
  160 + ButtonAnimUtil.setViewZoomIn(fragment.binding.flLocation);
  161 + } else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
  162 + ButtonAnimUtil.setViewZoomOut(fragment.binding.flLocation);
  163 + }
  164 + return false;
  165 + }
  166 + });
  167 + //重新定位功能
  168 + fragment.binding.flLocation.setOnClickListener(new View.OnClickListener() {
  169 + @Override
  170 + public void onClick(View view) {
  171 + mLocClient.restart();
  172 + isFirstLoc = true;
  173 + }
  174 + });
  175 +
  176 + }
  177 +
  178 + private void initChrom() {
  179 + //设置计时监听
  180 + fragment.binding.chronometer.setOnChronometerTickListener(new Chronometer.OnChronometerTickListener() {
  181 + @Override
  182 + public void onChronometerTick(Chronometer chronometer) {
  183 + int hour = (int) ((SystemClock.elapsedRealtime() - chronometer.getBase()) / 1000 / 60 / 60);
  184 + int minute = (int) ((SystemClock.elapsedRealtime() - chronometer.getBase()) / 1000 / 60) % 60;
  185 + int second = (int) ((SystemClock.elapsedRealtime() - chronometer.getBase()) / 1000) % 60;
  186 + if (hour < 1) {
  187 + if (minute == 59 && second == 59) {
  188 + chronometer.setFormat("0" + "%s");
  189 + } else {
  190 + chronometer.setFormat("0" + String.valueOf(hour) + ":%s");
  191 + }
  192 + } else if (hour < 10) {
  193 + chronometer.setFormat("0" + "%s");
  194 + } else {
  195 + chronometer.setFormat("%s");
  196 + }
  197 +
  198 + }
  199 + });
  200 +
  201 + if (userStepEntity != null) {
  202 + //没有暂停,从初始时间开始
  203 + if (userStepEntity.getChronometerBase() != 0) {
  204 + fragment.binding.chronometer.setBase(userStepEntity.getChronometerBase());
  205 + } else {
  206 + fragment.binding.chronometer.setFormat("00:00:01");
  207 + fragment.binding.chronometer.setBase(SystemClock.elapsedRealtime());
  208 + //设置计步开始时间
  209 + CollStepUtil.setCollChronometerBase(getContext(), uid, fragment.binding.chronometer.getBase());
  210 + }
  211 + fragment.binding.chronometer.start();
  212 +
  213 + }
  214 + //没有数据
  215 + else {
  216 + fragment.binding.chronometer.setFormat("00:00:01");
  217 + fragment.binding.chronometer.setBase(SystemClock.elapsedRealtime());
  218 + //设置计步开始时间
  219 + CollStepUtil.setCollChronometerBase(getContext(), uid, fragment.binding.chronometer.getBase());
  220 + fragment.binding.chronometer.start();
  221 + }
  222 + }
  223 +
  224 + public void initMap() {
89 225 this.mMapView = fragment.binding.mapView;
90 226 if (baiduMap == null) {
91 227 baiduMap = mMapView.getMap();
... ... @@ -156,67 +292,8 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener
156 292 baiduMap.setOnMapLoadedCallback(new BaiduMap.OnMapLoadedCallback() {
157 293 @Override
158 294 public void onMapLoaded() {
159   - //自动计算地图缩放
160   - MapStatus.Builder builder = new MapStatus.Builder();
161   - builder.target(MyMapUtil.getCenterZoomPosition(trackPoints));
162   - builder.zoom(MyMapUtil.getZoom(trackPoints));
163   - baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
164   - if (isFirstLoadMap) {
165   - isFirstLoadMap = false;
166   - new Handler().postDelayed(new Runnable() {
167   - @Override
168   - public void run() {
169   - //绘制赛道轨迹
170   - if (getContext() == null) {
171   - return;
172   - }
173   - MyMapUtil.drawServerLineTrack(getContext(), baiduMap, trackPoints, SortType.asc, R.color.green_50, R.drawable.icon_start, R.drawable.icon_end);
174   - }
175   - }, 1500);
176   - }
177   - }
178   - });
179   - //返回键
180   - fragment.binding.flBack.setOnTouchListener(new View.OnTouchListener() {
181   - @Override
182   - public boolean onTouch(View view, MotionEvent motionEvent) {
183   - Log.e(TAG, "onTouch: " + motionEvent.getAction());
184   - if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
185   - ButtonAnimUtil.setViewZoomIn(fragment.binding.flBack);
186   - } else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
187   - ButtonAnimUtil.setViewZoomOut(fragment.binding.flBack);
188   - }
189   - return false;
190   - }
191   - });
192   - //返回键点击事件
193   - fragment.binding.flBack.setOnClickListener(new View.OnClickListener() {
194   - @Override
195   - public void onClick(View view) {
196   - fragment.getActivity().finish();
197   - }
198   - });
199   - //重新定位
200   - fragment.binding.flLocation.setOnTouchListener(new View.OnTouchListener() {
201   - @Override
202   - public boolean onTouch(View view, MotionEvent motionEvent) {
203   - if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
204   - ButtonAnimUtil.setViewZoomIn(fragment.binding.flLocation);
205   - } else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
206   - ButtonAnimUtil.setViewZoomOut(fragment.binding.flLocation);
207   - }
208   - return false;
209 295 }
210 296 });
211   - //重新定位功能
212   - fragment.binding.flLocation.setOnClickListener(new View.OnClickListener() {
213   - @Override
214   - public void onClick(View view) {
215   - mLocClient.restart();
216   - isFirstLoc = true;
217   - }
218   - });
219   -
220 297 }
221 298  
222 299  
... ... @@ -322,6 +399,9 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener
322 399 MapStatus.Builder builder = new MapStatus.Builder();
323 400 //不是第一次定位状态
324 401 if (!isFirstLoc) {
  402 + baiduMap.setMyLocationData(mylocation);
  403 + builder.target(new LatLng(mylocation.latitude, mylocation.longitude)).zoom(DEFULT_ZOOM);
  404 + baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
325 405 if (currentPoints.size() > 0) {
326 406 //进行判断
327 407 LatLng lastLatLng = currentPoints.get(currentPoints.size() - 1);
... ... @@ -356,44 +436,24 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener
356 436 }
357 437  
358 438  
359   - /**
360   - * 同步计时器
361   - */
362   - public void updateChronometer(RunningMapBean runningMapBean) {
363   - //设置计时监听
364   - fragment.binding.chronometer.setOnChronometerTickListener(new Chronometer.OnChronometerTickListener() {
365   - @Override
366   - public void onChronometerTick(Chronometer chronometer) {
367   - int hour = (int) ((SystemClock.elapsedRealtime() - chronometer.getBase()) / 1000 / 60 / 60);
368   - int minute = (int) ((SystemClock.elapsedRealtime() - chronometer.getBase()) / 1000 / 60) % 60;
369   - int second = (int) ((SystemClock.elapsedRealtime() - chronometer.getBase()) / 1000) % 60;
370   - if (hour < 1) {
371   - if (minute == 59 && second == 59) {
372   - chronometer.setFormat("0" + "%s");
373   - } else {
374   - chronometer.setFormat("0" + String.valueOf(hour) + ":%s");
375   - }
376   - } else if (hour < 10) {
377   - chronometer.setFormat("0" + "%s");
378   - } else {
379   - chronometer.setFormat("%s");
380   - }
381   -
382   - }
383   - });
384   - fragment.binding.chronometer.setBase(runningMapBean.getTimeBase() + (SystemClock.elapsedRealtime() - runningMapBean.getRecordTime()));
385   - //判断是否点击暂停按钮
386   - if (runningMapBean.isPause()) {
387   - //点击暂停按钮,那么就只显示文本
388   - fragment.binding.chronometer.setText(runningMapBean.getPauseShowTime());
389   - } else {
390   - fragment.binding.chronometer.start();
391   - }
392   - //设置速度
393   - fragment.binding.tvCurrentSpeed.setText(runningMapBean.getCurrentSpeed());
394   - //设置距离
395   - fragment.binding.tvCurrentDiatance.setText(runningMapBean.getDistance());
396   - }
  439 +// /**
  440 +// * 同步计时器
  441 +// */
  442 +// public void updateChronometer(RunningMapBean runningMapBean) {
  443 +//
  444 +// fragment.binding.chronometer.setBase(runningMapBean.getTimeBase() + (SystemClock.elapsedRealtime() - runningMapBean.getRecordTime()));
  445 +// //判断是否点击暂停按钮
  446 +// if (runningMapBean.isPause()) {
  447 +// //点击暂停按钮,那么就只显示文本
  448 +// fragment.binding.chronometer.setText(runningMapBean.getPauseShowTime());
  449 +// } else {
  450 +// fragment.binding.chronometer.start();
  451 +// }
  452 +// //设置速度
  453 +// fragment.binding.tvCurrentSpeed.setText(runningMapBean.getCurrentSpeed());
  454 +// //设置距离
  455 +// fragment.binding.tvCurrentDiatance.setText(runningMapBean.getDistance());
  456 +// }
397 457  
398 458 /**
399 459 * 更新行走距离
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/StartTraceFragmentView.java
... ... @@ -27,18 +27,18 @@ import com.baidu.mapapi.map.MyLocationConfiguration;
27 27 import com.baidu.mapapi.map.MyLocationData;
28 28 import com.baidu.mapapi.map.UiSettings;
29 29 import com.baidu.mapapi.model.LatLng;
30   -import com.baidu.mapapi.search.route.RoutePlanSearch;
31 30 import com.cnlive.moudle.collectionTrace.service.CollKeepLiveService;
32   -import com.cnlive.moudle.collectionTrace.ui.activity.CollPedometerMainActivity;
33   -import com.cnlive.moudle.collectionTrace.ui.activity.CollRunRaceDetailActivity;
34   -import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunRaceDetailFragment;
  31 +import com.cnlive.moudle.collectionTrace.service.CollStepService;
  32 +import com.cnlive.moudle.collectionTrace.ui.activity.CollRunningMapActivity;
35 33 import com.cnlive.moudle.collectionTrace.ui.fragment.StartTraceFragment;
36   -import com.cnlive.moudle.pedometer.commonInfo.CollCommonInfo;
  34 +import com.cnlive.moudle.collectionTrace.commonInfo.CollCommonInfo;
37 35 import com.cnlive.moudle.pedometer.model.Constant;
  36 +import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo;
38 37 import com.cnlive.moudle.pedometer.ui.widget.SelectDialog;
39   -import com.cnlive.moudle.pedometer.ui.widget.TipDialog;
40 38 import com.cnlive.moudle.pedometer.utils.BitmapUtil;
  39 +import com.cnlive.moudle.pedometer.utils.GsonUtil;
41 40 import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil;
  41 +import com.cnlive.moudle.pedometer.utils.ServiceUtils;
42 42 import com.cnlive.moudle.pedometer.utils.TimeUtil;
43 43 import com.example.moudle_pedometer.R;
44 44 import com.hannesdorfmann.mosby3.mvp.MvpView;
... ... @@ -53,7 +53,7 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener {
53 53 private static int accuracyCircleFillColor;
54 54 private static int accuracyCircleStrokeColor;
55 55 private static MyLocationData followMyLocation;
56   - private LatLng firstLatLng;
  56 + private LatLng currentLatLng;
57 57 private Double lastX = 0.0;
58 58 private int mCurrentDirection = 0;
59 59 private float mCurrentAccracy;
... ... @@ -65,6 +65,7 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener {
65 65 private String currentAddress;
66 66 private SelectDialog selectDialog;
67 67 private boolean isShowFollowAddress = false;//是否显示跟随地址
  68 + public RunRaceDetailInfo runRaceDetailInfo;
68 69  
69 70 public StartTraceFragmentView(StartTraceFragment fragment) {
70 71 this.fragment = fragment;
... ... @@ -74,7 +75,8 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener {
74 75 return fragment == null ? null : fragment.getActivity();
75 76 }
76 77  
77   - public void initView() {
  78 + public void initView(RunRaceDetailInfo runRaceDetailInfo) {
  79 + this.runRaceDetailInfo = runRaceDetailInfo;
78 80 if (getContext() == null) {
79 81 return;
80 82 }
... ... @@ -90,9 +92,13 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener {
90 92 public void onClick(SelectDialog dialog) {
91 93 dialog.dismiss();
92 94 isShowFollowAddress = false;
  95 + //设置运营起点
  96 + runRaceDetailInfo.setCollStartLatLng(GsonUtil.GsonString(currentLatLng));
  97 + //设置起点名称
  98 + runRaceDetailInfo.setCollStartLntLngName(currentAddress);
93 99 //开启计步服务
94   - startStepService(getContext());
95   -
  100 +// startStepService(getContext());
  101 + checkBaiduServiceState();
96 102 }
97 103 });
98 104 selectDialog.setCancelable(false);
... ... @@ -112,13 +118,14 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener {
112 118 }
113 119 }
114 120 });
  121 +
115 122 }
116 123  
117 124 /**
118 125 * 启动计步服务
119 126 */
120 127 public void startStepService(Context context) {
121   - CollCommonInfo.setIsFirstStepSendTraceTip(getContext(),true);
  128 + CollCommonInfo.setIsFirstStepSendTraceTip(getContext(), true);
122 129 QMUITipDialogUtil.loadingDialog(getContext(), "请稍后", false);
123 130 if (CollCommonInfo.getStepStartTime(context) == 0) {
124 131 CollCommonInfo.setStepStartTime(context, TimeUtil.getNowTimeStamp());
... ... @@ -132,6 +139,33 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener {
132 139  
133 140 }
134 141  
  142 + private void checkBaiduServiceState() {
  143 + boolean isRunBaidu = CollCommonInfo.getIsRunBaiduTraceService(getContext());
  144 + //要运行百度
  145 + if (isRunBaidu) {
  146 + //判断百度服务是否运行
  147 + if (!ServiceUtils.isServiceRunning(getContext(), "com.baidu.trace.LBSTraceService")) {
  148 + stopStepService();
  149 + startStepService(getContext());
  150 + } else {
  151 + CollRunningMapActivity.startActivity(fragment.getActivity(), runRaceDetailInfo);
  152 + }
  153 + } else {
  154 + CollRunningMapActivity.startActivity(fragment.getActivity(), runRaceDetailInfo);
  155 + }
  156 + }
  157 +
  158 + private void stopStepService() {
  159 + CollCommonInfo.setTsRunBaiduTraceService(getContext(), false);
  160 + CollCommonInfo.setIsRunKeepAliveService(getContext(), false);
  161 + CollCommonInfo.setIsWriteUserStep(getContext(), false);
  162 + CollCommonInfo.setIsFirstStepSendTraceTip(getContext(), true);
  163 + if (CollStepService.mClient != null) {
  164 + CollStepService.mClient.stopGather(CollStepService.traceListener);
  165 + }
  166 + fragment.getActivity().stopService(new Intent(fragment.getActivity(), CollStepService.class));
  167 + }
  168 +
135 169 /**
136 170 * 初始化地图
137 171 */
... ... @@ -224,12 +258,12 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener {
224 258 double x = sensorEvent.values[SensorManager.DATA_X];
225 259 if (Math.abs(x - lastX) > 1.0) {
226 260 mCurrentDirection = (int) x;
227   - if (firstLatLng != null) {
  261 + if (currentLatLng != null) {
228 262 followMyLocation = new MyLocationData.Builder()
229 263 .accuracy(mCurrentAccracy)
230 264 // 此处设置开发者获取到的方向信息,顺时针0-360
231   - .direction(mCurrentDirection).latitude(firstLatLng.latitude)
232   - .longitude(firstLatLng.longitude).build();
  265 + .direction(mCurrentDirection).latitude(currentLatLng.latitude)
  266 + .longitude(currentLatLng.longitude).build();
233 267 baiduMap.setMyLocationData(followMyLocation);
234 268 }
235 269 }
... ... @@ -269,6 +303,7 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener {
269 303 // 此处设置开发者获取到的方向信息,顺时针0-360
270 304 .direction(location.getDirection()).latitude(location.getLatitude())
271 305 .longitude(location.getLongitude()).build();
  306 +// currentAddress = location.getAddrStr();
272 307 currentAddress = location.getLocationDescribe();
273 308 if (selectDialog != null && selectDialog.isShowing()) {
274 309 selectDialog.setTipMessage(currentAddress);
... ... @@ -287,10 +322,10 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener {
287 322  
288 323 // if (isFirstLoc) {
289 324 // isFirstLoc = false;
290   - firstLatLng = new LatLng(location.getLatitude(),
  325 + currentLatLng = new LatLng(location.getLatitude(),
291 326 location.getLongitude());
292 327 baiduMap.setMyLocationData(followMyLocation);
293   - builder.target(firstLatLng).zoom(DEFULT_ZOOM);
  328 + builder.target(currentLatLng).zoom(DEFULT_ZOOM);
294 329 baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
295 330  
296 331 }
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/model/CollectPoint.java 0 → 100644
  1 +package com.cnlive.moudle.collectionTrace.model;
  2 +
  3 +import com.baidu.mapapi.model.LatLng;
  4 +
  5 +public class CollectPoint {
  6 + private double lat;
  7 + private double lng;
  8 + private String pointName;
  9 +
  10 + public double getLat() {
  11 + return lat;
  12 + }
  13 +
  14 + public void setLat(double lat) {
  15 + this.lat = lat;
  16 + }
  17 +
  18 + public double getLng() {
  19 + return lng;
  20 + }
  21 +
  22 + public void setLng(double lng) {
  23 + this.lng = lng;
  24 + }
  25 +
  26 + public String getPointName() {
  27 + return pointName;
  28 + }
  29 +
  30 + public void setPointName(String pointName) {
  31 + this.pointName = pointName;
  32 + }
  33 +}
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/receivers/CollServiceReceiver.java
... ... @@ -10,7 +10,7 @@ import android.util.Log;
10 10  
11 11 import com.cnlive.moudle.collectionTrace.service.CollKeepLiveService;
12 12 import com.cnlive.moudle.collectionTrace.service.CollStepService;
13   -import com.cnlive.moudle.pedometer.commonInfo.CollCommonInfo;
  13 +import com.cnlive.moudle.collectionTrace.commonInfo.CollCommonInfo;
14 14 import com.cnlive.moudle.pedometer.utils.ServiceUtils;
15 15  
16 16  
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/service/CollKeepLiveService.java
... ... @@ -18,7 +18,7 @@ import android.support.v4.app.NotificationCompat;
18 18 import android.util.Log;
19 19  
20 20 import com.cnlive.moudle.collectionTrace.receivers.CollServiceReceiver;
21   -import com.cnlive.moudle.pedometer.commonInfo.CollCommonInfo;
  21 +import com.cnlive.moudle.collectionTrace.commonInfo.CollCommonInfo;
22 22 import com.cnlive.moudle.pedometer.utils.ServiceUtils;
23 23 import com.example.moudle_pedometer.R;
24 24  
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/service/CollStepService.java
... ... @@ -28,22 +28,6 @@ import android.widget.Toast;
28 28  
29 29 import com.baidu.trace.LBSTraceClient;
30 30 import com.baidu.trace.Trace;
31   -import com.baidu.trace.api.fence.AddMonitoredPersonResponse;
32   -import com.baidu.trace.api.fence.CreateFenceResponse;
33   -import com.baidu.trace.api.fence.DeleteFenceResponse;
34   -import com.baidu.trace.api.fence.DeleteMonitoredPersonResponse;
35   -import com.baidu.trace.api.fence.FenceAlarmPushInfo;
36   -import com.baidu.trace.api.fence.FenceListResponse;
37   -import com.baidu.trace.api.fence.HistoryAlarmResponse;
38   -import com.baidu.trace.api.fence.ListMonitoredPersonResponse;
39   -import com.baidu.trace.api.fence.MonitoredAction;
40   -import com.baidu.trace.api.fence.MonitoredStatus;
41   -import com.baidu.trace.api.fence.MonitoredStatusByLocationResponse;
42   -import com.baidu.trace.api.fence.MonitoredStatusInfo;
43   -import com.baidu.trace.api.fence.MonitoredStatusRequest;
44   -import com.baidu.trace.api.fence.MonitoredStatusResponse;
45   -import com.baidu.trace.api.fence.OnFenceListener;
46   -import com.baidu.trace.api.fence.UpdateFenceResponse;
47 31 import com.baidu.trace.api.track.LatestPoint;
48 32 import com.baidu.trace.api.track.LatestPointResponse;
49 33 import com.baidu.trace.api.track.OnTrackListener;
... ... @@ -51,22 +35,16 @@ import com.baidu.trace.model.LocationMode;
51 35 import com.baidu.trace.model.OnTraceListener;
52 36 import com.baidu.trace.model.PushMessage;
53 37 import com.baidu.trace.model.StatusCodes;
54   -import com.cnlive.moudle.pedometer.commonInfo.CollCommonInfo;
55   -import com.cnlive.moudle.pedometer.commonInfo.CommonInfo;
  38 +import com.cnlive.moudle.collectionTrace.commonInfo.CollCommonInfo;
56 39 import com.cnlive.moudle.pedometer.model.Constant;
57 40 import com.cnlive.moudle.pedometer.model.MessageEvent;
58 41 import com.cnlive.moudle.pedometer.model.step.StepCount;
59 42 import com.cnlive.moudle.pedometer.model.step.StepValuePassListener;
60   -import com.cnlive.moudle.pedometer.service.KeepLiveService;
61   -import com.cnlive.moudle.pedometer.service.StepService;
62   -import com.cnlive.moudle.pedometer.sql.dao.CollUserStepEntityDao;
63 43 import com.cnlive.moudle.pedometer.sql.db.DbCore;
64 44 import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity;
65   -import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity;
66 45 import com.cnlive.moudle.pedometer.ui.activity.PedometerMainActivity;
  46 +import com.cnlive.moudle.collectionTrace.utils.CollStepUtil;
67 47 import com.cnlive.moudle.pedometer.utils.ServiceUtils;
68   -import com.cnlive.moudle.pedometer.utils.StepUtil;
69   -import com.cnlive.moudle.pedometer.utils.TimeUtil;
70 48 import com.example.moudle_pedometer.R;
71 49  
72 50 import org.greenrobot.eventbus.EventBus;
... ... @@ -74,11 +52,7 @@ import org.greenrobot.eventbus.Subscribe;
74 52 import org.greenrobot.eventbus.ThreadMode;
75 53  
76 54 import java.text.SimpleDateFormat;
77   -import java.util.ArrayList;
78 55 import java.util.Date;
79   -import java.util.List;
80   -import java.util.UUID;
81   -
82 56  
83 57 public class CollStepService extends Service implements SensorEventListener {
84 58  
... ... @@ -182,9 +156,9 @@ public class CollStepService extends Service implements SensorEventListener {
182 156 initBroadcastReceiver();
183 157 if (!ServiceUtils.isServiceRunning(getApplicationContext(), "com.cnlive.moudle.pedometer.service.CollKeepLiveService")) {
184 158 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
185   - startForegroundService(new Intent(getApplicationContext(), KeepLiveService.class));
  159 + startForegroundService(new Intent(getApplicationContext(), CollKeepLiveService.class));
186 160 } else {
187   - startService(new Intent(getApplicationContext(), KeepLiveService.class));
  161 + startService(new Intent(getApplicationContext(), CollKeepLiveService.class));
188 162 }
189 163 }
190 164 showStartForegroundNotification();
... ... @@ -439,7 +413,7 @@ public class CollStepService extends Service implements SensorEventListener {
439 413 //说明用户没有动
440 414 if (!updateSpeedStepFlag) {
441 415 //重置速度
442   - EventBus.getDefault().post(new MessageEvent(Constant.SERVICE_STEP_COUNT_RESET_SPEED, CURRENT_STEP));
  416 + EventBus.getDefault().post(new MessageEvent(Constant.COLL_SERVICE_STEP_COUNT_RESET_SPEED, CURRENT_STEP));
443 417 }
444 418 }
445 419 };
... ... @@ -520,14 +494,14 @@ public class CollStepService extends Service implements SensorEventListener {
520 494 //接收事件
521 495 @Subscribe(threadMode = ThreadMode.BACKGROUND)
522 496 public void Event(MessageEvent messageEvent) {
523   - //暂停计步
524   - if (messageEvent.getMessageType() == Constant.SERVICE_STEP_COUNT_PAUSE) {
525   - pauseFlag = true;
526   - }
527   - //继续计步
528   - else if (messageEvent.getMessageType() == Constant.SERVICE_STEP_COUNT_CONTINUE) {
529   - pauseFlag = false;
530   - }
  497 +// //暂停计步
  498 +// if (messageEvent.getMessageType() == Constant.SERVICE_STEP_COUNT_PAUSE) {
  499 +// pauseFlag = true;
  500 +// }
  501 +// //继续计步
  502 +// else if (messageEvent.getMessageType() == Constant.SERVICE_STEP_COUNT_CONTINUE) {
  503 +// pauseFlag = false;
  504 +// }
531 505 }
532 506  
533 507 /**
... ... @@ -577,7 +551,7 @@ public class CollStepService extends Service implements SensorEventListener {
577 551 return;
578 552 }
579 553 //获取当天的数据,用于展示 CURRENT_DATE
580   - CollUserStepEntity userStepEntity = StepUtil.getCollUserStepData(getApplicationContext(), CollCommonInfo.getUserId(getApplicationContext()));
  554 + CollUserStepEntity userStepEntity = CollStepUtil.getCollUserStepData(getApplicationContext(), CollCommonInfo.getUserId(getApplicationContext()));
581 555 if (userStepEntity == null) {
582 556 CURRENT_STEP = 0;
583 557 } else {
... ... @@ -594,7 +568,7 @@ public class CollStepService extends Service implements SensorEventListener {
594 568  
595 569 private void updateNotification() {
596 570 // Log.e(TAG, "updateNotification: 当前步数:" + CURRENT_STEP);
597   - EventBus.getDefault().post(new MessageEvent(Constant.SERVICE_STEP_COUNT_UPDATE, CURRENT_STEP));
  571 + EventBus.getDefault().post(new MessageEvent(Constant.COLL_SERVICE_STEP_COUNT_UPDATE, CURRENT_STEP));
598 572 updateSpeedStepFlag = false;
599 573 // remoteViews = new RemoteViews(getPackageName(), R.layout.custom_step_notification);
600 574 // NotificationChannel channel = null;
... ... @@ -954,16 +928,16 @@ public class CollStepService extends Service implements SensorEventListener {
954 928 */
955 929 private void save() {
956 930 int tempStep = CURRENT_STEP;
957   - UserStepEntity userStepEntity = StepUtil.getUserStepData(getApplicationContext(), CollCommonInfo.getUserId(getApplicationContext()));
  931 + CollUserStepEntity userStepEntity = CollStepUtil.getCollUserStepData(getApplicationContext(), CollCommonInfo.getUserId(getApplicationContext()));
958 932 if (userStepEntity == null) {
959   - UserStepEntity data = new UserStepEntity();
  933 + CollUserStepEntity data = new CollUserStepEntity();
960 934 data.setUserId(userId);
961 935 data.setDate(CURRENT_DATE);
962 936 data.setStepCount(tempStep + "");
963   - StepUtil.insertStepData(getApplicationContext(), data);
  937 + CollStepUtil.insertCollStepData(getApplicationContext(), data);
964 938 } else {
965 939 userStepEntity.setStepCount(tempStep + "");
966   - StepUtil.updateStepData(getApplicationContext(), userStepEntity);
  940 + CollStepUtil.updateCollStepData(getApplicationContext(), userStepEntity);
967 941 }
968 942 }
969 943  
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/CollPedometerMainActivity.java
... ... @@ -18,6 +18,7 @@ import com.alibaba.android.arouter.facade.annotation.Route;
18 18 import com.cnlive.libs.base.ui.QMUIFragmentActivity;
19 19 import com.cnlive.libs.base.util.StatusBarUtil2;
20 20 import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunMainFragment;
  21 +import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo;
21 22 import com.cnlive.moudle.pedometer.ui.fragment.RunMainFragment;
22 23 import com.cnlive.moudle.pedometer.utils.MyMapUtil;
23 24 import com.cnlive.moudle.pedometer.utils.lib_permisshelper.PermissionsListener;
... ... @@ -38,6 +39,7 @@ public class CollPedometerMainActivity extends QMUIFragmentActivity {
38 39 private boolean isOpen;
39 40 private PermissionsUtils mPermissionsUtils = new PermissionsUtils();//权限申请
40 41 private CollRunMainFragment fragment;
  42 + private RunRaceDetailInfo runRaceDetailInfo;
41 43  
42 44 @Override
43 45 protected int getContextViewId() {
... ... @@ -49,6 +51,7 @@ public class CollPedometerMainActivity extends QMUIFragmentActivity {
49 51 super.onCreate(savedInstanceState);
50 52 StatusBarUtil2.setColor(this, getResources().getColor(R.color.run_main_bg), 0);
51 53 // setContentView(R.layout.activity_pedometer_main);
  54 + runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().getSerializable("runRaceDetailInfo");
52 55  
53 56 }
54 57  
... ... @@ -118,8 +121,8 @@ public class CollPedometerMainActivity extends QMUIFragmentActivity {
118 121 getPermissionsWithTip();
119 122 }
120 123  
121   - private void addFragment() {
122   - fragment = new CollRunMainFragment();
  124 + private void addFragment(RunRaceDetailInfo runRaceDetailInfo) {
  125 + fragment = CollRunMainFragment.newInstance(runRaceDetailInfo);
123 126 getSupportFragmentManager().beginTransaction()
124 127 .add(getContextViewId(), fragment, fragment.getClass().getSimpleName())
125 128 .addToBackStack(fragment.getClass().getSimpleName())
... ... @@ -150,7 +153,9 @@ public class CollPedometerMainActivity extends QMUIFragmentActivity {
150 153 Toast.makeText(getApplicationContext(), getString(R.string.open_gps_tip), Toast.LENGTH_LONG).show();
151 154 } else {
152 155 if (getCurrentFragment() == null) {
153   - addFragment();
  156 + if (null != runRaceDetailInfo) {
  157 + addFragment(runRaceDetailInfo);
  158 + }
154 159 }
155 160 }
156 161 }
... ... @@ -196,8 +201,9 @@ public class CollPedometerMainActivity extends QMUIFragmentActivity {
196 201 return;
197 202 }
198 203  
199   - public static void startActivity(Activity activity) {
  204 + public static void startActivity(Activity activity, RunRaceDetailInfo runRaceDetailInfo) {
200 205 Intent intent = new Intent(activity, CollPedometerMainActivity.class);
  206 + intent.putExtra("runRaceDetailInfo", runRaceDetailInfo);
201 207 activity.startActivity(intent);
202 208 }
203 209  
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/CollRunningMapActivity.java
... ... @@ -9,6 +9,7 @@ import com.cnlive.libs.base.ui.QMUIFragmentActivity;
9 9 import com.cnlive.libs.base.util.StatusBarUtil2;
10 10 import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunningMapFragment;
11 11 import com.cnlive.moudle.pedometer.model.RunningMapBean;
  12 +import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo;
12 13 import com.cnlive.moudle.pedometer.ui.fragment.RunningMapFragment;
13 14 import com.example.moudle_pedometer.R;
14 15  
... ... @@ -20,9 +21,9 @@ public class CollRunningMapActivity extends QMUIFragmentActivity {
20 21 super.onCreate(savedInstanceState);
21 22  
22 23 StatusBarUtil2.setColor(this, getResources().getColor(R.color.run_main_bg), 0);
23   - RunningMapBean chronometerBean = (RunningMapBean) getIntent().getExtras().getSerializable("runningMapBean");
24   - if (chronometerBean != null) {
25   - addFragment(chronometerBean);
  24 + RunRaceDetailInfo runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().getSerializable("runRaceDetailInfo");
  25 + if (runRaceDetailInfo != null) {
  26 + addFragment(runRaceDetailInfo);
26 27 }
27 28 }
28 29  
... ... @@ -32,17 +33,17 @@ public class CollRunningMapActivity extends QMUIFragmentActivity {
32 33 return R.id.fragment_running_map;
33 34 }
34 35  
35   - private void addFragment(RunningMapBean chronometerBean) {
36   - QMUIFragment fragment = CollRunningMapFragment.getInstance(chronometerBean);
  36 + private void addFragment(RunRaceDetailInfo runRaceDetailInfo) {
  37 + QMUIFragment fragment = CollRunningMapFragment.getInstance(runRaceDetailInfo);
37 38 getSupportFragmentManager().beginTransaction()
38 39 .add(getContextViewId(), fragment, fragment.getClass().getSimpleName())
39 40 .addToBackStack(fragment.getClass().getSimpleName())
40 41 .commit();
41 42 }
42 43  
43   - public static void startActivity(Activity activity, RunningMapBean runningMapBean) {
  44 + public static void startActivity(Activity activity, RunRaceDetailInfo runRaceDetailInfo) {
44 45 Intent intent = new Intent(activity, CollRunningMapActivity.class);
45   - intent.putExtra("runningMapBean", runningMapBean);
  46 + intent.putExtra("runRaceDetailInfo", runRaceDetailInfo);
46 47 activity.startActivity(intent);
47 48 }
48 49 }
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/StartCollectTraceActivity.java
... ... @@ -10,14 +10,15 @@ import com.cnlive.libs.base.ui.QMUIFragmentActivity;
10 10 import com.cnlive.libs.base.util.StatusBarUtil;
11 11 import com.cnlive.libs.base.util.StatusBarUtil2;
12 12 import com.cnlive.moudle.collectionTrace.ui.fragment.StartTraceFragment;
  13 +import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo;
13 14 import com.example.moudle_pedometer.R;
14 15  
15 16 public class StartCollectTraceActivity extends QMUIFragmentActivity {
16 17  
17 18  
18   - public static void newInstance(Context context,String eventId){
19   - Intent intent = new Intent(context,StartCollectTraceActivity.class);
20   - intent.putExtra("eventId",eventId);
  19 + public static void newInstance(Context context, String eventId) {
  20 + Intent intent = new Intent(context, StartCollectTraceActivity.class);
  21 + intent.putExtra("eventId", eventId);
21 22 context.startActivity(intent);
22 23 }
23 24  
... ... @@ -31,7 +32,11 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity {
31 32 super.onCreate(savedInstanceState);
32 33 StatusBarUtil.setStatusBarWrite(this);
33 34 StatusBarUtil2.setColor(this, getResources().getColor(R.color.white), 0);
34   - addFragment(new StartTraceFragment());
  35 + RunRaceDetailInfo runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().getSerializable("runRaceDetailInfo");
  36 + if (null != runRaceDetailInfo) {
  37 + addFragment(StartTraceFragment.newInstance(runRaceDetailInfo));
  38 + }
  39 +
35 40 }
36 41  
37 42 private void addFragment(QMUIFragment fragment) {
... ... @@ -41,8 +46,9 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity {
41 46 .commit();
42 47 }
43 48  
44   - public static void startActivity(Activity activity) {
  49 + public static void startActivity(Activity activity, RunRaceDetailInfo runRaceDetailInfo) {
45 50 Intent intent = new Intent(activity, StartCollectTraceActivity.class);
  51 + intent.putExtra("runRaceDetailInfo", runRaceDetailInfo);
46 52 activity.startActivity(intent);
47 53 }
48 54 }
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/fragment/CollRunMainFragment.java
... ... @@ -14,19 +14,36 @@ import com.cnlive.libs.base.ui.QMUIFragment;
14 14 import com.cnlive.libs.base.util.StatusBarUtil2;
15 15 import com.cnlive.moudle.collectionTrace.frame.presenter.CollRunMainFragmentPresenter;
16 16 import com.cnlive.moudle.collectionTrace.frame.view.CollRunMainFragmentView;
  17 +import com.cnlive.moudle.pedometer.commonInfo.CommonInfo;
17 18 import com.cnlive.moudle.pedometer.model.Constant;
18 19 import com.cnlive.moudle.pedometer.model.MessageEvent;
  20 +import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo;
  21 +import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity;
  22 +import com.cnlive.moudle.pedometer.ui.fragment.RunMainFragment;
  23 +import com.cnlive.moudle.pedometer.utils.GsonUtil;
  24 +import com.cnlive.moudle.pedometer.utils.StepUtil;
19 25 import com.cnlive.moudle.pedometer.utils.TimeUtil;
20 26 import com.example.moudle_pedometer.R;
  27 +import com.example.moudle_pedometer.databinding.FragmentCollRunMainBinding;
21 28 import com.example.moudle_pedometer.databinding.FragmentRunMainBinding;
22 29  
23 30 import org.greenrobot.eventbus.EventBus;
24 31 import org.greenrobot.eventbus.Subscribe;
25 32 import org.greenrobot.eventbus.ThreadMode;
26 33  
27   -public class CollRunMainFragment extends QMUIFragment<CollRunMainFragmentView, CollRunMainFragmentPresenter, FragmentRunMainBinding> {
  34 +import java.io.Serializable;
  35 +
  36 +public class CollRunMainFragment extends QMUIFragment<CollRunMainFragmentView, CollRunMainFragmentPresenter, FragmentCollRunMainBinding> {
28 37 private final String TAG = "CollRunMainFragment";
29   - private String userId = "yangshuai";
  38 + private RunRaceDetailInfo runRaceDetailInfo;
  39 +
  40 + public static CollRunMainFragment newInstance(RunRaceDetailInfo runRaceDetailInfo) {
  41 + Bundle bundle = new Bundle();
  42 + bundle.putSerializable("runRaceDetailInfo", (Serializable) runRaceDetailInfo);
  43 + CollRunMainFragment fragment = new CollRunMainFragment();
  44 + fragment.setArguments(bundle);
  45 + return fragment;
  46 + }
30 47  
31 48 @NonNull
32 49 @Override
... ... @@ -39,16 +56,17 @@ public class CollRunMainFragment extends QMUIFragment&lt;CollRunMainFragmentView, C
39 56 super.onViewCreated(view, savedInstanceState);
40 57 StatusBarUtil2.setColor(getActivity(), getResources().getColor(R.color.run_main_bg), 0);
41 58 EventBus.getDefault().register(this);
42   - if (getMvpView() != null) {
43   - new Handler().postDelayed(new Runnable() {
44   - @Override
45   - public void run() {
  59 + if (getArguments() != null) {
  60 + runRaceDetailInfo = (RunRaceDetailInfo) getArguments().getSerializable("runRaceDetailInfo");
  61 + if (runRaceDetailInfo != null) {
  62 + if (getMvpView() != null) {
  63 + getMvpView().initView(runRaceDetailInfo);
46 64  
47   - getMvpView().initView();
48 65 }
49   - }, 5);
  66 + }
50 67 }
51 68  
  69 +
52 70 //
53 71  
54 72  
... ... @@ -63,12 +81,6 @@ public class CollRunMainFragment extends QMUIFragment&lt;CollRunMainFragmentView, C
63 81 @Override
64 82 public void onPause() {
65 83 super.onPause();
66   - //记录当前计时器相关数据
67   - if (getMvpView() != null) {
68   - if (!TextUtils.isEmpty(userId)) {
69   - getMvpView().setSQLPauseTime(userId);
70   - }
71   - }
72 84 }
73 85  
74 86 @Override
... ... @@ -95,19 +107,19 @@ public class CollRunMainFragment extends QMUIFragment&lt;CollRunMainFragmentView, C
95 107  
96 108 @Override
97 109 protected int getLayoutId() {
98   - return R.layout.fragment_run_main;
  110 + return R.layout.fragment_coll_run_main;
99 111 }
100 112  
101 113 @Subscribe(threadMode = ThreadMode.MAIN)
102 114 public void Event(MessageEvent messageEvent) {
103 115 //更新步数
104   - if (messageEvent.getMessageType() == Constant.SERVICE_STEP_COUNT_UPDATE) {
  116 + if (messageEvent.getMessageType() == Constant.COLL_SERVICE_STEP_COUNT_UPDATE) {
105 117 if (getMvpView() != null) {
106 118 getMvpView().updateRunDistance((Integer) messageEvent.getMessageContent());
107 119 }
108 120 }
109 121 //重置速度
110   - else if (messageEvent.getMessageType() == Constant.SERVICE_STEP_COUNT_RESET_SPEED) {
  122 + else if (messageEvent.getMessageType() == Constant.COLL_SERVICE_STEP_COUNT_RESET_SPEED) {
111 123 if (getMvpView() != null) {
112 124 getMvpView().resetSpeed();
113 125 }
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/fragment/CollRunningMapFragment.java
... ... @@ -6,25 +6,17 @@ import android.hardware.SensorManager;
6 6 import android.os.Bundle;
7 7 import android.os.Vibrator;
8 8 import android.support.annotation.Nullable;
9   -import android.text.TextUtils;
10   -import android.util.Log;
11 9 import android.view.View;
12 10  
13   -import com.baidu.mapapi.model.LatLng;
14 11 import com.cnlive.libs.base.ui.QMUIFragment;
15 12 import com.cnlive.libs.base.util.StatusBarUtil2;
16 13 import com.cnlive.moudle.collectionTrace.frame.presenter.CollRunningMapFragmentPresenter;
17 14 import com.cnlive.moudle.collectionTrace.frame.view.CollRunningMapFragmentView;
18   -import com.cnlive.moudle.pedometer.commonInfo.CollCommonInfo;
19   -import com.cnlive.moudle.pedometer.commonInfo.CommonInfo;
20 15 import com.cnlive.moudle.pedometer.model.Constant;
21 16 import com.cnlive.moudle.pedometer.model.MessageEvent;
22   -import com.cnlive.moudle.pedometer.model.RunningMapBean;
23   -import com.cnlive.moudle.pedometer.service.StepService;
  17 +import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo;
24 18 import com.cnlive.moudle.pedometer.ui.widget.TipDialog;
25 19 import com.cnlive.moudle.pedometer.utils.ChineseToSpeechUtil;
26   -import com.cnlive.moudle.pedometer.utils.GsonUtil;
27   -import com.cnlive.moudle.pedometer.utils.TimeUtil;
28 20 import com.example.moudle_pedometer.R;
29 21 import com.example.moudle_pedometer.databinding.FragmentCollectRunningMapBinding;
30 22  
... ... @@ -32,9 +24,6 @@ import org.greenrobot.eventbus.EventBus;
32 24 import org.greenrobot.eventbus.Subscribe;
33 25 import org.greenrobot.eventbus.ThreadMode;
34 26  
35   -import java.util.ArrayList;
36   -import java.util.List;
37   -
38 27 import static android.content.Context.SENSOR_SERVICE;
39 28  
40 29 /**
... ... @@ -44,7 +33,6 @@ import static android.content.Context.SENSOR_SERVICE;
44 33 */
45 34 public class CollRunningMapFragment extends QMUIFragment<CollRunningMapFragmentView, CollRunningMapFragmentPresenter, FragmentCollectRunningMapBinding> {
46 35 private static final String TAG = "CollRunningMapFragment";
47   - private RunningMapBean runningMapBean;
48 36 private SensorManager mSensorManager;
49 37 private String test = "[{\"latitude\":39.933889208848,\"latitudeE6\":3.9933889208848E7,\"longitude\":116.30900265517,\"longitudeE6\":1.1630900265517001E8},{\"latitude\":39.933868507347,\"latitudeE6\":3.9933868507347E7,\"longitude\":116.30865416508,\"longitudeE6\":1.1630865416508E8},{\"latitude\":39.934756505077,\"latitudeE6\":3.9934756505077E7,\"longitude\":116.30860516469,\"longitudeE6\":1.1630860516468999E8},{\"latitude\":39.934781620502,\"latitudeE6\":3.9934781620502E7,\"longitude\":116.30961013007,\"longitudeE6\":1.1630961013007E8},{\"latitude\":39.934881620374,\"latitudeE6\":3.9934881620374E7,\"longitude\":116.30960513008,\"longitudeE6\":1.1630960513008E8},{\"latitude\":39.934077623132,\"latitudeE6\":3.9934077623132E7,\"longitude\":116.30965812942,\"longitudeE6\":1.1630965812942E8},{\"latitude\":39.933972618463,\"latitudeE6\":3.9933972618463E7,\"longitude\":116.30962113087,\"longitudeE6\":1.1630962113087E8},{\"latitude\":39.933932608856,\"latitudeE6\":3.9933932608856E7,\"longitude\":116.30953913383,\"longitudeE6\":1.1630953913383E8}]";
50 38 //创建震动服务对象
... ... @@ -66,16 +54,26 @@ public class CollRunningMapFragment extends QMUIFragment&lt;CollRunningMapFragmentV
66 54 return R.layout.fragment_collect_running_map;
67 55 }
68 56  
69   - public static CollRunningMapFragment getInstance(RunningMapBean runningMapBean) {
  57 + // public static CollRunningMapFragment getInstance(RunningMapBean runningMapBean) {
  58 +// CollRunningMapFragment fragment = new CollRunningMapFragment();
  59 +// Bundle bundle = new Bundle();
  60 +// if (runningMapBean != null) {
  61 +// bundle.putSerializable("runningMapBean", runningMapBean);
  62 +// }
  63 +// fragment.setArguments(bundle);
  64 +// return fragment;
  65 +// }
  66 + public static CollRunningMapFragment getInstance(RunRaceDetailInfo runRaceDetailInfo) {
70 67 CollRunningMapFragment fragment = new CollRunningMapFragment();
71 68 Bundle bundle = new Bundle();
72   - if (runningMapBean != null) {
73   - bundle.putSerializable("runningMapBean", runningMapBean);
  69 + if (runRaceDetailInfo != null) {
  70 + bundle.putSerializable("runRaceDetailInfo", runRaceDetailInfo);
74 71 }
75 72 fragment.setArguments(bundle);
76 73 return fragment;
77 74 }
78 75  
  76 +
79 77 @Override
80 78 public void onActivityCreated(@Nullable Bundle savedInstanceState) {
81 79 super.onActivityCreated(savedInstanceState);
... ... @@ -92,41 +90,35 @@ public class CollRunningMapFragment extends QMUIFragment&lt;CollRunningMapFragmentV
92 90 mVibrator = (Vibrator) getActivity().getSystemService(Service.VIBRATOR_SERVICE);
93 91 //初始化提示框
94 92 initTipDialog();
95   - List<LatLng> trackPoints = GsonUtil.jsonToList(test, LatLng.class);
96   -
97 93 if (getArguments() != null) {
98   - runningMapBean = (RunningMapBean) getArguments().getSerializable("runningMapBean");
99   - }
100   - if (getMvpView() != null) {
101   - getMvpView().initView(trackPoints);
102   - if (runningMapBean != null) {
103   - getMvpView().updateChronometer(runningMapBean);
  94 + RunRaceDetailInfo runRaceDetailInfo = (RunRaceDetailInfo) getArguments().getSerializable("runRaceDetailInfo");
  95 + if (null!=runRaceDetailInfo){
  96 + if (getMvpView() != null) {
  97 + getMvpView().initMap();
  98 + getMvpView().initView(runRaceDetailInfo);
  99 + }
104 100 }
105 101 }
106   - //开始进行历史轨迹查询
107   - if (getPresenter() != null && !TextUtils.isEmpty(StepService.entityName)) {
108   - long stepStartTime = CollCommonInfo.getStepStartTime(getActivity());
109   - Log.e(TAG, "onViewCreated: 时间"+stepStartTime );
110   - long startTime = 0;
111   - if (stepStartTime != 0) {
112   - startTime = stepStartTime;
113   - } else {
114   - startTime = (int) (System.currentTimeMillis() / 1000 -12 * 60 * 60);
115   - }
116   - long current = TimeUtil.getNowTimeStamp();
117   -// long startTime = current - hour * 3600 * 1000 - minute * 60 * 1000 - second * 1000;
118   - long endTime = current;
119   -// Log.e(TAG, "onViewCreated: " + "hour:" + hour + ",minute" + minute + ",second:" + second);
120   - getPresenter().queryHistoryTrace(getActivity(), StepService.entityName, startTime, endTime);
121 102  
122   - }
  103 + //开始进行历史轨迹查询
  104 +// if (getPresenter() != null && !TextUtils.isEmpty(StepService.entityName)) {
  105 +// long stepStartTime = CollCommonInfo.getStepStartTime(getActivity());
  106 +// Log.e(TAG, "onViewCreated: 时间" + stepStartTime);
  107 +// long startTime = 0;
  108 +// if (stepStartTime != 0) {
  109 +// startTime = stepStartTime;
  110 +// } else {
  111 +// startTime = (int) (System.currentTimeMillis() / 1000 - 12 * 60 * 60);
  112 +// }
  113 +// long current = TimeUtil.getNowTimeStamp();
  114 +//// long startTime = current - hour * 3600 * 1000 - minute * 60 * 1000 - second * 1000;
  115 +// long endTime = current;
  116 +//// Log.e(TAG, "onViewCreated: " + "hour:" + hour + ",minute" + minute + ",second:" + second);
  117 +// getPresenter().queryHistoryTrace(getActivity(), CollStepService.entityName, startTime, endTime);
  118 +//
  119 +// }
123 120  
124 121  
125   - List<com.baidu.trace.model.LatLng> fenceLatLngs = new ArrayList<>();
126   - for (LatLng latLng : trackPoints) {
127   - com.baidu.trace.model.LatLng tempLatLng = new com.baidu.trace.model.LatLng(latLng.latitude, latLng.longitude);
128   - fenceLatLngs.add(tempLatLng);
129   - }
130 122 }
131 123  
132 124 @Override
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/fragment/StartTraceFragment.java
... ... @@ -10,9 +10,11 @@ import com.cnlive.libs.base.ui.QMUIFragment;
10 10 import com.cnlive.moudle.collectionTrace.frame.presenter.StartTraceFragmentPresenter;
11 11 import com.cnlive.moudle.collectionTrace.frame.view.StartTraceFragmentView;
12 12 import com.cnlive.moudle.collectionTrace.ui.activity.CollPedometerMainActivity;
  13 +import com.cnlive.moudle.collectionTrace.ui.activity.CollRunningMapActivity;
13 14 import com.cnlive.moudle.collectionTrace.ui.activity.StartCollectTraceActivity;
14 15 import com.cnlive.moudle.pedometer.model.Constant;
15 16 import com.cnlive.moudle.pedometer.model.MessageEvent;
  17 +import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo;
16 18 import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil;
17 19 import com.example.moudle_pedometer.R;
18 20 import com.example.moudle_pedometer.databinding.FragmentStartCollectTraceBinding;
... ... @@ -27,6 +29,14 @@ public class StartTraceFragment extends QMUIFragment&lt;StartTraceFragmentView, Sta
27 29 private static final String TAG = "StartTraceFragment";
28 30 private SensorManager mSensorManager;
29 31  
  32 + public static StartTraceFragment newInstance(RunRaceDetailInfo runRaceDetailInfo) {
  33 + StartTraceFragment fragment = new StartTraceFragment();
  34 + Bundle bundle = new Bundle();
  35 + bundle.putSerializable("runRaceDetailInfo", runRaceDetailInfo);
  36 + fragment.setArguments(bundle);
  37 + return fragment;
  38 + }
  39 +
30 40 @Override
31 41 protected int getToolbarId() {
32 42 return R.id.topbar;
... ... @@ -47,11 +57,16 @@ public class StartTraceFragment extends QMUIFragment&lt;StartTraceFragmentView, Sta
47 57 super.onViewCreated(view, savedInstanceState);
48 58 EventBus.getDefault().register(this);
49 59 mSensorManager = (SensorManager) getActivity().getSystemService(SENSOR_SERVICE);//获取传感器管理服务
50   -
51   - if (getMvpView() != null) {
52   - getMvpView().initMap();
53   - getMvpView().initView();
  60 + if (null != getArguments()) {
  61 + RunRaceDetailInfo runRaceDetailInfo = (RunRaceDetailInfo) getArguments().getSerializable("runRaceDetailInfo");
  62 + if (null != runRaceDetailInfo) {
  63 + if (getMvpView() != null) {
  64 + getMvpView().initMap();
  65 + getMvpView().initView(runRaceDetailInfo);
  66 + }
  67 + }
54 68 }
  69 +
55 70 }
56 71  
57 72 @Override
... ... @@ -102,7 +117,9 @@ public class StartTraceFragment extends QMUIFragment&lt;StartTraceFragmentView, Sta
102 117 if (messageEvent.getMessageType() == Constant.COLL_START_TRACE_GATHER_SUCCESS) {
103 118 if (getMvpView() != null) {
104 119 QMUITipDialogUtil.dismessDialog();
105   - CollPedometerMainActivity.startActivity(getActivity());
  120 + if (null != getMvpView()) {
  121 + CollRunningMapActivity.startActivity(getActivity(),getMvpView().runRaceDetailInfo);
  122 + }
106 123 }
107 124 }
108 125 //启动鹰眼失败
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/utils/CollStepUtil.java 0 → 100644
  1 +package com.cnlive.moudle.collectionTrace.utils;
  2 +
  3 +import android.content.Context;
  4 +import android.text.TextUtils;
  5 +import android.util.Log;
  6 +
  7 +import com.baidu.mapapi.model.LatLng;
  8 +import com.cnlive.moudle.collectionTrace.model.CollectPoint;
  9 +import com.cnlive.moudle.pedometer.sql.dao.CollUserStepEntityDao;
  10 +import com.cnlive.moudle.pedometer.sql.dao.UserStepEntityDao;
  11 +import com.cnlive.moudle.pedometer.sql.db.DbCore;
  12 +import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity;
  13 +import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity;
  14 +import com.cnlive.moudle.pedometer.utils.GsonUtil;
  15 +
  16 +import java.text.SimpleDateFormat;
  17 +import java.util.ArrayList;
  18 +import java.util.Date;
  19 +import java.util.List;
  20 +import java.util.UUID;
  21 +
  22 +/**
  23 + * 步数工具
  24 + *
  25 + * @author ShinnyYang
  26 + */
  27 +public class CollStepUtil {
  28 + private static final String TAG = "CollStepUtil";
  29 + private static final String dbName = "CollStep.db";
  30 +
  31 + public static String getUUID() {
  32 + return UUID.randomUUID().toString().replace("-", "");
  33 + }
  34 +
  35 + /**
  36 + * 设置开始起点坐标
  37 + *
  38 + * @param context
  39 + * @param uid
  40 + * @param startPointName
  41 + * @param startPointLatLng
  42 + */
  43 + public static void setCollStartPointData(Context context, String uid, String startPointName, String startPointLatLng) {
  44 + //先获取有没有
  45 + if (getCollUserStepData(context, uid) != null) {
  46 + CollUserStepEntity entity = getCollUserStepData(context, uid);
  47 + if (null != entity) {
  48 + entity.setCollStartLatLngName(startPointName);
  49 + entity.setCollStartLatLng(startPointLatLng);
  50 + //更新数据
  51 + updateCollStepData(context, entity);
  52 + }
  53 + }
  54 + }
  55 +
  56 + /**
  57 + * 设置打的重要点
  58 + *
  59 + * @param context
  60 + * @param uid
  61 + * @param latLng
  62 + */
  63 + public static void setImportPoints(Context context, String uid, LatLng latLng) {
  64 + //先获取有没有
  65 + if (getCollUserStepData(context, uid) != null) {
  66 + CollUserStepEntity entity = getCollUserStepData(context, uid);
  67 + if (null != entity) {
  68 + //判断有没有打过点
  69 + if (!TextUtils.isEmpty(entity.getImportPoint())) {
  70 + //已经打过点,先把打的点取出来
  71 + List<LatLng> lngs = GsonUtil.jsonToList(entity.getImportPoint(), LatLng.class);
  72 + if (null != lngs) {
  73 + //加入新打的点
  74 + if (!lngs.contains(latLng)) {
  75 + lngs.add(latLng);
  76 + //重新设置打的点
  77 + entity.setImportPoint(GsonUtil.GsonString(lngs));
  78 + //更新数据
  79 + updateCollStepData(context, entity);
  80 + }
  81 +
  82 + }
  83 + }
  84 + //没有打过点
  85 + else {
  86 + //则设置一个
  87 + List<LatLng> lngs = new ArrayList<>();
  88 + lngs.add(latLng);
  89 + //重新设置打的点
  90 + entity.setImportPoint(GsonUtil.GsonString(lngs));
  91 + //更新数据
  92 + updateCollStepData(context, entity);
  93 + }
  94 + }
  95 + }
  96 + }
  97 +
  98 + /**
  99 + * 设置运营赛事标题
  100 + *
  101 + * @param context
  102 + * @param uid
  103 + * @param streetTitle
  104 + */
  105 + public static void setCollStreetTitle(Context context, String uid, String streetTitle) {
  106 + if (getCollUserStepData(context, uid) != null) {
  107 + CollUserStepEntity entity = getCollUserStepData(context, uid);
  108 + entity.setStreetTitle(streetTitle);
  109 + //更新数据
  110 + updateCollStepData(context, entity);
  111 + }
  112 + }
  113 +
  114 + /**
  115 + * 更新运营数据
  116 + *
  117 + * @param context
  118 + * @param userStepEntity
  119 + */
  120 + public static void updateCollStepData(Context context, CollUserStepEntity userStepEntity) {
  121 + if (userStepEntity != null) {
  122 + DbCore.init(context, dbName);
  123 + DbCore.getDaoSession().getCollUserStepEntityDao().update(userStepEntity);
  124 + }
  125 +
  126 + }
  127 +
  128 + /**
  129 + * 插入计步数据
  130 + *
  131 + * @param context
  132 + * @param userStepEntity
  133 + */
  134 + public static void insertCollStepData(Context context, CollUserStepEntity userStepEntity) {
  135 + DbCore.init(context, dbName);
  136 + DbCore.getDaoSession().getCollUserStepEntityDao().insert(userStepEntity);
  137 + }
  138 +
  139 + /**
  140 + * 设置计步开始时间
  141 + *
  142 + * @param context
  143 + * @param uid
  144 + * @param time
  145 + */
  146 + public static void setCollChronometerBase(Context context, String uid, long time) {
  147 + if (getCollUserStepData(context, uid) != null) {
  148 + CollUserStepEntity entity = getCollUserStepData(context, uid);
  149 + entity.setChronometerBase(time);
  150 + //更新数据
  151 + updateCollStepData(context, entity);
  152 + } else {
  153 + //创建数据
  154 + CollUserStepEntity userStepEntity = new CollUserStepEntity();
  155 + userStepEntity.setUserId(uid);
  156 + userStepEntity.setChronometerBase(time);
  157 + insertCollStepData(context, userStepEntity);
  158 + }
  159 + }
  160 +
  161 + /**
  162 + * 初始化运营计步相关数据
  163 + *
  164 + * @param context
  165 + * @param uid
  166 + * @param startStamp
  167 + * @param streetId
  168 + */
  169 + public static void setCollStepStartData(Context context, String uid, long startStamp, String streetId) {
  170 + if (getCollUserStepData(context, uid) != null) {
  171 + CollUserStepEntity entity = getCollUserStepData(context, uid);
  172 + entity.setStartTimeStamp(startStamp);
  173 + entity.setStreetId(streetId);
  174 + //更新数据
  175 + updateCollStepData(context, entity);
  176 + } else {
  177 + //创建数据
  178 + CollUserStepEntity userStepEntity = new CollUserStepEntity();
  179 + userStepEntity.setUserId(uid);
  180 + userStepEntity.setStartTimeStamp(startStamp);
  181 + userStepEntity.setStreetId(streetId);
  182 + insertCollStepData(context, userStepEntity);
  183 + }
  184 + }
  185 +
  186 + /**
  187 + * 计算配速
  188 + */
  189 + public static String getPaceSpeed(double second, double distance) {
  190 + if (distance != 0) {
  191 + //计算分
  192 + int minute = (int) (second / distance / 60);
  193 + //获取秒
  194 + double miaoMin = ((double) (second / distance / 60)) - ((int) (second / distance / 60));
  195 + int miao = (int) (miaoMin * 60);
  196 + return minute + "'" + miao + "''";
  197 + } else {
  198 + return "--";
  199 + }
  200 + }
  201 +
  202 +
  203 + /**
  204 + * 得到当前速度
  205 + *
  206 + * @param time
  207 + * @param distance
  208 + * @return
  209 + */
  210 + public static double getCurrentSpeed(double time, double distance) {
  211 + double result = distance / time;
  212 + result = Double.parseDouble(String.format("%1.2f", result));
  213 + return result;
  214 + }
  215 +
  216 + /**
  217 + * 根据行走步数,计算大概行走具体
  218 + * 单位:公里
  219 + * 1步的距离大概是60厘米。
  220 + * 1万多步,距离大概就是600000厘米,即6000米(6公里)
  221 + *
  222 + * @param step
  223 + * @return
  224 + */
  225 + public static double getWalkDistanceKM(long step) {
  226 + double result = step * 60.0 / 100.0 / 1000.0;
  227 + result = Double.parseDouble(String.format("%1.2f", result));
  228 + return result;
  229 + }
  230 +
  231 + /**
  232 + * 清除保存数据库中的数据
  233 + *
  234 + * @param uid
  235 + */
  236 + public static void clearRunData(Context context, String uid) {
  237 + DbCore.init(context, dbName);
  238 + String CURRENT_DATE = getTodayDate();
  239 + List<CollUserStepEntity> list = DbCore.getDaoSession().getCollUserStepEntityDao().queryBuilder().where(CollUserStepEntityDao.Properties.UserId.eq(uid), CollUserStepEntityDao.Properties.Date.eq(CURRENT_DATE)).list();
  240 + if (list != null && list.size() > 0) {
  241 + Log.e(TAG, "clearRunData: " + list.size());
  242 + DbCore.getDaoSession().getCollUserStepEntityDao().deleteByKey(list.get(0).getUserId());
  243 + DbCore.getDaoSession().getCollUserStepEntityDao().detachAll();
  244 + }
  245 + }
  246 +
  247 + /**
  248 + * 获取用户数据
  249 + *
  250 + * @param context
  251 + * @param uid
  252 + * @return
  253 + */
  254 + public static CollUserStepEntity getCollUserStepData(Context context, String uid) {
  255 + if (!TextUtils.isEmpty(uid)) {
  256 + DbCore.init(context, dbName);
  257 + DbCore.getDaoSession().getCollUserStepEntityDao().detachAll();
  258 + DbCore.getDaoSession().clear();
  259 + List<CollUserStepEntity> list = DbCore.getDaoSession().getCollUserStepEntityDao().queryBuilder().where(CollUserStepEntityDao.Properties.UserId.eq(uid)).list();
  260 + if (list != null && list.size() > 0) {
  261 + return list.get(0);
  262 + } else {
  263 + return null;
  264 + }
  265 + } else {
  266 + return null;
  267 + }
  268 + }
  269 +
  270 + /**
  271 + * 获取用户数据
  272 + *
  273 + * @param context
  274 + * @param uid
  275 + * @return
  276 + */
  277 + public static void setServerTraceData(Context context, String uid, CollUserStepEntity userStepEntity) {
  278 + if (getCollUserStepData(context, uid) != null) {
  279 + CollUserStepEntity entity = getCollUserStepData(context, uid);
  280 + } else {
  281 +
  282 + }
  283 + }
  284 +
  285 + /**
  286 + * 获取当天日期
  287 + *
  288 + * @return
  289 + */
  290 + private static String getTodayDate() {
  291 + Date date = new Date(System.currentTimeMillis());
  292 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  293 + return sdf.format(date);
  294 + }
  295 +
  296 +
  297 +}
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/commonInfo/CommonInfo.java
... ... @@ -134,7 +134,7 @@ public class CommonInfo {
134 134 * @param context
135 135 */
136 136 public static boolean getIsRunBaiduTraceService(Context context) {
137   - return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getBoolean("RunBaiduTraceService", false);
  137 + return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getBoolean("RunBaiduTraceService", true);
138 138 }
139 139  
140 140 /**
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/model/Constant.java
1 1 package com.cnlive.moudle.pedometer.model;
2 2  
3 3 public class Constant {
4   - public static final long SERVICE_ID = 213511;
  4 +// public static final long SERVICE_ID = 213511;//公司账号
  5 + public static final long SERVICE_ID = 213553;
  6 +
5 7 public static final int TAG = 1;
6 8 public static final int GATHER_INTERVAL = 2;//位置采集周期
7 9 public static final int PACK_INTERVAL = 10;//位置采集周期
... ... @@ -13,6 +15,8 @@ public class Constant {
13 15 public static final int FRAGMENT_RUN_CHRONOMETER = 4;//同步计时器
14 16 public static final int EXIT_RANGE = 5;//超出范围
15 17 public static final int ENTER_RANGE = 6;//进入范围
  18 + public static final int COLL_SERVICE_STEP_COUNT_RESET_SPEED = 3;//重置速度
  19 + public static final int COLL_SERVICE_STEP_COUNT_UPDATE = 0;//步数更新
16 20 public static final int COLL_START_TRACE_GATHER_SUCCESS = 7;//启动轨迹服务成功(运营)
17 21 public static final int COLL_START_TRACE_GATHER_FAIL = 8;//启动轨迹服务失败(运营)
18 22 public static final int START_TRACE_GATHER_SUCCESS = 9;//启动轨迹服务成功(用户)
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/net/bean/RunRaceDetailInfo.java
... ... @@ -65,7 +65,7 @@ public class RunRaceDetailInfo implements Serializable {
65 65 private boolean ranking;
66 66 private boolean individualAchievement;
67 67 private boolean signResult;
68   - private boolean trackButton;
  68 + private boolean trackButton;//轨迹按钮,true展示,false不展示
69 69 private String state;
70 70 private String finishNum;
71 71 private String firstEmployTime;
... ... @@ -86,8 +86,27 @@ public class RunRaceDetailInfo implements Serializable {
86 86 private String userMileage;
87 87 private List<String> faceUrl;
88 88 private List<String> finishFaceUrl;
  89 + /*********************************后加的,非接口返回,用于*******************************************/
89 90 private String endLatLng;//终点坐标,后加的,不是后台返回,这是从百度历史轨迹查出来的
90 91 private boolean endState;//活动是否结束(true 结束 false 未结束 )
  92 + private String collStartLatLng;//运营打的点
  93 + private String collStartLntLngName;//运营打点名称
  94 +
  95 + public String getCollStartLatLng() {
  96 + return collStartLatLng;
  97 + }
  98 +
  99 + public void setCollStartLatLng(String collStartLatLng) {
  100 + this.collStartLatLng = collStartLatLng;
  101 + }
  102 +
  103 + public String getCollStartLntLngName() {
  104 + return collStartLntLngName;
  105 + }
  106 +
  107 + public void setCollStartLntLngName(String collStartLntLngName) {
  108 + this.collStartLntLngName = collStartLntLngName;
  109 + }
91 110  
92 111 public boolean isEndState() {
93 112 return endState;
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/sql/dao/CollUserStepEntityDao.java
... ... @@ -24,14 +24,29 @@ public class CollUserStepEntityDao extends AbstractDao&lt;CollUserStepEntity, Strin
24 24 * Can be used for QueryBuilder and for referencing column names.
25 25 */
26 26 public static class Properties {
27   - public final static Property Uuid = new Property(0, String.class, "uuid", true, "UUID");
28   - public final static Property UserId = new Property(1, String.class, "userId", false, "USER_ID");
29   - public final static Property Date = new Property(2, String.class, "date", false, "DATE");
30   - public final static Property StepCount = new Property(3, String.class, "stepCount", false, "STEP_COUNT");
31   - public final static Property PauseTimeStamp = new Property(4, long.class, "pauseTimeStamp", false, "PAUSE_TIME_STAMP");
32   - public final static Property RecordTime = new Property(5, long.class, "recordTime", false, "RECORD_TIME");
33   - public final static Property CaloriesCount = new Property(6, double.class, "caloriesCount", false, "CALORIES_COUNT");
34   - public final static Property ServerTraceData = new Property(7, String.class, "serverTraceData", false, "SERVER_TRACE_DATA");
  27 + public final static Property UserId = new Property(0, String.class, "userId", true, "USER_ID");
  28 + public final static Property Date = new Property(1, String.class, "date", false, "DATE");
  29 + public final static Property StepCount = new Property(2, String.class, "stepCount", false, "STEP_COUNT");
  30 + public final static Property RecordTime = new Property(3, long.class, "recordTime", false, "RECORD_TIME");
  31 + public final static Property CaloriesCount = new Property(4, double.class, "caloriesCount", false, "CALORIES_COUNT");
  32 + public final static Property ServerTraceData = new Property(5, String.class, "serverTraceData", false, "SERVER_TRACE_DATA");
  33 + public final static Property StartTimeStamp = new Property(6, long.class, "startTimeStamp", false, "START_TIME_STAMP");
  34 + public final static Property FinishTimeStamp = new Property(7, long.class, "finishTimeStamp", false, "FINISH_TIME_STAMP");
  35 + public final static Property StreetId = new Property(8, String.class, "streetId", false, "STREET_ID");
  36 + public final static Property PauseCount = new Property(9, int.class, "pauseCount", false, "PAUSE_COUNT");
  37 + public final static Property UserPauseTimeStamp = new Property(10, long.class, "userPauseTimeStamp", false, "USER_PAUSE_TIME_STAMP");
  38 + public final static Property ChronometerBase = new Property(11, long.class, "chronometerBase", false, "CHRONOMETER_BASE");
  39 + public final static Property QueryTraceStartTime = new Property(12, long.class, "queryTraceStartTime", false, "QUERY_TRACE_START_TIME");
  40 + public final static Property QueryTraceEndTime = new Property(13, long.class, "queryTraceEndTime", false, "QUERY_TRACE_END_TIME");
  41 + public final static Property QueryEntityName = new Property(14, String.class, "queryEntityName", false, "QUERY_ENTITY_NAME");
  42 + public final static Property ContinueTime = new Property(15, long.class, "continueTime", false, "CONTINUE_TIME");
  43 + public final static Property FenceId = new Property(16, long.class, "fenceId", false, "FENCE_ID");
  44 + public final static Property ImportPoint = new Property(17, String.class, "importPoint", false, "IMPORT_POINT");
  45 + public final static Property StreetTitle = new Property(18, String.class, "streetTitle", false, "STREET_TITLE");
  46 + public final static Property EndLatLng = new Property(19, String.class, "endLatLng", false, "END_LAT_LNG");
  47 + public final static Property IsArriveEndPoint = new Property(20, boolean.class, "isArriveEndPoint", false, "IS_ARRIVE_END_POINT");
  48 + public final static Property CollStartLatLngName = new Property(21, String.class, "collStartLatLngName", false, "COLL_START_LAT_LNG_NAME");
  49 + public final static Property CollStartLatLng = new Property(22, String.class, "collStartLatLng", false, "COLL_START_LAT_LNG");
35 50 }
36 51  
37 52  
... ... @@ -47,14 +62,29 @@ public class CollUserStepEntityDao extends AbstractDao&lt;CollUserStepEntity, Strin
47 62 public static void createTable(Database db, boolean ifNotExists) {
48 63 String constraint = ifNotExists? "IF NOT EXISTS ": "";
49 64 db.execSQL("CREATE TABLE " + constraint + "\"COLL_USER_STEP_ENTITY\" (" + //
50   - "\"UUID\" TEXT PRIMARY KEY NOT NULL ," + // 0: uuid
51   - "\"USER_ID\" TEXT," + // 1: userId
52   - "\"DATE\" TEXT," + // 2: date
53   - "\"STEP_COUNT\" TEXT," + // 3: stepCount
54   - "\"PAUSE_TIME_STAMP\" INTEGER NOT NULL ," + // 4: pauseTimeStamp
55   - "\"RECORD_TIME\" INTEGER NOT NULL ," + // 5: recordTime
56   - "\"CALORIES_COUNT\" REAL NOT NULL ," + // 6: caloriesCount
57   - "\"SERVER_TRACE_DATA\" TEXT);"); // 7: serverTraceData
  65 + "\"USER_ID\" TEXT PRIMARY KEY NOT NULL ," + // 0: userId
  66 + "\"DATE\" TEXT," + // 1: date
  67 + "\"STEP_COUNT\" TEXT," + // 2: stepCount
  68 + "\"RECORD_TIME\" INTEGER NOT NULL ," + // 3: recordTime
  69 + "\"CALORIES_COUNT\" REAL NOT NULL ," + // 4: caloriesCount
  70 + "\"SERVER_TRACE_DATA\" TEXT," + // 5: serverTraceData
  71 + "\"START_TIME_STAMP\" INTEGER NOT NULL ," + // 6: startTimeStamp
  72 + "\"FINISH_TIME_STAMP\" INTEGER NOT NULL ," + // 7: finishTimeStamp
  73 + "\"STREET_ID\" TEXT," + // 8: streetId
  74 + "\"PAUSE_COUNT\" INTEGER NOT NULL ," + // 9: pauseCount
  75 + "\"USER_PAUSE_TIME_STAMP\" INTEGER NOT NULL ," + // 10: userPauseTimeStamp
  76 + "\"CHRONOMETER_BASE\" INTEGER NOT NULL ," + // 11: chronometerBase
  77 + "\"QUERY_TRACE_START_TIME\" INTEGER NOT NULL ," + // 12: queryTraceStartTime
  78 + "\"QUERY_TRACE_END_TIME\" INTEGER NOT NULL ," + // 13: queryTraceEndTime
  79 + "\"QUERY_ENTITY_NAME\" TEXT," + // 14: queryEntityName
  80 + "\"CONTINUE_TIME\" INTEGER NOT NULL ," + // 15: continueTime
  81 + "\"FENCE_ID\" INTEGER NOT NULL ," + // 16: fenceId
  82 + "\"IMPORT_POINT\" TEXT," + // 17: importPoint
  83 + "\"STREET_TITLE\" TEXT," + // 18: streetTitle
  84 + "\"END_LAT_LNG\" TEXT," + // 19: endLatLng
  85 + "\"IS_ARRIVE_END_POINT\" INTEGER NOT NULL ," + // 20: isArriveEndPoint
  86 + "\"COLL_START_LAT_LNG_NAME\" TEXT," + // 21: collStartLatLngName
  87 + "\"COLL_START_LAT_LNG\" TEXT);"); // 22: collStartLatLng
58 88 }
59 89  
60 90 /** Drops the underlying database table. */
... ... @@ -67,32 +97,71 @@ public class CollUserStepEntityDao extends AbstractDao&lt;CollUserStepEntity, Strin
67 97 protected final void bindValues(DatabaseStatement stmt, CollUserStepEntity entity) {
68 98 stmt.clearBindings();
69 99  
70   - String uuid = entity.getUuid();
71   - if (uuid != null) {
72   - stmt.bindString(1, uuid);
73   - }
74   -
75 100 String userId = entity.getUserId();
76 101 if (userId != null) {
77   - stmt.bindString(2, userId);
  102 + stmt.bindString(1, userId);
78 103 }
79 104  
80 105 String date = entity.getDate();
81 106 if (date != null) {
82   - stmt.bindString(3, date);
  107 + stmt.bindString(2, date);
83 108 }
84 109  
85 110 String stepCount = entity.getStepCount();
86 111 if (stepCount != null) {
87   - stmt.bindString(4, stepCount);
  112 + stmt.bindString(3, stepCount);
88 113 }
89   - stmt.bindLong(5, entity.getPauseTimeStamp());
90   - stmt.bindLong(6, entity.getRecordTime());
91   - stmt.bindDouble(7, entity.getCaloriesCount());
  114 + stmt.bindLong(4, entity.getRecordTime());
  115 + stmt.bindDouble(5, entity.getCaloriesCount());
92 116  
93 117 String serverTraceData = entity.getServerTraceData();
94 118 if (serverTraceData != null) {
95   - stmt.bindString(8, serverTraceData);
  119 + stmt.bindString(6, serverTraceData);
  120 + }
  121 + stmt.bindLong(7, entity.getStartTimeStamp());
  122 + stmt.bindLong(8, entity.getFinishTimeStamp());
  123 +
  124 + String streetId = entity.getStreetId();
  125 + if (streetId != null) {
  126 + stmt.bindString(9, streetId);
  127 + }
  128 + stmt.bindLong(10, entity.getPauseCount());
  129 + stmt.bindLong(11, entity.getUserPauseTimeStamp());
  130 + stmt.bindLong(12, entity.getChronometerBase());
  131 + stmt.bindLong(13, entity.getQueryTraceStartTime());
  132 + stmt.bindLong(14, entity.getQueryTraceEndTime());
  133 +
  134 + String queryEntityName = entity.getQueryEntityName();
  135 + if (queryEntityName != null) {
  136 + stmt.bindString(15, queryEntityName);
  137 + }
  138 + stmt.bindLong(16, entity.getContinueTime());
  139 + stmt.bindLong(17, entity.getFenceId());
  140 +
  141 + String importPoint = entity.getImportPoint();
  142 + if (importPoint != null) {
  143 + stmt.bindString(18, importPoint);
  144 + }
  145 +
  146 + String streetTitle = entity.getStreetTitle();
  147 + if (streetTitle != null) {
  148 + stmt.bindString(19, streetTitle);
  149 + }
  150 +
  151 + String endLatLng = entity.getEndLatLng();
  152 + if (endLatLng != null) {
  153 + stmt.bindString(20, endLatLng);
  154 + }
  155 + stmt.bindLong(21, entity.getIsArriveEndPoint() ? 1L: 0L);
  156 +
  157 + String collStartLatLngName = entity.getCollStartLatLngName();
  158 + if (collStartLatLngName != null) {
  159 + stmt.bindString(22, collStartLatLngName);
  160 + }
  161 +
  162 + String collStartLatLng = entity.getCollStartLatLng();
  163 + if (collStartLatLng != null) {
  164 + stmt.bindString(23, collStartLatLng);
96 165 }
97 166 }
98 167  
... ... @@ -100,32 +169,71 @@ public class CollUserStepEntityDao extends AbstractDao&lt;CollUserStepEntity, Strin
100 169 protected final void bindValues(SQLiteStatement stmt, CollUserStepEntity entity) {
101 170 stmt.clearBindings();
102 171  
103   - String uuid = entity.getUuid();
104   - if (uuid != null) {
105   - stmt.bindString(1, uuid);
106   - }
107   -
108 172 String userId = entity.getUserId();
109 173 if (userId != null) {
110   - stmt.bindString(2, userId);
  174 + stmt.bindString(1, userId);
111 175 }
112 176  
113 177 String date = entity.getDate();
114 178 if (date != null) {
115   - stmt.bindString(3, date);
  179 + stmt.bindString(2, date);
116 180 }
117 181  
118 182 String stepCount = entity.getStepCount();
119 183 if (stepCount != null) {
120   - stmt.bindString(4, stepCount);
  184 + stmt.bindString(3, stepCount);
121 185 }
122   - stmt.bindLong(5, entity.getPauseTimeStamp());
123   - stmt.bindLong(6, entity.getRecordTime());
124   - stmt.bindDouble(7, entity.getCaloriesCount());
  186 + stmt.bindLong(4, entity.getRecordTime());
  187 + stmt.bindDouble(5, entity.getCaloriesCount());
125 188  
126 189 String serverTraceData = entity.getServerTraceData();
127 190 if (serverTraceData != null) {
128   - stmt.bindString(8, serverTraceData);
  191 + stmt.bindString(6, serverTraceData);
  192 + }
  193 + stmt.bindLong(7, entity.getStartTimeStamp());
  194 + stmt.bindLong(8, entity.getFinishTimeStamp());
  195 +
  196 + String streetId = entity.getStreetId();
  197 + if (streetId != null) {
  198 + stmt.bindString(9, streetId);
  199 + }
  200 + stmt.bindLong(10, entity.getPauseCount());
  201 + stmt.bindLong(11, entity.getUserPauseTimeStamp());
  202 + stmt.bindLong(12, entity.getChronometerBase());
  203 + stmt.bindLong(13, entity.getQueryTraceStartTime());
  204 + stmt.bindLong(14, entity.getQueryTraceEndTime());
  205 +
  206 + String queryEntityName = entity.getQueryEntityName();
  207 + if (queryEntityName != null) {
  208 + stmt.bindString(15, queryEntityName);
  209 + }
  210 + stmt.bindLong(16, entity.getContinueTime());
  211 + stmt.bindLong(17, entity.getFenceId());
  212 +
  213 + String importPoint = entity.getImportPoint();
  214 + if (importPoint != null) {
  215 + stmt.bindString(18, importPoint);
  216 + }
  217 +
  218 + String streetTitle = entity.getStreetTitle();
  219 + if (streetTitle != null) {
  220 + stmt.bindString(19, streetTitle);
  221 + }
  222 +
  223 + String endLatLng = entity.getEndLatLng();
  224 + if (endLatLng != null) {
  225 + stmt.bindString(20, endLatLng);
  226 + }
  227 + stmt.bindLong(21, entity.getIsArriveEndPoint() ? 1L: 0L);
  228 +
  229 + String collStartLatLngName = entity.getCollStartLatLngName();
  230 + if (collStartLatLngName != null) {
  231 + stmt.bindString(22, collStartLatLngName);
  232 + }
  233 +
  234 + String collStartLatLng = entity.getCollStartLatLng();
  235 + if (collStartLatLng != null) {
  236 + stmt.bindString(23, collStartLatLng);
129 237 }
130 238 }
131 239  
... ... @@ -137,39 +245,69 @@ public class CollUserStepEntityDao extends AbstractDao&lt;CollUserStepEntity, Strin
137 245 @Override
138 246 public CollUserStepEntity readEntity(Cursor cursor, int offset) {
139 247 CollUserStepEntity entity = new CollUserStepEntity( //
140   - cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0), // uuid
141   - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // userId
142   - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // date
143   - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // stepCount
144   - cursor.getLong(offset + 4), // pauseTimeStamp
145   - cursor.getLong(offset + 5), // recordTime
146   - cursor.getDouble(offset + 6), // caloriesCount
147   - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7) // serverTraceData
  248 + cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0), // userId
  249 + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // date
  250 + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // stepCount
  251 + cursor.getLong(offset + 3), // recordTime
  252 + cursor.getDouble(offset + 4), // caloriesCount
  253 + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // serverTraceData
  254 + cursor.getLong(offset + 6), // startTimeStamp
  255 + cursor.getLong(offset + 7), // finishTimeStamp
  256 + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // streetId
  257 + cursor.getInt(offset + 9), // pauseCount
  258 + cursor.getLong(offset + 10), // userPauseTimeStamp
  259 + cursor.getLong(offset + 11), // chronometerBase
  260 + cursor.getLong(offset + 12), // queryTraceStartTime
  261 + cursor.getLong(offset + 13), // queryTraceEndTime
  262 + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // queryEntityName
  263 + cursor.getLong(offset + 15), // continueTime
  264 + cursor.getLong(offset + 16), // fenceId
  265 + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // importPoint
  266 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // streetTitle
  267 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // endLatLng
  268 + cursor.getShort(offset + 20) != 0, // isArriveEndPoint
  269 + cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // collStartLatLngName
  270 + cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22) // collStartLatLng
148 271 );
149 272 return entity;
150 273 }
151 274  
152 275 @Override
153 276 public void readEntity(Cursor cursor, CollUserStepEntity entity, int offset) {
154   - entity.setUuid(cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0));
155   - entity.setUserId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
156   - entity.setDate(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
157   - entity.setStepCount(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
158   - entity.setPauseTimeStamp(cursor.getLong(offset + 4));
159   - entity.setRecordTime(cursor.getLong(offset + 5));
160   - entity.setCaloriesCount(cursor.getDouble(offset + 6));
161   - entity.setServerTraceData(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
  277 + entity.setUserId(cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0));
  278 + entity.setDate(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
  279 + entity.setStepCount(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
  280 + entity.setRecordTime(cursor.getLong(offset + 3));
  281 + entity.setCaloriesCount(cursor.getDouble(offset + 4));
  282 + entity.setServerTraceData(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
  283 + entity.setStartTimeStamp(cursor.getLong(offset + 6));
  284 + entity.setFinishTimeStamp(cursor.getLong(offset + 7));
  285 + entity.setStreetId(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
  286 + entity.setPauseCount(cursor.getInt(offset + 9));
  287 + entity.setUserPauseTimeStamp(cursor.getLong(offset + 10));
  288 + entity.setChronometerBase(cursor.getLong(offset + 11));
  289 + entity.setQueryTraceStartTime(cursor.getLong(offset + 12));
  290 + entity.setQueryTraceEndTime(cursor.getLong(offset + 13));
  291 + entity.setQueryEntityName(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14));
  292 + entity.setContinueTime(cursor.getLong(offset + 15));
  293 + entity.setFenceId(cursor.getLong(offset + 16));
  294 + entity.setImportPoint(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17));
  295 + entity.setStreetTitle(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18));
  296 + entity.setEndLatLng(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19));
  297 + entity.setIsArriveEndPoint(cursor.getShort(offset + 20) != 0);
  298 + entity.setCollStartLatLngName(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21));
  299 + entity.setCollStartLatLng(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22));
162 300 }
163 301  
164 302 @Override
165 303 protected final String updateKeyAfterInsert(CollUserStepEntity entity, long rowId) {
166   - return entity.getUuid();
  304 + return entity.getUserId();
167 305 }
168 306  
169 307 @Override
170 308 public String getKey(CollUserStepEntity entity) {
171 309 if(entity != null) {
172   - return entity.getUuid();
  310 + return entity.getUserId();
173 311 } else {
174 312 return null;
175 313 }
... ... @@ -177,7 +315,7 @@ public class CollUserStepEntityDao extends AbstractDao&lt;CollUserStepEntity, Strin
177 315  
178 316 @Override
179 317 public boolean hasKey(CollUserStepEntity entity) {
180   - return entity.getUuid() != null;
  318 + return entity.getUserId() != null;
181 319 }
182 320  
183 321 @Override
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/sql/dao/DaoMaster.java
... ... @@ -24,6 +24,7 @@ public class DaoMaster extends AbstractDaoMaster {
24 24 CollUserStepEntityDao.createTable(db, ifNotExists);
25 25 FailedEntityDao.createTable(db, ifNotExists);
26 26 UserStepEntityDao.createTable(db, ifNotExists);
  27 + CollFailedEntityDao.createTable(db, ifNotExists);
27 28 }
28 29  
29 30 /** Drops underlying database table using DAOs. */
... ... @@ -31,6 +32,7 @@ public class DaoMaster extends AbstractDaoMaster {
31 32 CollUserStepEntityDao.dropTable(db, ifExists);
32 33 FailedEntityDao.dropTable(db, ifExists);
33 34 UserStepEntityDao.dropTable(db, ifExists);
  35 + CollFailedEntityDao.dropTable(db, ifExists);
34 36 }
35 37  
36 38 /**
... ... @@ -52,6 +54,7 @@ public class DaoMaster extends AbstractDaoMaster {
52 54 registerDaoClass(CollUserStepEntityDao.class);
53 55 registerDaoClass(FailedEntityDao.class);
54 56 registerDaoClass(UserStepEntityDao.class);
  57 + registerDaoClass(CollFailedEntityDao.class);
55 58 }
56 59  
57 60 public DaoSession newSession() {
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/sql/dao/DaoSession.java
... ... @@ -11,10 +11,12 @@ import org.greenrobot.greendao.internal.DaoConfig;
11 11 import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity;
12 12 import com.cnlive.moudle.pedometer.sql.entity.FailedEntity;
13 13 import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity;
  14 +import com.cnlive.moudle.pedometer.sql.entity.CollFailedEntity;
14 15  
15 16 import com.cnlive.moudle.pedometer.sql.dao.CollUserStepEntityDao;
16 17 import com.cnlive.moudle.pedometer.sql.dao.FailedEntityDao;
17 18 import com.cnlive.moudle.pedometer.sql.dao.UserStepEntityDao;
  19 +import com.cnlive.moudle.pedometer.sql.dao.CollFailedEntityDao;
18 20  
19 21 // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
20 22  
... ... @@ -28,10 +30,12 @@ public class DaoSession extends AbstractDaoSession {
28 30 private final DaoConfig collUserStepEntityDaoConfig;
29 31 private final DaoConfig failedEntityDaoConfig;
30 32 private final DaoConfig userStepEntityDaoConfig;
  33 + private final DaoConfig collFailedEntityDaoConfig;
31 34  
32 35 private final CollUserStepEntityDao collUserStepEntityDao;
33 36 private final FailedEntityDao failedEntityDao;
34 37 private final UserStepEntityDao userStepEntityDao;
  38 + private final CollFailedEntityDao collFailedEntityDao;
35 39  
36 40 public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
37 41 daoConfigMap) {
... ... @@ -46,19 +50,25 @@ public class DaoSession extends AbstractDaoSession {
46 50 userStepEntityDaoConfig = daoConfigMap.get(UserStepEntityDao.class).clone();
47 51 userStepEntityDaoConfig.initIdentityScope(type);
48 52  
  53 + collFailedEntityDaoConfig = daoConfigMap.get(CollFailedEntityDao.class).clone();
  54 + collFailedEntityDaoConfig.initIdentityScope(type);
  55 +
49 56 collUserStepEntityDao = new CollUserStepEntityDao(collUserStepEntityDaoConfig, this);
50 57 failedEntityDao = new FailedEntityDao(failedEntityDaoConfig, this);
51 58 userStepEntityDao = new UserStepEntityDao(userStepEntityDaoConfig, this);
  59 + collFailedEntityDao = new CollFailedEntityDao(collFailedEntityDaoConfig, this);
52 60  
53 61 registerDao(CollUserStepEntity.class, collUserStepEntityDao);
54 62 registerDao(FailedEntity.class, failedEntityDao);
55 63 registerDao(UserStepEntity.class, userStepEntityDao);
  64 + registerDao(CollFailedEntity.class, collFailedEntityDao);
56 65 }
57 66  
58 67 public void clear() {
59 68 collUserStepEntityDaoConfig.clearIdentityScope();
60 69 failedEntityDaoConfig.clearIdentityScope();
61 70 userStepEntityDaoConfig.clearIdentityScope();
  71 + collFailedEntityDaoConfig.clearIdentityScope();
62 72 }
63 73  
64 74 public CollUserStepEntityDao getCollUserStepEntityDao() {
... ... @@ -73,4 +83,8 @@ public class DaoSession extends AbstractDaoSession {
73 83 return userStepEntityDao;
74 84 }
75 85  
  86 + public CollFailedEntityDao getCollFailedEntityDao() {
  87 + return collFailedEntityDao;
  88 + }
  89 +
76 90 }
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/sql/entity/CollFailedEntity.java 0 → 100644
  1 +package com.cnlive.moudle.pedometer.sql.entity;
  2 +
  3 +import org.greenrobot.greendao.annotation.Entity;
  4 +import org.greenrobot.greendao.annotation.Generated;
  5 +import org.greenrobot.greendao.annotation.Id;
  6 +
  7 +import java.io.Serializable;
  8 +
  9 +/**
  10 + * 上传失败列表
  11 + *
  12 + * @author ShinnyYang
  13 + */
  14 +@Entity
  15 +public class CollFailedEntity implements Serializable {
  16 + static final long serialVersionUID = 02L;
  17 + @Id
  18 + private String uuid;//主键
  19 + private String uid;//用户id
  20 + private boolean isPause;//是否暂停
  21 + private long userPauseTime;//用户暂停时间
  22 + private long usrContinueTime;//用户继续时间
  23 + private String isFinish;//是否完成
  24 + private String time;//用时
  25 + private String speed;//配速
  26 + private String step;//步数
  27 + private String distance;//距离
  28 + private String startPoint;//开始地点
  29 + private String endPoint;//结束地点
  30 + private long streetTraceStartTime;//赛道开始时间
  31 + private long streetTraceEndTime;//赛道结束时间
  32 + private String entityName;//实体名称
  33 + private long userStartTime;//用户开始时间
  34 + private long userEndTime;//用户结束时间
  35 + private String importPoint;//关键点
  36 + private String streetId;//赛事id
  37 + private String streetTitle;//赛道标题
  38 + private long creatTimeStamp;//数据创建的时间
  39 + private boolean isArriveEndPoint;//是否到达终点
  40 + @Generated(hash = 1512309823)
  41 + public CollFailedEntity(String uuid, String uid, boolean isPause,
  42 + long userPauseTime, long usrContinueTime, String isFinish, String time,
  43 + String speed, String step, String distance, String startPoint,
  44 + String endPoint, long streetTraceStartTime, long streetTraceEndTime,
  45 + String entityName, long userStartTime, long userEndTime,
  46 + String importPoint, String streetId, String streetTitle,
  47 + long creatTimeStamp, boolean isArriveEndPoint) {
  48 + this.uuid = uuid;
  49 + this.uid = uid;
  50 + this.isPause = isPause;
  51 + this.userPauseTime = userPauseTime;
  52 + this.usrContinueTime = usrContinueTime;
  53 + this.isFinish = isFinish;
  54 + this.time = time;
  55 + this.speed = speed;
  56 + this.step = step;
  57 + this.distance = distance;
  58 + this.startPoint = startPoint;
  59 + this.endPoint = endPoint;
  60 + this.streetTraceStartTime = streetTraceStartTime;
  61 + this.streetTraceEndTime = streetTraceEndTime;
  62 + this.entityName = entityName;
  63 + this.userStartTime = userStartTime;
  64 + this.userEndTime = userEndTime;
  65 + this.importPoint = importPoint;
  66 + this.streetId = streetId;
  67 + this.streetTitle = streetTitle;
  68 + this.creatTimeStamp = creatTimeStamp;
  69 + this.isArriveEndPoint = isArriveEndPoint;
  70 + }
  71 + @Generated(hash = 1910302097)
  72 + public CollFailedEntity() {
  73 + }
  74 + public String getUuid() {
  75 + return this.uuid;
  76 + }
  77 + public void setUuid(String uuid) {
  78 + this.uuid = uuid;
  79 + }
  80 + public String getUid() {
  81 + return this.uid;
  82 + }
  83 + public void setUid(String uid) {
  84 + this.uid = uid;
  85 + }
  86 + public boolean getIsPause() {
  87 + return this.isPause;
  88 + }
  89 + public void setIsPause(boolean isPause) {
  90 + this.isPause = isPause;
  91 + }
  92 + public long getUserPauseTime() {
  93 + return this.userPauseTime;
  94 + }
  95 + public void setUserPauseTime(long userPauseTime) {
  96 + this.userPauseTime = userPauseTime;
  97 + }
  98 + public long getUsrContinueTime() {
  99 + return this.usrContinueTime;
  100 + }
  101 + public void setUsrContinueTime(long usrContinueTime) {
  102 + this.usrContinueTime = usrContinueTime;
  103 + }
  104 + public String getIsFinish() {
  105 + return this.isFinish;
  106 + }
  107 + public void setIsFinish(String isFinish) {
  108 + this.isFinish = isFinish;
  109 + }
  110 + public String getTime() {
  111 + return this.time;
  112 + }
  113 + public void setTime(String time) {
  114 + this.time = time;
  115 + }
  116 + public String getSpeed() {
  117 + return this.speed;
  118 + }
  119 + public void setSpeed(String speed) {
  120 + this.speed = speed;
  121 + }
  122 + public String getStep() {
  123 + return this.step;
  124 + }
  125 + public void setStep(String step) {
  126 + this.step = step;
  127 + }
  128 + public String getDistance() {
  129 + return this.distance;
  130 + }
  131 + public void setDistance(String distance) {
  132 + this.distance = distance;
  133 + }
  134 + public String getStartPoint() {
  135 + return this.startPoint;
  136 + }
  137 + public void setStartPoint(String startPoint) {
  138 + this.startPoint = startPoint;
  139 + }
  140 + public String getEndPoint() {
  141 + return this.endPoint;
  142 + }
  143 + public void setEndPoint(String endPoint) {
  144 + this.endPoint = endPoint;
  145 + }
  146 + public long getStreetTraceStartTime() {
  147 + return this.streetTraceStartTime;
  148 + }
  149 + public void setStreetTraceStartTime(long streetTraceStartTime) {
  150 + this.streetTraceStartTime = streetTraceStartTime;
  151 + }
  152 + public long getStreetTraceEndTime() {
  153 + return this.streetTraceEndTime;
  154 + }
  155 + public void setStreetTraceEndTime(long streetTraceEndTime) {
  156 + this.streetTraceEndTime = streetTraceEndTime;
  157 + }
  158 + public String getEntityName() {
  159 + return this.entityName;
  160 + }
  161 + public void setEntityName(String entityName) {
  162 + this.entityName = entityName;
  163 + }
  164 + public long getUserStartTime() {
  165 + return this.userStartTime;
  166 + }
  167 + public void setUserStartTime(long userStartTime) {
  168 + this.userStartTime = userStartTime;
  169 + }
  170 + public long getUserEndTime() {
  171 + return this.userEndTime;
  172 + }
  173 + public void setUserEndTime(long userEndTime) {
  174 + this.userEndTime = userEndTime;
  175 + }
  176 + public String getImportPoint() {
  177 + return this.importPoint;
  178 + }
  179 + public void setImportPoint(String importPoint) {
  180 + this.importPoint = importPoint;
  181 + }
  182 + public String getStreetId() {
  183 + return this.streetId;
  184 + }
  185 + public void setStreetId(String streetId) {
  186 + this.streetId = streetId;
  187 + }
  188 + public String getStreetTitle() {
  189 + return this.streetTitle;
  190 + }
  191 + public void setStreetTitle(String streetTitle) {
  192 + this.streetTitle = streetTitle;
  193 + }
  194 + public long getCreatTimeStamp() {
  195 + return this.creatTimeStamp;
  196 + }
  197 + public void setCreatTimeStamp(long creatTimeStamp) {
  198 + this.creatTimeStamp = creatTimeStamp;
  199 + }
  200 + public boolean getIsArriveEndPoint() {
  201 + return this.isArriveEndPoint;
  202 + }
  203 + public void setIsArriveEndPoint(boolean isArriveEndPoint) {
  204 + this.isArriveEndPoint = isArriveEndPoint;
  205 + }
  206 +
  207 +
  208 +
  209 +}
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/sql/entity/CollUserStepEntity.java
... ... @@ -7,79 +7,252 @@ import org.greenrobot.greendao.annotation.Id;
7 7 @Entity
8 8 public class CollUserStepEntity {
9 9 @Id
10   - private String uuid;
11 10 private String userId;
12 11 private String date;
13 12 private String stepCount;
14   - private long pauseTimeStamp;//暂停时间戳
15 13 private long recordTime;//暂停时间
16 14 private double caloriesCount;//卡路里
17 15 private String serverTraceData;//服务端赛道数据
18   - @Generated(hash = 1080314982)
19   - public CollUserStepEntity(String uuid, String userId, String date,
20   - String stepCount, long pauseTimeStamp, long recordTime,
21   - double caloriesCount, String serverTraceData) {
22   - this.uuid = uuid;
  16 + private long startTimeStamp;
  17 + private long finishTimeStamp;
  18 + private String streetId;//赛事ID
  19 + private int pauseCount;//暂停次数
  20 + private long userPauseTimeStamp;//暂停时间戳
  21 + private long chronometerBase;//计时器设置基础时间
  22 + private long queryTraceStartTime;//从服务器获取的开始时间呢
  23 + private long queryTraceEndTime;//从服务器获取的结束时间呢
  24 + private String queryEntityName;//从服务器获取的运营人员的实体名称
  25 + private long continueTime;//继续运动时间
  26 + private long fenceId;//围栏id
  27 + private String importPoint;//关键点
  28 + private String streetTitle;//赛事标题
  29 + private String endLatLng;//终点坐标
  30 + private boolean isArriveEndPoint;//是否到达终点
  31 + private String collStartLatLngName;//运营打点名称
  32 + private String collStartLatLng;//运营打点名称
  33 +
  34 + @Generated(hash = 1127995406)
  35 + public CollUserStepEntity(String userId, String date, String stepCount, long recordTime, double caloriesCount,
  36 + String serverTraceData, long startTimeStamp, long finishTimeStamp, String streetId, int pauseCount,
  37 + long userPauseTimeStamp, long chronometerBase, long queryTraceStartTime, long queryTraceEndTime,
  38 + String queryEntityName, long continueTime, long fenceId, String importPoint, String streetTitle,
  39 + String endLatLng, boolean isArriveEndPoint, String collStartLatLngName, String collStartLatLng) {
23 40 this.userId = userId;
24 41 this.date = date;
25 42 this.stepCount = stepCount;
26   - this.pauseTimeStamp = pauseTimeStamp;
27 43 this.recordTime = recordTime;
28 44 this.caloriesCount = caloriesCount;
29 45 this.serverTraceData = serverTraceData;
  46 + this.startTimeStamp = startTimeStamp;
  47 + this.finishTimeStamp = finishTimeStamp;
  48 + this.streetId = streetId;
  49 + this.pauseCount = pauseCount;
  50 + this.userPauseTimeStamp = userPauseTimeStamp;
  51 + this.chronometerBase = chronometerBase;
  52 + this.queryTraceStartTime = queryTraceStartTime;
  53 + this.queryTraceEndTime = queryTraceEndTime;
  54 + this.queryEntityName = queryEntityName;
  55 + this.continueTime = continueTime;
  56 + this.fenceId = fenceId;
  57 + this.importPoint = importPoint;
  58 + this.streetTitle = streetTitle;
  59 + this.endLatLng = endLatLng;
  60 + this.isArriveEndPoint = isArriveEndPoint;
  61 + this.collStartLatLngName = collStartLatLngName;
  62 + this.collStartLatLng = collStartLatLng;
30 63 }
  64 +
31 65 @Generated(hash = 681143087)
32 66 public CollUserStepEntity() {
33 67 }
34   - public String getUuid() {
35   - return this.uuid;
36   - }
37   - public void setUuid(String uuid) {
38   - this.uuid = uuid;
39   - }
  68 +
40 69 public String getUserId() {
41 70 return this.userId;
42 71 }
  72 +
43 73 public void setUserId(String userId) {
44 74 this.userId = userId;
45 75 }
  76 +
46 77 public String getDate() {
47 78 return this.date;
48 79 }
  80 +
49 81 public void setDate(String date) {
50 82 this.date = date;
51 83 }
  84 +
52 85 public String getStepCount() {
53 86 return this.stepCount;
54 87 }
  88 +
55 89 public void setStepCount(String stepCount) {
56 90 this.stepCount = stepCount;
57 91 }
58   - public long getPauseTimeStamp() {
59   - return this.pauseTimeStamp;
60   - }
61   - public void setPauseTimeStamp(long pauseTimeStamp) {
62   - this.pauseTimeStamp = pauseTimeStamp;
63   - }
  92 +
64 93 public long getRecordTime() {
65 94 return this.recordTime;
66 95 }
  96 +
67 97 public void setRecordTime(long recordTime) {
68 98 this.recordTime = recordTime;
69 99 }
  100 +
70 101 public double getCaloriesCount() {
71 102 return this.caloriesCount;
72 103 }
  104 +
73 105 public void setCaloriesCount(double caloriesCount) {
74 106 this.caloriesCount = caloriesCount;
75 107 }
  108 +
76 109 public String getServerTraceData() {
77 110 return this.serverTraceData;
78 111 }
  112 +
79 113 public void setServerTraceData(String serverTraceData) {
80 114 this.serverTraceData = serverTraceData;
81 115 }
82 116  
83 117  
  118 + public long getStartTimeStamp() {
  119 + return this.startTimeStamp;
  120 + }
  121 +
  122 + public void setStartTimeStamp(long startTimeStamp) {
  123 + this.startTimeStamp = startTimeStamp;
  124 + }
  125 +
  126 + public long getFinishTimeStamp() {
  127 + return this.finishTimeStamp;
  128 + }
  129 +
  130 + public void setFinishTimeStamp(long finishTimeStamp) {
  131 + this.finishTimeStamp = finishTimeStamp;
  132 + }
  133 +
  134 + public String getStreetId() {
  135 + return this.streetId;
  136 + }
  137 +
  138 + public void setStreetId(String streetId) {
  139 + this.streetId = streetId;
  140 + }
  141 +
  142 + public int getPauseCount() {
  143 + return this.pauseCount;
  144 + }
  145 +
  146 + public void setPauseCount(int pauseCount) {
  147 + this.pauseCount = pauseCount;
  148 + }
  149 +
  150 + public long getUserPauseTimeStamp() {
  151 + return this.userPauseTimeStamp;
  152 + }
  153 +
  154 + public void setUserPauseTimeStamp(long userPauseTimeStamp) {
  155 + this.userPauseTimeStamp = userPauseTimeStamp;
  156 + }
  157 +
  158 + public long getChronometerBase() {
  159 + return this.chronometerBase;
  160 + }
  161 +
  162 + public void setChronometerBase(long chronometerBase) {
  163 + this.chronometerBase = chronometerBase;
  164 + }
  165 +
  166 + public long getQueryTraceStartTime() {
  167 + return this.queryTraceStartTime;
  168 + }
  169 +
  170 + public void setQueryTraceStartTime(long queryTraceStartTime) {
  171 + this.queryTraceStartTime = queryTraceStartTime;
  172 + }
  173 +
  174 + public long getQueryTraceEndTime() {
  175 + return this.queryTraceEndTime;
  176 + }
  177 +
  178 + public void setQueryTraceEndTime(long queryTraceEndTime) {
  179 + this.queryTraceEndTime = queryTraceEndTime;
  180 + }
  181 +
  182 + public String getQueryEntityName() {
  183 + return this.queryEntityName;
  184 + }
  185 +
  186 + public void setQueryEntityName(String queryEntityName) {
  187 + this.queryEntityName = queryEntityName;
  188 + }
  189 +
  190 + public long getContinueTime() {
  191 + return this.continueTime;
  192 + }
  193 +
  194 + public void setContinueTime(long continueTime) {
  195 + this.continueTime = continueTime;
  196 + }
  197 +
  198 + public long getFenceId() {
  199 + return this.fenceId;
  200 + }
  201 +
  202 + public void setFenceId(long fenceId) {
  203 + this.fenceId = fenceId;
  204 + }
  205 +
  206 + public String getImportPoint() {
  207 + return this.importPoint;
  208 + }
  209 +
  210 + public void setImportPoint(String importPoint) {
  211 + this.importPoint = importPoint;
  212 + }
  213 +
  214 + public String getStreetTitle() {
  215 + return this.streetTitle;
  216 + }
  217 +
  218 + public void setStreetTitle(String streetTitle) {
  219 + this.streetTitle = streetTitle;
  220 + }
  221 +
  222 + public String getEndLatLng() {
  223 + return this.endLatLng;
  224 + }
  225 +
  226 + public void setEndLatLng(String endLatLng) {
  227 + this.endLatLng = endLatLng;
  228 + }
  229 +
  230 + public boolean getIsArriveEndPoint() {
  231 + return this.isArriveEndPoint;
  232 + }
  233 +
  234 + public void setIsArriveEndPoint(boolean isArriveEndPoint) {
  235 + this.isArriveEndPoint = isArriveEndPoint;
  236 + }
  237 +
  238 + public String getCollStartLatLngName() {
  239 + return this.collStartLatLngName;
  240 + }
  241 +
  242 + public void setCollStartLatLngName(String collStartLatLngName) {
  243 + this.collStartLatLngName = collStartLatLngName;
  244 + }
  245 +
  246 + public String getCollStartLatLng() {
  247 + return this.collStartLatLng;
  248 + }
  249 +
  250 + public void setCollStartLatLng(String collStartLatLng) {
  251 + this.collStartLatLng = collStartLatLng;
  252 + }
  253 +
  254 +
  255 +
  256 +
84 257  
85 258 }
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/CollStepUtil.java deleted 100644 → 0
1   -package com.cnlive.moudle.pedometer.utils;
2   -
3   -import android.content.Context;
4   -import android.text.TextUtils;
5   -import android.util.Log;
6   -
7   -import com.cnlive.moudle.pedometer.sql.dao.CollUserStepEntityDao;
8   -import com.cnlive.moudle.pedometer.sql.dao.UserStepEntityDao;
9   -import com.cnlive.moudle.pedometer.sql.db.DbCore;
10   -import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity;
11   -import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity;
12   -
13   -import java.text.SimpleDateFormat;
14   -import java.util.Date;
15   -import java.util.List;
16   -
17   -/**
18   - * 步数工具
19   - *
20   - * @author ShinnyYang
21   - */
22   -public class CollStepUtil {
23   - private static final String TAG = "CollStepUtil";
24   - private static final String dbName = "CollStep.db";
25   -
26   -
27   - /**
28   - * 计算配速
29   - */
30   - public static String getPaceSpeed(double second, double distance) {
31   - if (distance != 0) {
32   - //计算分
33   - int minute = (int) (second / distance / 60);
34   - //获取秒
35   - double miaoMin = ((double) (second / distance / 60)) - ((int) (second / distance / 60));
36   - int miao = (int) (miaoMin * 60);
37   - return minute + "'" + miao + "''";
38   - } else {
39   - return "--";
40   - }
41   - }
42   -
43   - /**
44   - * 更新数据
45   - *
46   - * @param context
47   - * @param userStepEntity
48   - */
49   - public static void updateStepData(Context context, CollUserStepEntity userStepEntity) {
50   - if (userStepEntity != null) {
51   - DbCore.init(context, dbName);
52   - DbCore.getDaoSession().getCollUserStepEntityDao().update(userStepEntity);
53   - }
54   -
55   - }
56   -
57   - /**
58   - * 得到当前速度
59   - *
60   - * @param time
61   - * @param distance
62   - * @return
63   - */
64   - public static double getCurrentSpeed(double time, double distance) {
65   - double result = distance / time;
66   - result = Double.parseDouble(String.format("%1.2f", result));
67   - return result;
68   - }
69   -
70   - /**
71   - * 根据行走步数,计算大概行走具体
72   - * 单位:公里
73   - * 1步的距离大概是60厘米。
74   - * 1万多步,距离大概就是600000厘米,即6000米(6公里)
75   - *
76   - * @param step
77   - * @return
78   - */
79   - public static double getWalkDistanceKM(long step) {
80   - double result = step * 60.0 / 100.0 / 1000.0;
81   - result = Double.parseDouble(String.format("%1.2f", result));
82   - return result;
83   - }
84   -
85   - /**
86   - * 清除保存数据库中的数据
87   - *
88   - * @param uid
89   - */
90   - public static void clearRunData(Context context, String uid) {
91   - DbCore.init(context, dbName);
92   - String CURRENT_DATE = getTodayDate();
93   - List<CollUserStepEntity> list = DbCore.getDaoSession().getCollUserStepEntityDao().queryBuilder().where(CollUserStepEntityDao.Properties.UserId.eq(uid), CollUserStepEntityDao.Properties.Date.eq(CURRENT_DATE)).list();
94   - if (list != null && list.size() > 0) {
95   - Log.e(TAG, "clearRunData: " + list.size());
96   - DbCore.getDaoSession().getCollUserStepEntityDao().deleteByKey(list.get(0).getUuid());
97   - DbCore.getDaoSession().getCollUserStepEntityDao().detachAll();
98   - }
99   - }
100   -
101   - /**
102   - * 获取用户数据
103   - *
104   - * @param context
105   - * @param uid
106   - * @return
107   - */
108   - public static CollUserStepEntity getCollUserStepData(Context context, String uid) {
109   - if (!TextUtils.isEmpty(uid)) {
110   - DbCore.init(context, dbName);
111   - DbCore.getDaoSession().getCollUserStepEntityDao().detachAll();
112   - DbCore.getDaoSession().clear();
113   - String CURRENT_DATE = getTodayDate();
114   - List<CollUserStepEntity> list = DbCore.getDaoSession().getCollUserStepEntityDao().queryBuilder().where(CollUserStepEntityDao.Properties.UserId.eq(uid), CollUserStepEntityDao.Properties.Date.eq(CURRENT_DATE)).list();
115   - if (list != null && list.size() > 0) {
116   - return list.get(0);
117   - } else {
118   - return null;
119   - }
120   - } else {
121   - return null;
122   - }
123   - }
124   -
125   - /**
126   - * 获取用户数据
127   - *
128   - * @param context
129   - * @param uid
130   - * @return
131   - */
132   - public static void setServerTraceData(Context context, String uid, CollUserStepEntity userStepEntity) {
133   - if (getCollUserStepData(context, uid) != null) {
134   - CollUserStepEntity entity = getCollUserStepData(context, uid);
135   - } else {
136   -
137   - }
138   - }
139   -
140   - /**
141   - * 获取当天日期
142   - *
143   - * @return
144   - */
145   - private static String getTodayDate() {
146   - Date date = new Date(System.currentTimeMillis());
147   - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
148   - return sdf.format(date);
149   - }
150   -
151   -
152   -}
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/MyMapUtil.java
... ... @@ -52,6 +52,55 @@ public class MyMapUtil {
52 52 private static int pageIndex = 1;
53 53 private static List<LatLng> trackPoints;
54 54  
  55 + public static List<Overlay> setStartMarker(Context context, BaiduMap baiduMap, LatLng startLatLng, int startIconRes) {
  56 + if (0 == startIconRes || null == startLatLng || null == context || null == baiduMap) {
  57 + return null;
  58 + }
  59 + List<Overlay> resultOverlays = new ArrayList<>();
  60 + try {
  61 + Bitmap pointBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), startIconRes), 24, 30);
  62 + OverlayOptions startOptions = null;
  63 + if (pointBitmap != null) {
  64 + startOptions = new MarkerOptions().position(startLatLng).icon(BitmapDescriptorFactory.fromBitmap(pointBitmap));
  65 + }
  66 +
  67 + // 添加圆形范围
  68 + Bitmap startCircleBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), R.drawable.circle_point_raduis), 60, 60);
  69 + OverlayOptions startCircleOptions = null;
  70 + if (startCircleBitmap != null) {
  71 + startCircleOptions = new MarkerOptions()
  72 + .position(startLatLng)
  73 + .icon(BitmapDescriptorFactory.fromBitmap(startCircleBitmap))
  74 + .perspective(false)
  75 + .anchor(0.5f, 0.6f)
  76 + .animateType(MarkerOptions.MarkerAnimateType.grow);
  77 +
  78 + }
  79 + if (startCircleOptions != null) {
  80 + resultOverlays.add(baiduMap.addOverlay(startCircleOptions));
  81 + }
  82 + if (startOptions != null) {
  83 + resultOverlays.add(baiduMap.addOverlay(startOptions));
  84 +
  85 + }
  86 + if (resultOverlays != null) {
  87 + return resultOverlays;
  88 + } else {
  89 + return null;
  90 + }
  91 + } catch (
  92 + Exception e) {
  93 + return null;
  94 + }
  95 + }
  96 +
  97 + /**
  98 + * 根据点位信息,自动缩放地图
  99 + *
  100 + * @param baiduMap
  101 + * @param trackPoints
  102 + * @param zoomBy
  103 + */
55 104 public static void setMapAutoZoom(BaiduMap baiduMap, List<LatLng> trackPoints, float zoomBy) {
56 105 LatLngBounds.Builder builder = new LatLngBounds.Builder();
57 106 for (LatLng latLng : trackPoints) {
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/StepUtil.java
... ... @@ -10,6 +10,7 @@ import com.cnlive.moudle.pedometer.sql.dao.CollUserStepEntityDao;
10 10 import com.cnlive.moudle.pedometer.sql.dao.FailedEntityDao;
11 11 import com.cnlive.moudle.pedometer.sql.dao.UserStepEntityDao;
12 12 import com.cnlive.moudle.pedometer.sql.db.DbCore;
  13 +import com.cnlive.moudle.pedometer.sql.entity.CollFailedEntity;
13 14 import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity;
14 15 import com.cnlive.moudle.pedometer.sql.entity.FailedEntity;
15 16 import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity;
... ... @@ -83,6 +84,12 @@ public class StepUtil {
83 84 DbCore.getDaoSession().getFailedEntityDao().insert(failedEntity);
84 85 }
85 86  
  87 + //设置运营失败数据
  88 + public static void setCollFailData(Context context, CollFailedEntity failedEntity) {
  89 + DbCore.init(context, dbName);
  90 + DbCore.getDaoSession().getCollFailedEntityDao().insert(failedEntity);
  91 + }
  92 +
86 93 /**
87 94 * 设置赛事标题
88 95 *
... ... @@ -99,6 +106,8 @@ public class StepUtil {
99 106 }
100 107 }
101 108  
  109 +
  110 +
102 111 /**
103 112 * 设置重要点
104 113 *
... ... @@ -201,6 +210,8 @@ public class StepUtil {
201 210  
202 211 }
203 212  
  213 +
  214 +
204 215 /**
205 216 * 得到当前速度
206 217 *
... ... @@ -326,6 +337,8 @@ public class StepUtil {
326 337 }
327 338 }
328 339  
  340 +
  341 +
329 342 /**
330 343 * 设置计步开始时间
331 344 *
... ... @@ -360,6 +373,8 @@ public class StepUtil {
360 373 }
361 374  
362 375  
  376 +
  377 +
363 378 /**
364 379 * 获取用户暂停次数
365 380 *
... ...
moudle_pedometer/src/main/res/drawable-hdpi/icon_slide_up.png 0 → 100644

469 Bytes

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

517 Bytes

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

1002 Bytes

moudle_pedometer/src/main/res/layout/fragment_coll_run_main.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
  5 + android:layout_width="match_parent"
  6 + android:layout_height="match_parent"
  7 + android:orientation="vertical">
  8 +
  9 + <FrameLayout
  10 + android:layout_width="match_parent"
  11 + android:layout_height="match_parent">
  12 +
  13 + <LinearLayout
  14 + android:id="@+id/ll_run_main_root"
  15 + android:layout_width="match_parent"
  16 + android:layout_height="match_parent"
  17 + android:background="@color/run_main_bg"
  18 + android:orientation="vertical">
  19 +
  20 + <RelativeLayout
  21 + android:id="@+id/rl_close"
  22 + android:layout_width="match_parent"
  23 + android:layout_height="wrap_content"
  24 + android:visibility="gone">
  25 +
  26 + <ImageView
  27 + android:layout_width="25dp"
  28 + android:layout_height="25dp"
  29 + android:layout_alignParentRight="true"
  30 + android:layout_margin="10dp"
  31 + android:src="@drawable/icon_right_close" />
  32 + </RelativeLayout>
  33 + <!--公里数显示-->
  34 + <FrameLayout
  35 + android:layout_width="match_parent"
  36 + android:layout_height="0dp"
  37 + android:layout_weight="1.2">
  38 +
  39 + <LinearLayout
  40 + android:layout_width="match_parent"
  41 + android:layout_height="match_parent"
  42 + android:gravity="center"
  43 + android:paddingLeft="50dp">
  44 +
  45 + <TextView
  46 + android:id="@+id/tv_run_distance"
  47 + android:layout_width="wrap_content"
  48 + android:layout_height="wrap_content"
  49 + android:text="0.00"
  50 + android:textColor="@color/white"
  51 + android:textSize="70sp"
  52 + android:textStyle="bold" />
  53 +
  54 + <TextView
  55 + android:layout_width="wrap_content"
  56 + android:layout_height="wrap_content"
  57 + android:layout_marginLeft="10dp"
  58 + android:layout_marginTop="20dp"
  59 + android:text="公里"
  60 + android:textColor="@color/white"
  61 + android:textSize="15sp" />
  62 + </LinearLayout>
  63 +
  64 + <LinearLayout
  65 + android:id="@+id/ll_back"
  66 + android:layout_width="wrap_content"
  67 + android:layout_height="wrap_content"
  68 + android:padding="10dp">
  69 +
  70 + <ImageView
  71 + android:layout_width="12dp"
  72 + android:layout_height="20dp"
  73 + android:layout_margin="10dp"
  74 + android:background="@drawable/icon_white_back" />
  75 + </LinearLayout>
  76 + </FrameLayout>
  77 + <!--GPS信息-->
  78 + <LinearLayout
  79 + android:layout_width="match_parent"
  80 + android:layout_height="0dp"
  81 + android:layout_weight="2.2"
  82 + android:orientation="vertical">
  83 +
  84 + <RelativeLayout
  85 + android:id="@+id/rl_gps"
  86 + android:layout_width="match_parent"
  87 + android:layout_height="wrap_content">
  88 +
  89 + <TextView
  90 + android:id="@+id/tv_gps"
  91 + android:layout_width="wrap_content"
  92 + android:layout_height="wrap_content"
  93 + android:layout_centerVertical="true"
  94 + android:layout_marginLeft="20dp"
  95 + android:text="GPS"
  96 + android:textColor="@color/white"
  97 + android:textSize="18sp"
  98 + android:textStyle="bold" />
  99 +
  100 + <ImageView
  101 + android:id="@+id/iv_gps"
  102 + android:layout_width="18dp"
  103 + android:layout_height="5dp"
  104 + android:layout_centerVertical="true"
  105 + android:layout_marginLeft="5dp"
  106 + android:layout_toRightOf="@id/tv_gps" />
  107 +
  108 + <TextView
  109 + android:id="@+id/tv_look_trace"
  110 + android:layout_width="wrap_content"
  111 + android:layout_height="wrap_content"
  112 + android:layout_centerVertical="true"
  113 + android:layout_marginLeft="5dp"
  114 + android:layout_toRightOf="@id/iv_gps"
  115 + android:textColor="@color/text_gray99"
  116 + android:textSize="12sp"
  117 + android:textStyle="bold" />
  118 +
  119 + <LinearLayout
  120 + android:layout_width="wrap_content"
  121 + android:layout_height="wrap_content"
  122 + android:layout_alignParentRight="true"
  123 + android:layout_marginRight="15dp"
  124 + android:gravity="center"
  125 + android:orientation="vertical">
  126 +
  127 + <ImageView
  128 + android:layout_width="55dp"
  129 + android:layout_height="55dp"
  130 + android:src="@drawable/rt_ic_home_map" />
  131 +
  132 + <TextView
  133 + android:layout_width="wrap_content"
  134 + android:layout_height="wrap_content"
  135 + android:layout_marginTop="5dp"
  136 + android:text="点击查看轨迹"
  137 + android:textColor="@color/text_gray99"
  138 + android:textSize="10sp" />
  139 + </LinearLayout>
  140 + </RelativeLayout>
  141 + <!--计时-->
  142 + <LinearLayout
  143 + android:layout_width="match_parent"
  144 + android:layout_height="wrap_content"
  145 + android:layout_marginTop="35dp">
  146 +
  147 + <LinearLayout
  148 + android:layout_width="0dp"
  149 + android:layout_height="wrap_content"
  150 + android:layout_weight="1"
  151 + android:gravity="center"
  152 + android:orientation="vertical">
  153 +
  154 + <ImageView
  155 + android:layout_width="26dp"
  156 + android:layout_height="23dp"
  157 + android:layout_marginBottom="5dp"
  158 + android:src="@drawable/sport_speed" />
  159 +
  160 + <LinearLayout
  161 + android:layout_width="match_parent"
  162 + android:layout_height="wrap_content"
  163 + android:gravity="center">
  164 +
  165 + <TextView
  166 + android:id="@+id/tv_speed"
  167 + android:layout_width="wrap_content"
  168 + android:layout_height="wrap_content"
  169 + android:text="--"
  170 + android:textColor="@color/white"
  171 + android:textSize="20sp"
  172 + android:textStyle="bold" />
  173 +
  174 + </LinearLayout>
  175 +
  176 + <TextView
  177 + android:layout_width="wrap_content"
  178 + android:layout_height="wrap_content"
  179 + android:layout_marginTop="5dp"
  180 + android:gravity="center"
  181 + android:text="配速"
  182 + android:textColor="@color/text_gray99"
  183 + android:textSize="15sp" />
  184 + </LinearLayout>
  185 + <!--用时-->
  186 + <LinearLayout
  187 + android:layout_width="0dp"
  188 + android:layout_height="wrap_content"
  189 + android:layout_weight="1"
  190 + android:gravity="center"
  191 + android:orientation="vertical">
  192 +
  193 + <ImageView
  194 + android:layout_width="23dp"
  195 + android:layout_height="25dp"
  196 + android:layout_marginBottom="5dp"
  197 + android:src="@drawable/sport_time_cost" />
  198 +
  199 + <Chronometer
  200 + android:id="@+id/chronometer"
  201 + android:layout_width="wrap_content"
  202 + android:layout_height="wrap_content"
  203 + android:format="00:00:00"
  204 + android:textColor="@color/white"
  205 + android:textSize="20sp"
  206 + android:textStyle="bold" />
  207 +
  208 + <TextView
  209 + android:layout_width="wrap_content"
  210 + android:layout_height="wrap_content"
  211 + android:layout_marginTop="5dp"
  212 + android:gravity="center"
  213 + android:text="用时"
  214 + android:textColor="@color/text_gray99"
  215 + android:textSize="15sp" />
  216 + </LinearLayout>
  217 + <!--热量-->
  218 + <LinearLayout
  219 + android:layout_width="0dp"
  220 + android:layout_height="wrap_content"
  221 + android:layout_weight="1"
  222 + android:gravity="center"
  223 + android:orientation="vertical">
  224 +
  225 + <ImageView
  226 + android:layout_width="26dp"
  227 + android:layout_height="24dp"
  228 + android:layout_marginBottom="5dp"
  229 + android:src="@drawable/sport_step" />
  230 +
  231 + <TextView
  232 + android:id="@+id/tv_step_count"
  233 + android:layout_width="match_parent"
  234 + android:layout_height="wrap_content"
  235 + android:gravity="center"
  236 + android:text="--"
  237 + android:textColor="@color/white"
  238 + android:textSize="20sp"
  239 + android:textStyle="bold" />
  240 +
  241 + <TextView
  242 + android:layout_width="wrap_content"
  243 + android:layout_height="wrap_content"
  244 + android:layout_marginTop="5dp"
  245 + android:gravity="center"
  246 + android:text="步"
  247 + android:textColor="@color/text_gray99"
  248 + android:textSize="15sp" />
  249 + </LinearLayout>
  250 + </LinearLayout>
  251 +
  252 + <RelativeLayout
  253 + android:layout_width="match_parent"
  254 + android:layout_height="wrap_content">
  255 + <!--限制速度-->
  256 + <TextView
  257 + android:layout_width="wrap_content"
  258 + android:layout_height="wrap_content"
  259 + android:layout_marginLeft="15dp"
  260 + android:layout_marginTop="10dp"
  261 + android:text="限速10m/s"
  262 + android:textColor="@color/white"
  263 + android:textSize="15sp"
  264 + android:visibility="gone" />
  265 +
  266 +
  267 + </RelativeLayout>
  268 + <!--按钮-->
  269 + <FrameLayout
  270 + android:layout_width="match_parent"
  271 + android:layout_height="match_parent">
  272 + <!--底部;两个按钮-->
  273 + <LinearLayout
  274 + android:id="@+id/ll_two_bottom_button"
  275 + android:layout_width="match_parent"
  276 + android:layout_height="wrap_content"
  277 + android:layout_gravity="center"
  278 + android:layout_marginBottom="25dp"
  279 + android:gravity="center_horizontal"
  280 + android:visibility="visible">
  281 +
  282 + <LinearLayout
  283 + android:layout_width="wrap_content"
  284 + android:layout_height="match_parent"
  285 + android:layout_marginRight="50dp"
  286 + android:orientation="vertical"
  287 + android:visibility="gone">
  288 +
  289 + <FrameLayout
  290 + android:layout_width="match_parent"
  291 + android:layout_height="wrap_content"
  292 + android:layout_marginTop="10dp"
  293 + android:visibility="invisible">
  294 +
  295 + <ImageView
  296 + android:layout_width="72dp"
  297 + android:layout_height="33dp"
  298 + android:layout_gravity="center" />
  299 +
  300 + <TextView
  301 + android:layout_width="wrap_content"
  302 + android:layout_height="wrap_content"
  303 + android:layout_gravity="center"
  304 + android:layout_marginBottom="5dp"
  305 + android:gravity="center"
  306 + android:src="@drawable/bg_tips_bottom_center"
  307 + android:textSize="12sp" />
  308 + </FrameLayout>
  309 + <!--暂停-->
  310 + <FrameLayout
  311 + android:layout_width="wrap_content"
  312 + android:layout_height="wrap_content">
  313 +
  314 + <FrameLayout
  315 + android:id="@+id/fl_continue"
  316 + android:layout_width="85dp"
  317 + android:layout_height="85dp"
  318 + android:layout_margin="10dp"
  319 + android:background="@drawable/shape_green_round"
  320 + android:focusable="true">
  321 +
  322 + <ImageView
  323 + android:layout_width="17dp"
  324 + android:layout_height="20dp"
  325 + android:layout_gravity="center"
  326 + android:layout_marginBottom="10dp"
  327 + android:background="@drawable/rt_training_button_resume"
  328 + android:focusable="false" />
  329 +
  330 + <TextView
  331 + android:layout_width="wrap_content"
  332 + android:layout_height="wrap_content"
  333 + android:layout_gravity="center"
  334 + android:layout_marginTop="15dp"
  335 + android:focusable="false"
  336 + android:text="继续"
  337 + android:textColor="@color/white"
  338 + android:textSize="14sp" />
  339 + </FrameLayout>
  340 + <!--暂停-->
  341 + <FrameLayout
  342 + android:id="@+id/fl_pause"
  343 + android:layout_width="85dp"
  344 + android:layout_height="85dp"
  345 + android:layout_margin="10dp"
  346 + android:background="@drawable/shape_white_round"
  347 + android:focusable="true">
  348 +
  349 + <ImageView
  350 + android:layout_width="wrap_content"
  351 + android:layout_height="18dp"
  352 + android:layout_gravity="center"
  353 + android:layout_marginBottom="10dp"
  354 + android:background="@drawable/rt_training_button_pause"
  355 + android:focusable="false" />
  356 +
  357 + <TextView
  358 + android:layout_width="wrap_content"
  359 + android:layout_height="wrap_content"
  360 + android:layout_gravity="center"
  361 + android:layout_marginTop="15dp"
  362 + android:focusable="false"
  363 + android:text="暂停"
  364 + android:textColor="@color/blacktext"
  365 + android:textSize="14sp" />
  366 + </FrameLayout>
  367 + <!---->
  368 + </FrameLayout>
  369 + </LinearLayout>
  370 +
  371 + <LinearLayout
  372 + android:layout_width="wrap_content"
  373 + android:layout_height="match_parent"
  374 + android:orientation="vertical">
  375 +
  376 + <FrameLayout
  377 + android:id="@+id/fl_stop_tip"
  378 + android:layout_width="match_parent"
  379 + android:layout_height="wrap_content"
  380 + android:layout_marginTop="10dp"
  381 + android:visibility="invisible">
  382 +
  383 + <ImageView
  384 + android:layout_width="72dp"
  385 + android:layout_height="33dp"
  386 + android:layout_gravity="center"
  387 + android:background="@drawable/bg_tips_bottom_center" />
  388 +
  389 + <TextView
  390 + android:layout_width="wrap_content"
  391 + android:layout_height="wrap_content"
  392 + android:layout_gravity="center"
  393 + android:layout_marginBottom="3dp"
  394 + android:gravity="center"
  395 + android:src="@drawable/bg_tips_bottom_center"
  396 + android:text="长按结束"
  397 + android:textSize="12sp" />
  398 + </FrameLayout>
  399 +
  400 + <FrameLayout
  401 + android:id="@+id/fl_stop"
  402 + android:layout_width="85dp"
  403 + android:layout_height="85dp"
  404 + android:layout_margin="10dp"
  405 + android:background="@drawable/shape_red_round">
  406 +
  407 + <com.cnlive.moudle.pedometer.ui.widget.CircularProgressBar
  408 + android:id="@+id/cp_current"
  409 + android:layout_width="match_parent"
  410 + android:layout_height="match_parent"
  411 + android:layout_margin="7dp"
  412 + android:visibility="gone" />
  413 +
  414 + <ImageView
  415 + android:layout_width="17dp"
  416 + android:layout_height="17dp"
  417 + android:layout_gravity="center"
  418 + android:layout_marginBottom="10dp"
  419 + android:background="@drawable/rt_training_button_stop"
  420 + android:focusable="false" />
  421 +
  422 + <TextView
  423 + android:layout_width="wrap_content"
  424 + android:layout_height="wrap_content"
  425 + android:layout_gravity="center"
  426 + android:layout_marginTop="15dp"
  427 + android:focusable="false"
  428 + android:text="结束"
  429 + android:textColor="@color/white"
  430 + android:textSize="14sp" />
  431 + </FrameLayout>
  432 + </LinearLayout>
  433 + </LinearLayout>
  434 + <!--暂停按钮-->
  435 + <!--<LinearLayout-->
  436 + <!--android:id="@+id/ll_pause"-->
  437 + <!--android:layout_width="match_parent"-->
  438 + <!--android:layout_height="match_parent"-->
  439 + <!--android:gravity="center">-->
  440 +
  441 + <!--<FrameLayout-->
  442 + <!--android:id="@+id/fl_pause"-->
  443 + <!--android:layout_width="85dp"-->
  444 + <!--android:layout_height="85dp"-->
  445 + <!--android:layout_marginBottom="12dp"-->
  446 + <!--android:background="@drawable/shape_white_round"-->
  447 + <!--android:focusable="true">-->
  448 +
  449 + <!--<ImageView-->
  450 + <!--android:layout_width="15dp"-->
  451 + <!--android:layout_height="18dp"-->
  452 + <!--android:layout_gravity="center"-->
  453 + <!--android:layout_marginBottom="10dp"-->
  454 + <!--android:background="@drawable/rt_training_button_pause"-->
  455 + <!--android:focusable="false" />-->
  456 +
  457 + <!--<TextView-->
  458 + <!--android:layout_width="wrap_content"-->
  459 + <!--android:layout_height="wrap_content"-->
  460 + <!--android:layout_gravity="center"-->
  461 + <!--android:layout_marginTop="15dp"-->
  462 + <!--android:focusable="false"-->
  463 + <!--android:text="暂停"-->
  464 + <!--android:textColor="@color/blacktext"-->
  465 + <!--android:textSize="14sp" />-->
  466 + <!--</FrameLayout>-->
  467 + <!--</LinearLayout>-->
  468 + </FrameLayout>
  469 + </LinearLayout>
  470 + </LinearLayout>
  471 + <!---->
  472 + </FrameLayout>
  473 + </LinearLayout>
  474 +</layout>
0 475 \ No newline at end of file
... ...
moudle_pedometer/src/main/res/layout/fragment_collect_run_race_detail.xml
... ... @@ -2,111 +2,139 @@
2 2 <layout xmlns:android="http://schemas.android.com/apk/res/android"
3 3 xmlns:app="http://schemas.android.com/apk/res-auto">
4 4  
5   - <com.sothree.slidinguppanel.SlidingUpPanelLayout xmlns:sothree="http://schemas.android.com/apk/res-auto"
6   - android:id="@+id/sliding_layout"
  5 + <FrameLayout
7 6 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="100dp"
14   - sothree:umanoParallaxOffset="250dp"
15   - sothree:umanoScrollableView="@+id/scrollView"
16   - sothree:umanoShadowHeight="0dp">
17   -
18   - <!-- MAIN CONTENT -->
19   - <LinearLayout
  7 + android:layout_height="match_parent">
  8 +
  9 + <com.sothree.slidinguppanel.SlidingUpPanelLayout xmlns:sothree="http://schemas.android.com/apk/res-auto"
  10 + android:id="@+id/sliding_layout"
20 11 android:layout_width="match_parent"
21 12 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" />
  13 + android:gravity="bottom"
  14 + sothree:umanoDragView="@+id/dragView"
  15 + sothree:umanoFadeColor="@color/black_20"
  16 + sothree:umanoOverlay="true"
  17 + sothree:umanoParallaxOffset="250dp"
  18 + sothree:umanoScrollableView="@+id/scrollView"
  19 + sothree:umanoShadowHeight="0dp">
29 20  
30   - <FrameLayout
31   - android:id="@+id/fl_root"
  21 + <!-- MAIN CONTENT -->
  22 + <LinearLayout
32 23 android:layout_width="match_parent"
33   - android:layout_height="match_parent">
  24 + android:layout_height="match_parent"
  25 + android:orientation="vertical">
34 26  
35   - <com.baidu.mapapi.map.MapView
36   - android:id="@+id/mapView"
  27 + <com.qmuiteam.qmui.widget.QMUITopBar
  28 + android:id="@+id/topbar"
37 29 android:layout_width="match_parent"
38   - android:layout_height="match_parent"></com.baidu.mapapi.map.MapView>
  30 + android:layout_height="?attr/qmui_topbar_height"
  31 + app:qmui_topbar_text_btn_color_state_list="@color/text_black" />
39 32  
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="90dp"
52   - android:layout_height="35dp"
53   - android:layout_gravity="center"
54   - android:layout_marginBottom="100dp"
55   - android:background="@drawable/shape_circle_30_btn_black_green"
56   - android:text="@string/layout_collect_bind_trace"
57   - android:textColor="@color/green_round"
58   - android:textSize="15sp"
59   - android:textStyle="bold" />
60   - <!---->
61   - <com.cnlive.strike.ui.widget.UIEmptyView
62   - android:id="@+id/empty_layout"
  33 + <FrameLayout
  34 + android:id="@+id/fl_root"
63 35 android:layout_width="match_parent"
64   - android:layout_height="match_parent"
65   - android:background="@color/color_fff"
66   - android:focusable="true"
67   - android:focusableInTouchMode="true"
68   - android:visibility="gone" />
  36 + android:layout_height="match_parent">
  37 +
  38 + <com.baidu.mapapi.map.MapView
  39 + android:id="@+id/mapView"
  40 + android:layout_width="match_parent"
  41 + android:layout_height="match_parent"></com.baidu.mapapi.map.MapView>
  42 +
  43 + <!--地图上面加一层类似于全透明黑色蒙版-->
  44 + <LinearLayout
  45 + android:layout_width="match_parent"
  46 + android:layout_height="match_parent"
  47 + android:background="#0D000000"
  48 + android:clickable="false"
  49 + android:focusable="false"
  50 + android:focusableInTouchMode="false"></LinearLayout>
  51 +
  52 + <!---->
69 53  
70   - </FrameLayout>
71   - </LinearLayout>
72   - <!-- SLIDING LAYOUT -->
73   - <FrameLayout
74   - android:id="@+id/dragView"
75   - android:layout_width="match_parent"
76   - android:layout_height="match_parent"
77   - android:background="@drawable/shape_left_right_10dp_white_raduis_bg"
78   - android:clickable="false"
79   - android:focusable="false">
80 54  
81   - <ScrollView
82   - android:id="@+id/scrollView"
  55 + </FrameLayout>
  56 + </LinearLayout>
  57 + <!-- SLIDING LAYOUT -->
  58 + <FrameLayout
  59 + android:id="@+id/dragView"
83 60 android:layout_width="match_parent"
84 61 android:layout_height="match_parent"
85   - android:scrollbars="none">
  62 + android:background="@drawable/shape_left_right_10dp_white_raduis_bg"
  63 + android:clickable="false"
  64 + android:focusable="false">
86 65  
87   - <LinearLayout
88   - android:id="@+id/ll_root"
  66 + <ScrollView
  67 + android:id="@+id/scrollView"
89 68 android:layout_width="match_parent"
90   - android:layout_height="wrap_content"
91   - android:orientation="vertical">
92   - <!--跑道-->
93   - <include
94   - android:id="@+id/include_street"
95   - layout="@layout/layout_collect_run_detail_street" />
96   - <!---->
97   - <View
  69 + android:layout_height="match_parent"
  70 + android:scrollbars="none">
  71 +
  72 + <LinearLayout
  73 + android:id="@+id/ll_root"
98 74 android:layout_width="match_parent"
99   - android:layout_height="10dp"
100   - android:background="#F4F4F4" />
101   - <!--路线介绍-->
102   - <include
103   - android:id="@+id/include_street_introduce"
104   - layout="@layout/layout_run_detail_street_introduce" />
105   - </LinearLayout>
106   -
107   - </ScrollView>
108   - </FrameLayout>
109   - </com.sothree.slidinguppanel.SlidingUpPanelLayout>
  75 + android:layout_height="wrap_content"
  76 + android:orientation="vertical">
  77 + <!--跑道-->
  78 + <include
  79 + android:id="@+id/include_street"
  80 + layout="@layout/layout_collect_run_detail_street" />
  81 + <!---->
  82 + <View
  83 + android:layout_width="match_parent"
  84 + android:layout_height="10dp"
  85 + android:background="#F4F4F4" />
  86 + <!--路线介绍-->
  87 + <include
  88 + android:id="@+id/include_street_introduce"
  89 + layout="@layout/layout_run_detail_street_introduce" />
  90 + </LinearLayout>
  91 +
  92 + </ScrollView>
  93 + </FrameLayout>
  94 + </com.sothree.slidinguppanel.SlidingUpPanelLayout>
  95 + <!--按钮-->
  96 + <RelativeLayout
  97 + android:id="@+id/rl_scrollView_add_trace"
  98 + android:layout_width="match_parent"
  99 + android:layout_height="40sp"
  100 + android:layout_gravity="bottom"
  101 + android:background="@color/green_round"
  102 + android:tag="0">
  103 +
  104 + <TextView
  105 + android:id="@+id/tv_run_now"
  106 + android:layout_width="wrap_content"
  107 + android:layout_height="wrap_content"
  108 + android:layout_centerInParent="true"
  109 + android:tag="0"
  110 + android:text="@string/layout_collect_bind_trace"
  111 + android:textColor="@color/white"
  112 + android:textSize="18sp" />
  113 +
  114 + <TextView
  115 + android:id="@+id/tv_go_tip"
  116 + android:layout_width="wrap_content"
  117 + android:layout_height="wrap_content"
  118 + android:layout_alignParentRight="true"
  119 + android:layout_centerInParent="true"
  120 + android:layout_centerVertical="true"
  121 + android:layout_marginRight="10dp"
  122 + android:text="Go!"
  123 + android:textColor="@color/white"
  124 + android:textSize="18sp"
  125 + android:visibility="gone" />
  126 +
  127 + </RelativeLayout>
  128 +
  129 + <com.cnlive.strike.ui.widget.UIEmptyView
  130 + android:id="@+id/empty_layout"
  131 + android:layout_width="match_parent"
  132 + android:layout_height="match_parent"
  133 + android:background="@color/color_fff"
  134 + android:focusable="true"
  135 + android:focusableInTouchMode="true"
  136 + android:visibility="gone" />
  137 + </FrameLayout>
110 138  
111 139  
112 140 </layout>
113 141 \ No newline at end of file
... ...
moudle_pedometer/src/main/res/layout/fragment_finish_run_map.xml
... ... @@ -93,6 +93,8 @@
93 93 android:layout_width="match_parent"
94 94 android:layout_height="wrap_content"
95 95 android:orientation="vertical">
  96 +
  97 +
96 98 <!--用户个人信息-->
97 99 <include
98 100 android:id="@+id/include_finish_user_info"
... ...
moudle_pedometer/src/main/res/layout/fragment_run_race_detail.xml
... ... @@ -80,6 +80,8 @@
80 80 android:layout_width="match_parent"
81 81 android:layout_height="wrap_content"
82 82 android:orientation="vertical">
  83 +
  84 +
83 85 <!--跑道-->
84 86 <include
85 87 android:id="@+id/include_street"
... ... @@ -172,8 +174,7 @@
172 174 android:layout_gravity="center"
173 175 android:text="路线详情"
174 176 android:textColor="@color/white"
175   - android:textSize="18sp"
176   - />
  177 + android:textSize="18sp" />
177 178 </FrameLayout>
178 179  
179 180 <com.cnlive.strike.ui.widget.UIEmptyView
... ...
moudle_pedometer/src/main/res/layout/layout_collect_run_detail_street.xml
... ... @@ -23,13 +23,20 @@
23 23 android:layout_width="match_parent"
24 24 android:layout_height="wrap_content"
25 25 android:orientation="vertical">
  26 +
  27 + <ImageView
  28 + android:layout_width="13dp"
  29 + android:layout_height="7dp"
  30 + android:layout_gravity="center_horizontal"
  31 + android:layout_marginTop="5dp"
  32 + android:background="@drawable/icon_slide_up" />
26 33 <!--活动标题-->
27 34 <TextView
28 35 android:id="@+id/tv_race_title"
29 36 android:layout_width="wrap_content"
30 37 android:layout_height="wrap_content"
31 38 android:layout_marginLeft="10dp"
32   - android:layout_marginTop="10dp"
  39 + android:layout_marginTop="5dp"
33 40 android:text="--"
34 41 android:textColor="@color/text_black"
35 42 android:textSize="18sp"
... ...
moudle_pedometer/src/main/res/layout/layout_run_detail_street.xml
... ... @@ -26,13 +26,20 @@
26 26 android:layout_marginRight="15dp"
27 27 android:background="@color/white"
28 28 android:orientation="vertical">
  29 +
  30 + <ImageView
  31 + android:layout_width="13dp"
  32 + android:layout_height="7dp"
  33 + android:layout_gravity="center_horizontal"
  34 + android:layout_marginTop="5dp"
  35 + android:background="@drawable/icon_slide_up" />
29 36 <!--活动标题-->
30 37 <TextView
31 38 android:id="@+id/tv_race_title"
32 39 android:layout_width="wrap_content"
33 40 android:layout_height="wrap_content"
34 41 android:layout_marginLeft="10dp"
35   - android:layout_marginTop="15dp"
  42 + android:layout_marginTop="5dp"
36 43 android:text="--"
37 44 android:textColor="@color/text_black"
38 45 android:textSize="18sp"
... ...