Commit f76bbdf5e1f5f41f3e6ff86ed8b575a5351b2615
1 parent
06016401
1 去除测试提示语
Showing
6 changed files
with
44 additions
and
31 deletions
app/src/main/java/com/example/modulepedometer/MainActivity.java
| ... | ... | @@ -22,8 +22,8 @@ public class MainActivity extends AppCompatActivity { |
| 22 | 22 | super.onCreate(savedInstanceState); |
| 23 | 23 | setContentView(R.layout.activity_main); |
| 24 | 24 | |
| 25 | -// String uid = "358916"; | |
| 26 | - String uid = "358689"; | |
| 25 | + String uid = "358916"; | |
| 26 | +// String uid = "358689"; | |
| 27 | 27 | |
| 28 | 28 | findViewById(R.id.recordd).setOnClickListener(new View.OnClickListener() { |
| 29 | 29 | @Override | ... | ... |
config.gradle
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/service/CollStepService.java
| ... | ... | @@ -229,7 +229,8 @@ public class CollStepService extends Service implements SensorEventListener { |
| 229 | 229 | if (mClient != null) { |
| 230 | 230 | retryIndex = 0; |
| 231 | 231 | mClient.startGather(traceListener); |
| 232 | - Toast.makeText(getApplicationContext(), "开启轨迹服务", Toast.LENGTH_LONG).show(); | |
| 232 | + Log.e(TAG, "开启轨迹服务" ); | |
| 233 | +// Toast.makeText(getApplicationContext(), "开启轨迹服务", Toast.LENGTH_LONG).show(); | |
| 233 | 234 | boolean isFirstSendNotification = CollCommonInfo.getIsFirstStepSendTraceTip(getApplicationContext()); |
| 234 | 235 | if (isFirstSendNotification) { |
| 235 | 236 | CollCommonInfo.setIsFirstStepSendTraceTip(getApplicationContext(), false); |
| ... | ... | @@ -273,7 +274,8 @@ public class CollStepService extends Service implements SensorEventListener { |
| 273 | 274 | if (StatusCodes.SUCCESS == errorNo || StatusCodes.CACHE_TRACK_NOT_UPLOAD == errorNo) { |
| 274 | 275 | if (mClient != null) { |
| 275 | 276 | mClient.stopTrace(mTrace, traceListener); |
| 276 | - Toast.makeText(getApplicationContext(), "停止轨迹服务", Toast.LENGTH_LONG).show(); | |
| 277 | + Log.e(TAG, "停止轨迹服务" ); | |
| 278 | +// Toast.makeText(getApplicationContext(), "停止轨迹服务", Toast.LENGTH_LONG).show(); | |
| 277 | 279 | } |
| 278 | 280 | } |
| 279 | 281 | } |
| ... | ... | @@ -293,7 +295,8 @@ public class CollStepService extends Service implements SensorEventListener { |
| 293 | 295 | Log.e(TAG, "onStartGatherCallback: " + message + "," + errorNo); |
| 294 | 296 | if (StatusCodes.SUCCESS == errorNo || StatusCodes.GATHER_STARTED == errorNo) { |
| 295 | 297 | retryIndex = 0; |
| 296 | - Toast.makeText(getApplicationContext(), "开始采集", Toast.LENGTH_LONG).show(); | |
| 298 | + Log.e(TAG, "开始采集" ); | |
| 299 | +// Toast.makeText(getApplicationContext(), "开始采集", Toast.LENGTH_LONG).show(); | |
| 297 | 300 | } else { |
| 298 | 301 | //重新开启采集 |
| 299 | 302 | if (retryIndex < 4) { |
| ... | ... | @@ -320,7 +323,8 @@ public class CollStepService extends Service implements SensorEventListener { |
| 320 | 323 | @Override |
| 321 | 324 | public void onStopGatherCallback(int errorNo, String message) { |
| 322 | 325 | if (StatusCodes.SUCCESS == errorNo || StatusCodes.GATHER_STOPPED == errorNo) { |
| 323 | - Toast.makeText(getApplicationContext(), "停止采集", Toast.LENGTH_LONG).show(); | |
| 326 | + Log.e(TAG, "停止采集" ); | |
| 327 | +// Toast.makeText(getApplicationContext(), "停止采集", Toast.LENGTH_LONG).show(); | |
| 324 | 328 | if (mClient != null) { |
| 325 | 329 | mClient.stopTrace(mTrace, traceListener); |
| 326 | 330 | } | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunRaceDetailFragmentView.java
| ... | ... | @@ -545,7 +545,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 545 | 545 | } |
| 546 | 546 | |
| 547 | 547 | } else { |
| 548 | - QMUITipDialogUtil.textDialog(getContext(), "正在获取轨迹请稍后...", 1); | |
| 548 | + QMUITipDialogUtil.textDialog(getContext(), "正在获取赛事,请稍后...", 1); | |
| 549 | 549 | } |
| 550 | 550 | } |
| 551 | 551 | //继续运动 | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/service/StepService.java
| ... | ... | @@ -108,23 +108,23 @@ public class StepService extends Service implements SensorEventListener { |
| 108 | 108 | /** |
| 109 | 109 | * 当前所走的步数 |
| 110 | 110 | */ |
| 111 | - private int CURRENT_STEP = 0; | |
| 111 | + private int CURRENT_STEP = 0; | |
| 112 | 112 | /** |
| 113 | 113 | * 计步传感器类型 Sensor.TYPE_STEP_COUNTER或者Sensor.TYPE_STEP_DETECTOR |
| 114 | 114 | */ |
| 115 | - private int stepSensorType = -1; | |
| 115 | + private int stepSensorType = -1; | |
| 116 | 116 | /** |
| 117 | 117 | * 每次第一次启动记步服务时是否从系统中获取了已有的步数记录 |
| 118 | 118 | */ |
| 119 | - private boolean hasRecord = false; | |
| 119 | + private boolean hasRecord = false; | |
| 120 | 120 | /** |
| 121 | 121 | * 系统中获取到的已有的步数 |
| 122 | 122 | */ |
| 123 | - private int hasStepCount = 0; | |
| 123 | + private int hasStepCount = 0; | |
| 124 | 124 | /** |
| 125 | 125 | * 上一次的步数 |
| 126 | 126 | */ |
| 127 | - private int previousStepCount = 0; | |
| 127 | + private int previousStepCount = 0; | |
| 128 | 128 | /** |
| 129 | 129 | * 加速度传感器中获取的步数 |
| 130 | 130 | */ |
| ... | ... | @@ -247,7 +247,8 @@ public class StepService extends Service implements SensorEventListener { |
| 247 | 247 | if (mClient != null) { |
| 248 | 248 | retryIndex = 0; |
| 249 | 249 | mClient.startGather(traceListener); |
| 250 | - Toast.makeText(getApplicationContext(), "开启轨迹服务", Toast.LENGTH_LONG).show(); | |
| 250 | + Log.e(TAG, "开启轨迹服务"); | |
| 251 | +// Toast.makeText(getApplicationContext(), "开启轨迹服务", Toast.LENGTH_LONG).show(); | |
| 251 | 252 | boolean isFirstSendNotification = CommonInfo.getIsFirstStepSendTraceTip(getApplicationContext()); |
| 252 | 253 | if (isFirstSendNotification) { |
| 253 | 254 | CommonInfo.setIsFirstStepSendTraceTip(getApplicationContext(), false); |
| ... | ... | @@ -292,7 +293,8 @@ public class StepService extends Service implements SensorEventListener { |
| 292 | 293 | if (StatusCodes.SUCCESS == errorNo || StatusCodes.CACHE_TRACK_NOT_UPLOAD == errorNo) { |
| 293 | 294 | if (mClient != null) { |
| 294 | 295 | mClient.stopTrace(mTrace, traceListener); |
| 295 | - Toast.makeText(getApplicationContext(), "停止轨迹服务", Toast.LENGTH_LONG).show(); | |
| 296 | + Log.e(TAG, "停止轨迹服务"); | |
| 297 | +// Toast.makeText(getApplicationContext(), "停止轨迹服务", Toast.LENGTH_LONG).show(); | |
| 296 | 298 | |
| 297 | 299 | } |
| 298 | 300 | } |
| ... | ... | @@ -312,7 +314,8 @@ public class StepService extends Service implements SensorEventListener { |
| 312 | 314 | public void onStartGatherCallback(int errorNo, String message) { |
| 313 | 315 | if (StatusCodes.SUCCESS == errorNo || StatusCodes.GATHER_STARTED == errorNo) { |
| 314 | 316 | retryIndex = 0; |
| 315 | - Toast.makeText(getApplicationContext(), "开始采集", Toast.LENGTH_LONG).show(); | |
| 317 | + Log.e(TAG, "开始采集"); | |
| 318 | +// Toast.makeText(getApplicationContext(), "开始采集", Toast.LENGTH_LONG).show(); | |
| 316 | 319 | } else { |
| 317 | 320 | //重新开启采集 |
| 318 | 321 | if (retryIndex < 4) { |
| ... | ... | @@ -337,7 +340,8 @@ public class StepService extends Service implements SensorEventListener { |
| 337 | 340 | @Override |
| 338 | 341 | public void onStopGatherCallback(int errorNo, String message) { |
| 339 | 342 | if (StatusCodes.SUCCESS == errorNo || StatusCodes.GATHER_STOPPED == errorNo) { |
| 340 | - Toast.makeText(getApplicationContext(), "停止采集", Toast.LENGTH_LONG).show(); | |
| 343 | + Log.e(TAG, "停止采集"); | |
| 344 | +// Toast.makeText(getApplicationContext(), "停止采集", Toast.LENGTH_LONG).show(); | |
| 341 | 345 | if (mClient != null) { |
| 342 | 346 | mClient.stopTrace(mTrace, traceListener); |
| 343 | 347 | } |
| ... | ... | @@ -361,9 +365,9 @@ public class StepService extends Service implements SensorEventListener { |
| 361 | 365 | public void onPushCallback(byte messageType, PushMessage pushMessage) { |
| 362 | 366 | Log.e(TAG, "onPushCallback: "); |
| 363 | 367 | |
| 364 | - if (messageType < 0x03 || messageType > 0x04) { | |
| 365 | - return; | |
| 366 | - } | |
| 368 | +// if (messageType < 0x03 || messageType > 0x04) { | |
| 369 | +// return; | |
| 370 | +// } | |
| 367 | 371 | FenceAlarmPushInfo alarmPushInfo = pushMessage.getFenceAlarmPushInfo(); |
| 368 | 372 | if (null == alarmPushInfo) { |
| 369 | 373 | return; |
| ... | ... | @@ -381,7 +385,7 @@ public class StepService extends Service implements SensorEventListener { |
| 381 | 385 | else if (alarmPushInfo.getMonitoredAction() == MonitoredAction.enter) { |
| 382 | 386 | EventBus.getDefault().post(new MessageEvent(Constant.ENTER_RANGE, "")); |
| 383 | 387 | } |
| 384 | - Toast.makeText(getApplicationContext(), "onPushCallback:" + alarmPushInfo.getMonitoredAction(), Toast.LENGTH_SHORT).show(); | |
| 388 | +// Toast.makeText(getApplicationContext(), "onPushCallback:" + alarmPushInfo.getMonitoredAction(), Toast.LENGTH_SHORT).show(); | |
| 385 | 389 | } |
| 386 | 390 | } |
| 387 | 391 | |
| ... | ... | @@ -404,9 +408,12 @@ public class StepService extends Service implements SensorEventListener { |
| 404 | 408 | // 创建围栏回调 |
| 405 | 409 | @Override |
| 406 | 410 | public void onCreateFenceCallback(CreateFenceResponse createFenceResponse) { |
| 407 | - if ("成功".equals(createFenceResponse.getMessage())) { | |
| 411 | + if (null == createFenceResponse) { | |
| 412 | + return; | |
| 413 | + } | |
| 414 | + if (0 == createFenceResponse.getStatus()) { | |
| 408 | 415 | // Toast.makeText(context, "创建围栏回调成功", Toast.LENGTH_SHORT).show(); |
| 409 | - Log.e(TAG, "onCreateFenceCallback: " + createFenceResponse.getFenceId()); | |
| 416 | +// Log.e(TAG, "onCreateFenceCallback: " + createFenceResponse.getFenceId()); | |
| 410 | 417 | // 查询围栏监控者状态 |
| 411 | 418 | List<Long> list = new ArrayList<>(); |
| 412 | 419 | list.add(createFenceResponse.getFenceId()); |
| ... | ... | @@ -438,11 +445,12 @@ public class StepService extends Service implements SensorEventListener { |
| 438 | 445 | // 监控状态回调 |
| 439 | 446 | @Override |
| 440 | 447 | public void onMonitoredStatusCallback(MonitoredStatusResponse monitoredStatusResponse) { |
| 441 | - if (monitoredStatusResponse.getMonitoredStatusInfos() != null) { | |
| 442 | - Toast.makeText(getApplicationContext(), "围栏列表回调成功:个数:" + monitoredStatusResponse.getMonitoredStatusInfos().size(), Toast.LENGTH_SHORT).show(); | |
| 448 | + if (monitoredStatusResponse.getMonitoredStatusInfos() == null || null == monitoredStatusResponse) { | |
| 449 | + return; | |
| 450 | +// Toast.makeText(getApplicationContext(), "围栏列表回调成功:个数:" + monitoredStatusResponse.getMonitoredStatusInfos().size(), Toast.LENGTH_SHORT).show(); | |
| 443 | 451 | } //查询监控对象状态响应结果 |
| 444 | 452 | List<MonitoredStatusInfo> monitoredStatusInfos = monitoredStatusResponse.getMonitoredStatusInfos(); |
| 445 | - if (monitoredStatusInfos == null||TextUtils.isEmpty(userStepEntity.getFenceId())) { | |
| 453 | + if (monitoredStatusInfos == null || TextUtils.isEmpty(userStepEntity.getFenceId())) { | |
| 446 | 454 | return; |
| 447 | 455 | } |
| 448 | 456 | for (MonitoredStatusInfo monitoredStatusInfo : monitoredStatusInfos) { |
| ... | ... | @@ -451,18 +459,18 @@ public class StepService extends Service implements SensorEventListener { |
| 451 | 459 | switch (status) { |
| 452 | 460 | case in: |
| 453 | 461 | //监控的设备在围栏内 |
| 454 | - Toast.makeText(getApplicationContext(), "监控的设备在围栏内", Toast.LENGTH_SHORT).show(); | |
| 462 | +// Toast.makeText(getApplicationContext(), "监控的设备在围栏内", Toast.LENGTH_SHORT).show(); | |
| 455 | 463 | Log.e(TAG, "监控的设备在围栏内: "); |
| 456 | 464 | break; |
| 457 | 465 | case out: |
| 458 | 466 | //监控的设备在围栏外 |
| 459 | - Toast.makeText(getApplicationContext(), "监控的设备在围栏外", Toast.LENGTH_SHORT).show(); | |
| 467 | +// Toast.makeText(getApplicationContext(), "监控的设备在围栏外", Toast.LENGTH_SHORT).show(); | |
| 460 | 468 | Log.e(TAG, "监控的设备在围栏外: "); |
| 461 | 469 | |
| 462 | 470 | break; |
| 463 | 471 | case unknown: |
| 464 | 472 | //监控的设备状态未知 |
| 465 | - Toast.makeText(getApplicationContext(), "监控的设备状态未知", Toast.LENGTH_SHORT).show(); | |
| 473 | +// Toast.makeText(getApplicationContext(), "监控的设备状态未知", Toast.LENGTH_SHORT).show(); | |
| 466 | 474 | Log.e(TAG, "监控的设备状态未知: "); |
| 467 | 475 | |
| 468 | 476 | break; |
| ... | ... | @@ -498,7 +506,7 @@ public class StepService extends Service implements SensorEventListener { |
| 498 | 506 | Log.e(TAG, "onListMonitoredPersonCallback: "); |
| 499 | 507 | } |
| 500 | 508 | }; |
| 501 | - if (userStepEntity != null||TextUtils.isEmpty(userStepEntity.getFenceId())) { | |
| 509 | + if (userStepEntity != null || TextUtils.isEmpty(userStepEntity.getFenceId())) { | |
| 502 | 510 | List<Long> fenids = new ArrayList<>(); |
| 503 | 511 | fenids.add(Long.parseLong(userStepEntity.getFenceId())); |
| 504 | 512 | MonitoredStatusRequest request1 = MonitoredStatusRequest.buildServerRequest(Constant.TAG, |
| ... | ... | @@ -528,7 +536,7 @@ public class StepService extends Service implements SensorEventListener { |
| 528 | 536 | if (userStepEntity != null) { |
| 529 | 537 | if (TextUtils.isEmpty(userStepEntity.getFenceId())) { |
| 530 | 538 | int fenceId = CommonInfo.getFenceId(getApplicationContext()); |
| 531 | - Log.e(TAG, "onStartTraceCallback: 保存的围栏id" + fenceId); | |
| 539 | +// Log.e(TAG, "onStartTraceCallback: 保存的围栏id" + fenceId); | |
| 532 | 540 | //设置围栏id |
| 533 | 541 | StepUtil.setFenceId(getApplicationContext(), CommonInfo.getUserId(getApplicationContext()), fenceId + ""); |
| 534 | 542 | } | ... | ... |
moudle_pedometer/src/main/res/layout/fragment_run_line.xml