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,8 +22,8 @@ public class MainActivity extends AppCompatActivity { | ||
| 22 | super.onCreate(savedInstanceState); | 22 | super.onCreate(savedInstanceState); |
| 23 | setContentView(R.layout.activity_main); | 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 | findViewById(R.id.recordd).setOnClickListener(new View.OnClickListener() { | 28 | findViewById(R.id.recordd).setOnClickListener(new View.OnClickListener() { |
| 29 | @Override | 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,7 +229,8 @@ public class CollStepService extends Service implements SensorEventListener { | ||
| 229 | if (mClient != null) { | 229 | if (mClient != null) { |
| 230 | retryIndex = 0; | 230 | retryIndex = 0; |
| 231 | mClient.startGather(traceListener); | 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 | boolean isFirstSendNotification = CollCommonInfo.getIsFirstStepSendTraceTip(getApplicationContext()); | 234 | boolean isFirstSendNotification = CollCommonInfo.getIsFirstStepSendTraceTip(getApplicationContext()); |
| 234 | if (isFirstSendNotification) { | 235 | if (isFirstSendNotification) { |
| 235 | CollCommonInfo.setIsFirstStepSendTraceTip(getApplicationContext(), false); | 236 | CollCommonInfo.setIsFirstStepSendTraceTip(getApplicationContext(), false); |
| @@ -273,7 +274,8 @@ public class CollStepService extends Service implements SensorEventListener { | @@ -273,7 +274,8 @@ public class CollStepService extends Service implements SensorEventListener { | ||
| 273 | if (StatusCodes.SUCCESS == errorNo || StatusCodes.CACHE_TRACK_NOT_UPLOAD == errorNo) { | 274 | if (StatusCodes.SUCCESS == errorNo || StatusCodes.CACHE_TRACK_NOT_UPLOAD == errorNo) { |
| 274 | if (mClient != null) { | 275 | if (mClient != null) { |
| 275 | mClient.stopTrace(mTrace, traceListener); | 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,7 +295,8 @@ public class CollStepService extends Service implements SensorEventListener { | ||
| 293 | Log.e(TAG, "onStartGatherCallback: " + message + "," + errorNo); | 295 | Log.e(TAG, "onStartGatherCallback: " + message + "," + errorNo); |
| 294 | if (StatusCodes.SUCCESS == errorNo || StatusCodes.GATHER_STARTED == errorNo) { | 296 | if (StatusCodes.SUCCESS == errorNo || StatusCodes.GATHER_STARTED == errorNo) { |
| 295 | retryIndex = 0; | 297 | retryIndex = 0; |
| 296 | - Toast.makeText(getApplicationContext(), "开始采集", Toast.LENGTH_LONG).show(); | 298 | + Log.e(TAG, "开始采集" ); |
| 299 | +// Toast.makeText(getApplicationContext(), "开始采集", Toast.LENGTH_LONG).show(); | ||
| 297 | } else { | 300 | } else { |
| 298 | //重新开启采集 | 301 | //重新开启采集 |
| 299 | if (retryIndex < 4) { | 302 | if (retryIndex < 4) { |
| @@ -320,7 +323,8 @@ public class CollStepService extends Service implements SensorEventListener { | @@ -320,7 +323,8 @@ public class CollStepService extends Service implements SensorEventListener { | ||
| 320 | @Override | 323 | @Override |
| 321 | public void onStopGatherCallback(int errorNo, String message) { | 324 | public void onStopGatherCallback(int errorNo, String message) { |
| 322 | if (StatusCodes.SUCCESS == errorNo || StatusCodes.GATHER_STOPPED == errorNo) { | 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 | if (mClient != null) { | 328 | if (mClient != null) { |
| 325 | mClient.stopTrace(mTrace, traceListener); | 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,7 +545,7 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { | ||
| 545 | } | 545 | } |
| 546 | 546 | ||
| 547 | } else { | 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,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 | * 计步传感器类型 Sensor.TYPE_STEP_COUNTER或者Sensor.TYPE_STEP_DETECTOR | 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,7 +247,8 @@ public class StepService extends Service implements SensorEventListener { | ||
| 247 | if (mClient != null) { | 247 | if (mClient != null) { |
| 248 | retryIndex = 0; | 248 | retryIndex = 0; |
| 249 | mClient.startGather(traceListener); | 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 | boolean isFirstSendNotification = CommonInfo.getIsFirstStepSendTraceTip(getApplicationContext()); | 252 | boolean isFirstSendNotification = CommonInfo.getIsFirstStepSendTraceTip(getApplicationContext()); |
| 252 | if (isFirstSendNotification) { | 253 | if (isFirstSendNotification) { |
| 253 | CommonInfo.setIsFirstStepSendTraceTip(getApplicationContext(), false); | 254 | CommonInfo.setIsFirstStepSendTraceTip(getApplicationContext(), false); |
| @@ -292,7 +293,8 @@ public class StepService extends Service implements SensorEventListener { | @@ -292,7 +293,8 @@ public class StepService extends Service implements SensorEventListener { | ||
| 292 | if (StatusCodes.SUCCESS == errorNo || StatusCodes.CACHE_TRACK_NOT_UPLOAD == errorNo) { | 293 | if (StatusCodes.SUCCESS == errorNo || StatusCodes.CACHE_TRACK_NOT_UPLOAD == errorNo) { |
| 293 | if (mClient != null) { | 294 | if (mClient != null) { |
| 294 | mClient.stopTrace(mTrace, traceListener); | 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,7 +314,8 @@ public class StepService extends Service implements SensorEventListener { | ||
| 312 | public void onStartGatherCallback(int errorNo, String message) { | 314 | public void onStartGatherCallback(int errorNo, String message) { |
| 313 | if (StatusCodes.SUCCESS == errorNo || StatusCodes.GATHER_STARTED == errorNo) { | 315 | if (StatusCodes.SUCCESS == errorNo || StatusCodes.GATHER_STARTED == errorNo) { |
| 314 | retryIndex = 0; | 316 | retryIndex = 0; |
| 315 | - Toast.makeText(getApplicationContext(), "开始采集", Toast.LENGTH_LONG).show(); | 317 | + Log.e(TAG, "开始采集"); |
| 318 | +// Toast.makeText(getApplicationContext(), "开始采集", Toast.LENGTH_LONG).show(); | ||
| 316 | } else { | 319 | } else { |
| 317 | //重新开启采集 | 320 | //重新开启采集 |
| 318 | if (retryIndex < 4) { | 321 | if (retryIndex < 4) { |
| @@ -337,7 +340,8 @@ public class StepService extends Service implements SensorEventListener { | @@ -337,7 +340,8 @@ public class StepService extends Service implements SensorEventListener { | ||
| 337 | @Override | 340 | @Override |
| 338 | public void onStopGatherCallback(int errorNo, String message) { | 341 | public void onStopGatherCallback(int errorNo, String message) { |
| 339 | if (StatusCodes.SUCCESS == errorNo || StatusCodes.GATHER_STOPPED == errorNo) { | 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 | if (mClient != null) { | 345 | if (mClient != null) { |
| 342 | mClient.stopTrace(mTrace, traceListener); | 346 | mClient.stopTrace(mTrace, traceListener); |
| 343 | } | 347 | } |
| @@ -361,9 +365,9 @@ public class StepService extends Service implements SensorEventListener { | @@ -361,9 +365,9 @@ public class StepService extends Service implements SensorEventListener { | ||
| 361 | public void onPushCallback(byte messageType, PushMessage pushMessage) { | 365 | public void onPushCallback(byte messageType, PushMessage pushMessage) { |
| 362 | Log.e(TAG, "onPushCallback: "); | 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 | FenceAlarmPushInfo alarmPushInfo = pushMessage.getFenceAlarmPushInfo(); | 371 | FenceAlarmPushInfo alarmPushInfo = pushMessage.getFenceAlarmPushInfo(); |
| 368 | if (null == alarmPushInfo) { | 372 | if (null == alarmPushInfo) { |
| 369 | return; | 373 | return; |
| @@ -381,7 +385,7 @@ public class StepService extends Service implements SensorEventListener { | @@ -381,7 +385,7 @@ public class StepService extends Service implements SensorEventListener { | ||
| 381 | else if (alarmPushInfo.getMonitoredAction() == MonitoredAction.enter) { | 385 | else if (alarmPushInfo.getMonitoredAction() == MonitoredAction.enter) { |
| 382 | EventBus.getDefault().post(new MessageEvent(Constant.ENTER_RANGE, "")); | 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,9 +408,12 @@ public class StepService extends Service implements SensorEventListener { | ||
| 404 | // 创建围栏回调 | 408 | // 创建围栏回调 |
| 405 | @Override | 409 | @Override |
| 406 | public void onCreateFenceCallback(CreateFenceResponse createFenceResponse) { | 410 | public void onCreateFenceCallback(CreateFenceResponse createFenceResponse) { |
| 407 | - if ("成功".equals(createFenceResponse.getMessage())) { | 411 | + if (null == createFenceResponse) { |
| 412 | + return; | ||
| 413 | + } | ||
| 414 | + if (0 == createFenceResponse.getStatus()) { | ||
| 408 | // Toast.makeText(context, "创建围栏回调成功", Toast.LENGTH_SHORT).show(); | 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 | List<Long> list = new ArrayList<>(); | 418 | List<Long> list = new ArrayList<>(); |
| 412 | list.add(createFenceResponse.getFenceId()); | 419 | list.add(createFenceResponse.getFenceId()); |
| @@ -438,11 +445,12 @@ public class StepService extends Service implements SensorEventListener { | @@ -438,11 +445,12 @@ public class StepService extends Service implements SensorEventListener { | ||
| 438 | // 监控状态回调 | 445 | // 监控状态回调 |
| 439 | @Override | 446 | @Override |
| 440 | public void onMonitoredStatusCallback(MonitoredStatusResponse monitoredStatusResponse) { | 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 | List<MonitoredStatusInfo> monitoredStatusInfos = monitoredStatusResponse.getMonitoredStatusInfos(); | 452 | List<MonitoredStatusInfo> monitoredStatusInfos = monitoredStatusResponse.getMonitoredStatusInfos(); |
| 445 | - if (monitoredStatusInfos == null||TextUtils.isEmpty(userStepEntity.getFenceId())) { | 453 | + if (monitoredStatusInfos == null || TextUtils.isEmpty(userStepEntity.getFenceId())) { |
| 446 | return; | 454 | return; |
| 447 | } | 455 | } |
| 448 | for (MonitoredStatusInfo monitoredStatusInfo : monitoredStatusInfos) { | 456 | for (MonitoredStatusInfo monitoredStatusInfo : monitoredStatusInfos) { |
| @@ -451,18 +459,18 @@ public class StepService extends Service implements SensorEventListener { | @@ -451,18 +459,18 @@ public class StepService extends Service implements SensorEventListener { | ||
| 451 | switch (status) { | 459 | switch (status) { |
| 452 | case in: | 460 | case in: |
| 453 | //监控的设备在围栏内 | 461 | //监控的设备在围栏内 |
| 454 | - Toast.makeText(getApplicationContext(), "监控的设备在围栏内", Toast.LENGTH_SHORT).show(); | 462 | +// Toast.makeText(getApplicationContext(), "监控的设备在围栏内", Toast.LENGTH_SHORT).show(); |
| 455 | Log.e(TAG, "监控的设备在围栏内: "); | 463 | Log.e(TAG, "监控的设备在围栏内: "); |
| 456 | break; | 464 | break; |
| 457 | case out: | 465 | case out: |
| 458 | //监控的设备在围栏外 | 466 | //监控的设备在围栏外 |
| 459 | - Toast.makeText(getApplicationContext(), "监控的设备在围栏外", Toast.LENGTH_SHORT).show(); | 467 | +// Toast.makeText(getApplicationContext(), "监控的设备在围栏外", Toast.LENGTH_SHORT).show(); |
| 460 | Log.e(TAG, "监控的设备在围栏外: "); | 468 | Log.e(TAG, "监控的设备在围栏外: "); |
| 461 | 469 | ||
| 462 | break; | 470 | break; |
| 463 | case unknown: | 471 | case unknown: |
| 464 | //监控的设备状态未知 | 472 | //监控的设备状态未知 |
| 465 | - Toast.makeText(getApplicationContext(), "监控的设备状态未知", Toast.LENGTH_SHORT).show(); | 473 | +// Toast.makeText(getApplicationContext(), "监控的设备状态未知", Toast.LENGTH_SHORT).show(); |
| 466 | Log.e(TAG, "监控的设备状态未知: "); | 474 | Log.e(TAG, "监控的设备状态未知: "); |
| 467 | 475 | ||
| 468 | break; | 476 | break; |
| @@ -498,7 +506,7 @@ public class StepService extends Service implements SensorEventListener { | @@ -498,7 +506,7 @@ public class StepService extends Service implements SensorEventListener { | ||
| 498 | Log.e(TAG, "onListMonitoredPersonCallback: "); | 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 | List<Long> fenids = new ArrayList<>(); | 510 | List<Long> fenids = new ArrayList<>(); |
| 503 | fenids.add(Long.parseLong(userStepEntity.getFenceId())); | 511 | fenids.add(Long.parseLong(userStepEntity.getFenceId())); |
| 504 | MonitoredStatusRequest request1 = MonitoredStatusRequest.buildServerRequest(Constant.TAG, | 512 | MonitoredStatusRequest request1 = MonitoredStatusRequest.buildServerRequest(Constant.TAG, |
| @@ -528,7 +536,7 @@ public class StepService extends Service implements SensorEventListener { | @@ -528,7 +536,7 @@ public class StepService extends Service implements SensorEventListener { | ||
| 528 | if (userStepEntity != null) { | 536 | if (userStepEntity != null) { |
| 529 | if (TextUtils.isEmpty(userStepEntity.getFenceId())) { | 537 | if (TextUtils.isEmpty(userStepEntity.getFenceId())) { |
| 530 | int fenceId = CommonInfo.getFenceId(getApplicationContext()); | 538 | int fenceId = CommonInfo.getFenceId(getApplicationContext()); |
| 531 | - Log.e(TAG, "onStartTraceCallback: 保存的围栏id" + fenceId); | 539 | +// Log.e(TAG, "onStartTraceCallback: 保存的围栏id" + fenceId); |
| 532 | //设置围栏id | 540 | //设置围栏id |
| 533 | StepUtil.setFenceId(getApplicationContext(), CommonInfo.getUserId(getApplicationContext()), fenceId + ""); | 541 | StepUtil.setFenceId(getApplicationContext(), CommonInfo.getUserId(getApplicationContext()), fenceId + ""); |
| 534 | } | 542 | } |
moudle_pedometer/src/main/res/layout/fragment_run_line.xml
| @@ -28,6 +28,7 @@ | @@ -28,6 +28,7 @@ | ||
| 28 | android:layout_toRightOf="@id/back_btn" | 28 | android:layout_toRightOf="@id/back_btn" |
| 29 | android:drawablePadding="7dp" | 29 | android:drawablePadding="7dp" |
| 30 | android:text="@string/beijing" | 30 | android:text="@string/beijing" |
| 31 | + android:visibility="gone" | ||
| 31 | android:textColor="#333333" | 32 | android:textColor="#333333" |
| 32 | android:textSize="15sp" /> | 33 | android:textSize="15sp" /> |
| 33 | 34 |