Commit 769423bb47e3c23a4bb3018c42b4fee2c7e05ee3

Authored by 杨帅
1 parent 7344d6b7

1 修复BUG

Showing 23 changed files with 141 additions and 84 deletions
app/src/main/java/com/example/modulepedometer/MainActivity.java
... ... @@ -5,6 +5,13 @@ import android.os.Bundle;
5 5 import android.support.v7.app.AppCompatActivity;
6 6 import android.view.View;
7 7  
  8 +import com.baidu.mapapi.model.LatLng;
  9 +import com.baidu.mapapi.search.geocode.GeoCodeResult;
  10 +import com.baidu.mapapi.search.geocode.GeoCoder;
  11 +import com.baidu.mapapi.search.geocode.OnGetGeoCoderResultListener;
  12 +import com.baidu.mapapi.search.geocode.ReverseGeoCodeOption;
  13 +import com.baidu.mapapi.search.geocode.ReverseGeoCodeResult;
  14 +import com.cnlive.libs.base.util.AlertUtil;
8 15 import com.cnlive.moudle.collectionTrace.ui.activity.CollRunRaceDetailActivity;
9 16 import com.cnlive.moudle.collectionTrace.ui.activity.CollRunningFinishActivity;
10 17 import com.cnlive.moudle.collectionTrace.ui.activity.RaceListActivity;
... ... @@ -44,19 +51,25 @@ public class MainActivity extends AppCompatActivity {
44 51 }
45 52 });
46 53  
47   -// RunLineActivity.newInstance(this,null,null,null);
48   -// Intent intent = new Intent(this, CollRunRaceDetailActivity.class);
49   -// startActivity(intent);
50   -// ARouter.getInstance()
51   -//// .build("/moudle_pedometer/InterestActivity")
52   -// .build("/moudle_pedometer/CollRunRaceDetailActivity")
53   -// .navigation(this);
54   -// finish();
55   -// BottomSheetDialog bottomSheetDialog=new BottomSheetDialog(this);
56   -// View view=getLayoutInflater().inflate(R.layout.dialog_start_tip_bottomsheet,null);
57   -// bottomSheetDialog.setContentView(view);
58   -// bottomSheetDialog.show();
59   -// bottomSheetDialog.setCancelable(false);
  54 +// GeoCoder mSearch = null; // 搜索模块,也可去掉地图模块独立使用
  55 +// mSearch = GeoCoder.newInstance();
  56 +// mSearch.setOnGetGeoCodeResultListener(new OnGetGeoCoderResultListener() {
  57 +// @Override
  58 +// public void onGetGeoCodeResult(GeoCodeResult geoCodeResult) {
  59 +// AlertUtil.showDeftToast(getApplicationContext(),geoCodeResult.getAddress());
  60 +// }
  61 +//
  62 +// @Override
  63 +// public void onGetReverseGeoCodeResult(ReverseGeoCodeResult reverseGeoCodeResult) {
  64 +// AlertUtil.showDeftToast(getApplicationContext(),reverseGeoCodeResult.getAddress());
  65 +//
  66 +// }
  67 +// });
  68 +// mSearch.reverseGeoCode(new ReverseGeoCodeOption()
  69 +// .location(new LatLng(39.933946, 116.309374))
  70 +// .pageSize(1)
  71 +// .pageNum(100)
  72 +// .radius(10));
60 73  
61 74 }
62 75 }
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollRunRaceDetailFragmentView.java
... ... @@ -669,7 +669,7 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen
669 669 if (isFirstLoc) {
670 670 isFirstLoc = false;
671 671 if (location.getRadius() > Constant.LOCA_ACCURACY) {
672   - Toast.makeText(getContext(), "当前定位精度为:" + location.getRadius() + "米,请您移动至空旷地带!", Toast.LENGTH_SHORT).show();
  672 + Toast.makeText(getContext(), "当前定位误差为:" + location.getRadius() + "米,请您移动至空旷地带!", Toast.LENGTH_SHORT).show();
673 673 }
674 674 } else {
675 675 //过滤定位精度
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollRunningFinishFragmentView.java
... ... @@ -171,6 +171,11 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener {
171 171 fragment.binding.rlScrollViewStartBtn.setOnTouchListener(new View.OnTouchListener() {
172 172 @Override
173 173 public boolean onTouch(View view, MotionEvent motionEvent) {
  174 + if (null != fragment.binding.rlScrollViewStartBtn.getTag()) {
  175 + if ("1".equals(fragment.binding.rlScrollViewStartBtn.getTag())) {
  176 + return false;
  177 + }
  178 + }
174 179 if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
175 180 //判断是否成功查询到轨迹点
176 181 if (null == queryResultPoints) {
... ... @@ -214,7 +219,9 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener {
214 219 });
215 220 selectDialog.setCanceledOnTouchOutside(false);
216 221 selectDialog.setCancelable(false);
217   - selectDialog.show();
  222 + if (!selectDialog.isShowing()) {
  223 + selectDialog.show();
  224 + }
218 225 }
219 226 }
220 227 return false;
... ... @@ -298,18 +305,14 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener {
298 305 * 屏蔽上传轨迹按钮
299 306 */
300 307 public void limitUploadBtnTouch() {
301   - fragment.binding.rlScrollViewStartBtn.setFocusable(false);
302   - fragment.binding.rlScrollViewStartBtn.setClickable(false);
303   - fragment.binding.rlScrollViewStartBtn.setFocusableInTouchMode(false);
  308 + fragment.binding.rlScrollViewStartBtn.setTag("1");
304 309 }
305 310  
306 311 /**
307 312 * 允许上传轨迹按钮
308 313 */
309 314 public void allowUploadBtnTouch() {
310   - fragment.binding.rlScrollViewStartBtn.setFocusable(true);
311   - fragment.binding.rlScrollViewStartBtn.setClickable(true);
312   - fragment.binding.rlScrollViewStartBtn.setFocusableInTouchMode(true);
  315 + fragment.binding.rlScrollViewStartBtn.setTag("0");
313 316 }
314 317  
315 318 private void queryWalkTrace(long startTime, long endTime) {
... ... @@ -348,6 +351,7 @@ public class CollRunningFinishFragmentView implements MvpView, OnFenceListener {
348 351 }
349 352  
350 353 private void getBaiDuSnap() {
  354 + limitUploadBtnTouch();
351 355 baiduMap.snapshot(new BaiduMap.SnapshotReadyCallback() {
352 356 @Override
353 357 public void onSnapshotReady(Bitmap bitmap) {
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollRunningMapFragmentView.java
... ... @@ -619,8 +619,10 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener
619 619 currentLine = MyMapUtil.drawMapLine(getContext(), baiduMap, currentWalkPoints, R.color.green_round);
620 620 }
621 621 }
622   - if (null != location.getPoiList() && null != location.getPoiList().get(0)) {
623   - currentAddress = location.getPoiList().get(0).getName();
  622 + if (location.hasAddr()) {
  623 + if (!TextUtils.isEmpty(location.getAddress().address)) {
  624 + currentAddress = location.getAddress().address;
  625 + }
624 626 }
625 627 if (TextUtils.isEmpty(currentAddress)) {
626 628 if (null != location.getAddress()) {
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollTraceListDetailFragmentView.java
... ... @@ -278,7 +278,7 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener
278 278  
279 279  
280 280 //获取打点不为空
281   - if (null != finalResultCollectPoints && finalResultCollectPoints.size() > 1) {
  281 + if (null != finalResultCollectPoints && finalResultCollectPoints.size() > 0) {
282 282 //开始在地图上绘制打点信息
283 283 for (int i = 0; i < finalResultCollectPoints.size(); i++) {
284 284 LatLng latLng = new LatLng(finalResultCollectPoints.get(i).getLatitude(), finalResultCollectPoints.get(i).getLongitude());
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/RaceNameListView.java
... ... @@ -106,7 +106,7 @@ public class RaceNameListView implements MvpView, OnFenceListener {
106 106  
107 107 public void delectShoeLine(int position) {
108 108 list.remove(position);
109   - if(list.size() == 0){
  109 + if (list.size() == 0) {
110 110 showEmpty();
111 111 }
112 112 adapter.notifyDataSetChanged();
... ... @@ -163,13 +163,13 @@ public class RaceNameListView implements MvpView, OnFenceListener {
163 163 //先校验
164 164 fragment.getPresenter().checkShoeLine(fragment.getActivity(), eventShoeLinesBean.getId(), eventShoeLinesBean.getEventId(), new RaceNameListPresenter.CallBack() {
165 165 @Override
166   - public void onSuccess(String fenceId, String entityName,String isDelete) {
  166 + public void onSuccess(String fenceId, String entityName, String isDelete) {
167 167 if (null == fragment.getActivity()) {
168 168 return;
169 169 }
170   - if(isDelete != null && isDelete.equals("1")){
  170 + if (isDelete != null && isDelete.equals("1")) {
171 171 delectShoeLine(position);
172   - AlertUtil.showLongToast(fragment.getActivity(),"该轨迹已被删除,不能进行绑定",2000);
  172 + AlertUtil.showLongToast(fragment.getActivity(), "该轨迹已被删除,不能进行绑定", 2000);
173 173 return;
174 174 }
175 175 //判断是否为空
... ... @@ -333,11 +333,14 @@ public class RaceNameListView implements MvpView, OnFenceListener {
333 333 if (5102 == createFenceResponse.getStatus()) {
334 334 QMUITipDialogUtil.dismessDialog();
335 335 QMUITipDialogUtil.failedDialog(fragment.getActivity(), createFenceResponse.getMessage(), 1);
336   - } else {
  336 + } else if (0 == createFenceResponse.getStatus()) {
337 337 if (null != currentSelBean && -1 != currentSelPos) {
338 338 QMUITipDialogUtil.dismessDialog();
339 339 fragment.addShoeLine(currentSelBean, createFenceResponse.getFenceId() + "", currentSelPos);
340 340 }
  341 + }else {
  342 + QMUITipDialogUtil.dismessDialog();
  343 + QMUITipDialogUtil.failedDialog(fragment.getActivity(), createFenceResponse.getMessage(), 1);
341 344 }
342 345 }
343 346  
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/StartTraceFragmentView.java
... ... @@ -407,7 +407,7 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener {
407 407 }
408 408 if (isFirstLoc) {
409 409 isFirstLoc = false;
410   - Toast.makeText(getContext(), "当前定位精度为:" + location.getRadius() + "米,请您移动至空旷地带!", Toast.LENGTH_SHORT).show();
  410 + Toast.makeText(getContext(), "当前定位误差为:" + location.getRadius() + "米,请您移动至空旷地带!", Toast.LENGTH_SHORT).show();
411 411  
412 412 }
413 413 // if (location.getRadius() > Constant.LOCA_ACCURACY) {
... ... @@ -424,8 +424,10 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener {
424 424 // 此处设置开发者获取到的方向信息,顺时针0-360
425 425 .direction(location.getDirection()).latitude(location.getLatitude())
426 426 .longitude(location.getLongitude()).build();
427   - if (null != location.getPoiList() && null != location.getPoiList().get(0)) {
428   - currentAddress = location.getPoiList().get(0).getName();
  427 + if (location.hasAddr()) {
  428 + if (!TextUtils.isEmpty(location.getAddress().address)) {
  429 + currentAddress = location.getAddress().address;
  430 + }
429 431 }
430 432 if (isShowFollowAddress && selectDialog != null && !selectDialog.isShowing()) {
431 433 if (!TextUtils.isEmpty(currentAddress)) {
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/service/CollStepService.java
... ... @@ -144,6 +144,8 @@ public class CollStepService extends Service implements SensorEventListener {
144 144 */
145 145 public static Trace mTrace = null;
146 146  
  147 + private boolean isStartForeground = false;
  148 +
147 149 public CollStepService() {
148 150  
149 151 }
... ... @@ -229,7 +231,7 @@ public class CollStepService extends Service implements SensorEventListener {
229 231 if (mClient != null) {
230 232 retryIndex = 0;
231 233 mClient.startGather(traceListener);
232   - Log.e(TAG, "开启轨迹服务" );
  234 + Log.e(TAG, "开启轨迹服务");
233 235 // Toast.makeText(getApplicationContext(), "开启轨迹服务", Toast.LENGTH_LONG).show();
234 236 boolean isFirstSendNotification = CollCommonInfo.getIsFirstStepSendTraceTip(getApplicationContext());
235 237 if (isFirstSendNotification) {
... ... @@ -274,7 +276,7 @@ public class CollStepService extends Service implements SensorEventListener {
274 276 if (StatusCodes.SUCCESS == errorNo || StatusCodes.CACHE_TRACK_NOT_UPLOAD == errorNo) {
275 277 if (mClient != null) {
276 278 mClient.stopTrace(mTrace, traceListener);
277   - Log.e(TAG, "停止轨迹服务" );
  279 + Log.e(TAG, "停止轨迹服务");
278 280 // Toast.makeText(getApplicationContext(), "停止轨迹服务", Toast.LENGTH_LONG).show();
279 281 }
280 282 }
... ... @@ -295,7 +297,7 @@ public class CollStepService extends Service implements SensorEventListener {
295 297 Log.e(TAG, "onStartGatherCallback: " + message + "," + errorNo);
296 298 if (StatusCodes.SUCCESS == errorNo || StatusCodes.GATHER_STARTED == errorNo) {
297 299 retryIndex = 0;
298   - Log.e(TAG, "开始采集" );
  300 + Log.e(TAG, "开始采集");
299 301 // Toast.makeText(getApplicationContext(), "开始采集", Toast.LENGTH_LONG).show();
300 302 } else {
301 303 //重新开启采集
... ... @@ -323,7 +325,7 @@ public class CollStepService extends Service implements SensorEventListener {
323 325 @Override
324 326 public void onStopGatherCallback(int errorNo, String message) {
325 327 if (StatusCodes.SUCCESS == errorNo || StatusCodes.GATHER_STOPPED == errorNo) {
326   - Log.e(TAG, "停止采集" );
  328 + Log.e(TAG, "停止采集");
327 329 // Toast.makeText(getApplicationContext(), "停止采集", Toast.LENGTH_LONG).show();
328 330 if (mClient != null) {
329 331 mClient.stopTrace(mTrace, traceListener);
... ... @@ -448,6 +450,7 @@ public class CollStepService extends Service implements SensorEventListener {
448 450 .build();
449 451 // remoteViews.setChronometer(R.id.ch, aa, null, true);
450 452 startForeground(NOTIFICATION_ID, notification);
  453 + isStartForeground = true;
451 454  
452 455 }
453 456  
... ... @@ -462,8 +465,10 @@ public class CollStepService extends Service implements SensorEventListener {
462 465 @Override
463 466 public void onDestroy() {
464 467 super.onDestroy();
465   - //取消前台进程
466   - stopForeground(true);
  468 + if (isStartForeground) {
  469 + //取消前台进程
  470 + stopForeground(true);
  471 + }
467 472 if (mBatInfoReceiver != null) {
468 473 unregisterReceiver(mBatInfoReceiver);
469 474 }
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/CollPedometerMainActivity.java
... ... @@ -51,8 +51,9 @@ public class CollPedometerMainActivity extends QMUIFragmentActivity {
51 51 super.onCreate(savedInstanceState);
52 52 StatusBarUtil2.setColor(this, getResources().getColor(R.color.run_main_bg), 0);
53 53 // setContentView(R.layout.activity_pedometer_main);
54   - runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().getSerializable("runRaceDetailInfo");
55   -
  54 + if (null != getIntent().getExtras()) {
  55 + runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().getSerializable("runRaceDetailInfo");
  56 + }
56 57 }
57 58  
58 59  
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/CollRunningMapActivity.java
... ... @@ -21,9 +21,11 @@ public class CollRunningMapActivity extends QMUIFragmentActivity {
21 21 super.onCreate(savedInstanceState);
22 22  
23 23 StatusBarUtil2.setColor(this, getResources().getColor(R.color.run_main_bg), 0);
24   - RunRaceDetailInfo runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().getSerializable("runRaceDetailInfo");
25   - if (runRaceDetailInfo != null) {
26   - addFragment(runRaceDetailInfo);
  24 + if (null != getIntent().getExtras()) {
  25 + RunRaceDetailInfo runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().getSerializable("runRaceDetailInfo");
  26 + if (runRaceDetailInfo != null) {
  27 + addFragment(runRaceDetailInfo);
  28 + }
27 29 }
28 30 }
29 31  
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/CollTraceListDetailActivity.java
... ... @@ -26,11 +26,13 @@ public class CollTraceListDetailActivity extends QMUIFragmentActivity {
26 26 @Override
27 27 protected void onCreate(Bundle savedInstanceState) {
28 28 super.onCreate(savedInstanceState);
29   - eventShoeLinesBean = (RaceNameListInfo.EventShoeLinesBean) getIntent().getExtras().get("eventShoeLinesBean");
30   - String fenceEntityName = getIntent().getExtras().getString("fenceEntityName");
31   - String position= getIntent().getExtras().getString("position");
32   - if (null != eventShoeLinesBean) {
33   - addFragment(CollTraceListDetailFragment.newInstance(eventShoeLinesBean,position));
  29 + if (null != getIntent().getExtras()) {
  30 + eventShoeLinesBean = (RaceNameListInfo.EventShoeLinesBean) getIntent().getExtras().get("eventShoeLinesBean");
  31 + String fenceEntityName = getIntent().getExtras().getString("fenceEntityName");
  32 + String position = getIntent().getExtras().getString("position");
  33 + if (null != eventShoeLinesBean) {
  34 + addFragment(CollTraceListDetailFragment.newInstance(eventShoeLinesBean, position));
  35 + }
34 36 }
35 37 }
36 38  
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/RaceNameListActivity.java
... ... @@ -31,9 +31,11 @@ public class RaceNameListActivity extends AppCompatActivity {
31 31 StatusBarUtil.setStatusBarWrite(this);
32 32 StatusBarUtil2.setColor(this, getResources().getColor(R.color.white), 0);
33 33 setContentView(R.layout.activity_race_name_list);
34   - RunRaceDetailInfo runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().getSerializable("runRaceDetailInfo");
35   - if (null != runRaceDetailInfo) {
36   - getSupportFragmentManager().beginTransaction().replace(R.id.race_container, RaceNameListFragment.newInstance(getIntent().getStringExtra("eventId"), runRaceDetailInfo)).commit();
  34 + if (null != getIntent().getExtras()) {
  35 + RunRaceDetailInfo runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().getSerializable("runRaceDetailInfo");
  36 + if (null != runRaceDetailInfo) {
  37 + getSupportFragmentManager().beginTransaction().replace(R.id.race_container, RaceNameListFragment.newInstance(getIntent().getStringExtra("eventId"), runRaceDetailInfo)).commit();
  38 + }
37 39 }
38 40 }
39 41 }
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/StartCollectTraceActivity.java
... ... @@ -27,7 +27,7 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity {
27 27 private PermissionsUtils mPermissionsUtils;//权限申请
28 28 private RunRaceDetailInfo runRaceDetailInfo;
29 29  
30   - public static void newInstance(Context context, String eventId,RunRaceDetailInfo runRaceDetailInfo) {
  30 + public static void newInstance(Context context, String eventId, RunRaceDetailInfo runRaceDetailInfo) {
31 31 CollCommonInfo.setStreetId(context, eventId);
32 32 Intent intent = new Intent(context, StartCollectTraceActivity.class);
33 33 intent.putExtra("eventId", eventId);
... ... @@ -46,8 +46,9 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity {
46 46 mPermissionsUtils = new PermissionsUtils();
47 47 StatusBarUtil.setStatusBarWrite(this);
48 48 StatusBarUtil2.setColor(this, getResources().getColor(R.color.white), 0);
49   - runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().getSerializable("runRaceDetailInfo");
50   -
  49 + if (null != getIntent().getExtras()) {
  50 + runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().getSerializable("runRaceDetailInfo");
  51 + }
51 52  
52 53 }
53 54  
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunRaceDetailFragmentView.java
... ... @@ -1146,7 +1146,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener {
1146 1146 if (isFirstLoc) {
1147 1147 isFirstLoc = false;
1148 1148 if (location.getRadius() > Constant.LOCA_ACCURACY) {
1149   - Toast.makeText(getContext(), "当前定位精度为:" + location.getRadius() + "米,请您移动至空旷地带!", Toast.LENGTH_SHORT).show();
  1149 + Toast.makeText(getContext(), "当前定位误差为:" + location.getRadius() + "米,请您移动至空旷地带!", Toast.LENGTH_SHORT).show();
1150 1150 }
1151 1151  
1152 1152 } else {
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunningMapFragmentView.java
... ... @@ -318,7 +318,7 @@ public class RunningMapFragmentView implements MvpView, SensorEventListener {
318 318 if (isFirstLoc) {
319 319 isFirstLoc = false;
320 320 if (location.getRadius() > Constant.LOCA_ACCURACY) {
321   - Toast.makeText(getContext(), "当前定位精度为:" + location.getRadius() + "米,请您移动至空旷地带!", Toast.LENGTH_SHORT).show();
  321 + Toast.makeText(getContext(), "当前定位误差为:" + location.getRadius() + "米,请您移动至空旷地带!", Toast.LENGTH_SHORT).show();
322 322 }
323 323  
324 324  
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/service/KeepLiveService.java
... ... @@ -50,6 +50,7 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion
50 50 private Handler handler;
51 51 private Runnable runnable;
52 52 private boolean isRegisterReceiver = false;
  53 + private boolean isStartForeground = false;
53 54  
54 55 public KeepLiveService() {
55 56 }
... ... @@ -86,7 +87,9 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion
86 87 Log.e(TAG, "run: ");
87 88 }
88 89 stopPlaySong();
89   - stopForeground(true);
  90 + if (isStartForeground) {
  91 + stopForeground(true);
  92 + }
90 93 }
91 94  
92 95 }
... ... @@ -234,6 +237,7 @@ public class KeepLiveService extends Service implements MediaPlayer.OnCompletion
234 237 .build();
235 238 // 0 隐藏前台服务通知
236 239 startForeground(100, notification);
  240 + isStartForeground=true;
237 241 }
238 242  
239 243 @Override
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/ALLScoreDetailActivity.java
... ... @@ -24,9 +24,11 @@ public class ALLScoreDetailActivity extends QMUIFragmentActivity {
24 24 @Override
25 25 protected void onCreate(Bundle savedInstanceState) {
26 26 super.onCreate(savedInstanceState);
27   - RunningFinishBean runningFinishBean = (RunningFinishBean) getIntent().getExtras().getSerializable("runningFinishBean");
28   - if (runningFinishBean != null) {
29   - addFragment(ALLScoreDetailFragment.newInstance(runningFinishBean));
  27 + if (null != getIntent().getExtras()) {
  28 + RunningFinishBean runningFinishBean = (RunningFinishBean) getIntent().getExtras().getSerializable("runningFinishBean");
  29 + if (runningFinishBean != null) {
  30 + addFragment(ALLScoreDetailFragment.newInstance(runningFinishBean));
  31 + }
30 32 }
31 33 }
32 34  
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/OnGoingActivity.java
... ... @@ -22,9 +22,11 @@ public class OnGoingActivity extends QMUIFragmentActivity {
22 22 @Override
23 23 protected void onCreate(Bundle savedInstanceState) {
24 24 super.onCreate(savedInstanceState);
25   - String eventId = getIntent().getExtras().getString("eventId");
26   - if (null != eventId) {
27   - addFragment(OnGoingFragment.newInstance(eventId));
  25 + if (null != getIntent().getExtras()) {
  26 + String eventId = getIntent().getExtras().getString("eventId");
  27 + if (null != eventId) {
  28 + addFragment(OnGoingFragment.newInstance(eventId));
  29 + }
28 30 }
29 31 }
30 32  
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/PedometerMainActivity.java
... ... @@ -47,11 +47,13 @@ public class PedometerMainActivity extends QMUIFragmentActivity {
47 47 @Override
48 48 protected void onCreate(Bundle savedInstanceState) {
49 49 super.onCreate(savedInstanceState);
50   - if (null != getIntent().getExtras().get("runRaceDetailInfo")) {
51   - runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().get("runRaceDetailInfo");
52   - if (getCurrentFragment() == null) {
53   - if (runRaceDetailInfo != null) {
54   - addFragment(runRaceDetailInfo);
  50 + if (null != getIntent().getExtras()) {
  51 + if (null != getIntent().getExtras().get("runRaceDetailInfo")) {
  52 + runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().get("runRaceDetailInfo");
  53 + if (getCurrentFragment() == null) {
  54 + if (runRaceDetailInfo != null) {
  55 + addFragment(runRaceDetailInfo);
  56 + }
55 57 }
56 58 }
57 59 }
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/RunRaceDetailActivity.java
... ... @@ -75,14 +75,16 @@ public class RunRaceDetailActivity extends QMUIFragmentActivity {
75 75 @Override
76 76 protected void onCreate(Bundle savedInstanceState) {
77 77 super.onCreate(savedInstanceState);
78   - if (getIntent().getStringExtra("eventId") != null) {
79   - eventId = getIntent().getStringExtra("eventId");
80   - }
81   - if (getIntent().getStringExtra("userId") != null) {
82   - CommonInfo.setUserId(this, getIntent().getStringExtra("userId"));
83   - CommonInfo.setUserNickName(this, getIntent().getStringExtra("userName"));
84   - CommonInfo.setUserIcon(this, getIntent().getStringExtra("userIcon"));
85   - CommonInfo.setUserPhone(this, getIntent().getStringExtra("userPhone"));
  78 + if (null != getIntent().getExtras()) {
  79 + if (getIntent().getStringExtra("eventId") != null) {
  80 + eventId = getIntent().getStringExtra("eventId");
  81 + }
  82 + if (getIntent().getStringExtra("userId") != null) {
  83 + CommonInfo.setUserId(this, getIntent().getStringExtra("userId"));
  84 + CommonInfo.setUserNickName(this, getIntent().getStringExtra("userName"));
  85 + CommonInfo.setUserIcon(this, getIntent().getStringExtra("userIcon"));
  86 + CommonInfo.setUserPhone(this, getIntent().getStringExtra("userPhone"));
  87 + }
86 88 }
87 89 initPermissionDefineTip();
88 90 //判断用户是否结束运动
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/RunningFinishActivity.java
... ... @@ -32,8 +32,10 @@ public class RunningFinishActivity extends QMUIFragmentActivity {
32 32 protected void onCreate(Bundle savedInstanceState) {
33 33 super.onCreate(savedInstanceState);
34 34 StatusBarUtil2.setColor(this, getResources().getColor(R.color.run_main_bg), 0);
35   - if (getIntent().getSerializableExtra("runningFinishBean") != null) {
36   - addFragment((RunningFinishBean) getIntent().getSerializableExtra("runningFinishBean"));
  35 + if (null != getIntent().getExtras()) {
  36 + if (getIntent().getSerializableExtra("runningFinishBean") != null) {
  37 + addFragment((RunningFinishBean) getIntent().getSerializableExtra("runningFinishBean"));
  38 + }
37 39 }
38 40  
39 41  
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/RunningMapActivity.java
... ... @@ -27,9 +27,11 @@ public class RunningMapActivity extends QMUIFragmentActivity {
27 27 super.onCreate(savedInstanceState);
28 28  
29 29 StatusBarUtil2.setColor(this, getResources().getColor(R.color.run_main_bg), 0);
30   - RunningMapBean chronometerBean = (RunningMapBean) getIntent().getExtras().getSerializable("runningMapBean");
31   - if (chronometerBean != null) {
32   - addFragment(chronometerBean);
  30 + if (null != getIntent().getExtras()) {
  31 + RunningMapBean chronometerBean = (RunningMapBean) getIntent().getExtras().getSerializable("runningMapBean");
  32 + if (chronometerBean != null) {
  33 + addFragment(chronometerBean);
  34 + }
33 35 }
34 36 }
35 37  
... ...
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/UploadFailDetailActivity.java
... ... @@ -21,17 +21,21 @@ public class UploadFailDetailActivity extends QMUIFragmentActivity {
21 21 @Override
22 22 protected void onCreate(Bundle savedInstanceState) {
23 23 super.onCreate(savedInstanceState);
24   - FailedEntity failedEntity = (FailedEntity) getIntent().getExtras().getSerializable("failedEntity");
25   - if (failedEntity != null) {
26   - addFragment(UploadFailDetailFragment.newInstance(failedEntity));
  24 + if (null != getIntent().getExtras()) {
  25 + FailedEntity failedEntity = (FailedEntity) getIntent().getExtras().getSerializable("failedEntity");
  26 + if (failedEntity != null) {
  27 + addFragment(UploadFailDetailFragment.newInstance(failedEntity));
  28 + }
27 29 }
28 30 }
  31 +
29 32 private void addFragment(QMUIFragment fragment) {
30 33 getSupportFragmentManager().beginTransaction()
31 34 .add(getContextViewId(), fragment, fragment.getClass().getSimpleName())
32 35 .addToBackStack(fragment.getClass().getSimpleName())
33 36 .commit();
34 37 }
  38 +
35 39 public static void startActivity(Activity activity, FailedEntity failedEntity) {
36 40 Intent intent = new Intent(activity, UploadFailDetailActivity.class);
37 41 intent.putExtra("failedEntity", (Serializable) failedEntity);
... ...