管灌系统巡查员智能手机App
app/src/main/java/com/dayu/pipirrapp/fragment/MapFragment.java
@@ -6,6 +6,7 @@
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.location.LocationManager;
import android.os.Build;
import android.os.Bundle;
@@ -486,7 +487,7 @@
                //关闭定位
                this.getActivity().stopService(location);
                break;
            case 1:
            case InspectionUtils.STAT_INSPECTION://1开始
                //添加新的巡检记录
                startInspection();
                //获取定位服务传过来的坐标点
@@ -504,15 +505,21 @@
                }
                mInspectionBean = InspectionUtils.startInspection(this.getContext());
                inspectionRequest = new InspectionRequest();
                SharedPreferencesHelper.getInstance(this.getContext()).put(CommonKeyName.inspectionState, InspectionUtils.STAT_INSPECTION);
                break;
            case 2://暂停
                LiveEventBus.get(CommonKeyName.locationData).removeObserver(locationObserver);
                //关闭定位
                this.getActivity().stopService(location);
                binding.stateText.setText("已暂停巡检");
                binding.inspectPause.setText("继续");
                binding.inspectRL.setBackgroundColor(this.getContext().getResources().getColor(R.color.inspect_rl_bg_color));
                try {
                    LiveEventBus.get(CommonKeyName.locationData).removeObserver(locationObserver);
                    //关闭定位
                    this.getActivity().stopService(location);
                    binding.stateText.setText("已暂停巡检");
                    binding.inspectPause.setText("继续");
                    binding.inspectRL.setBackgroundColor(this.getContext().getResources().getColor(R.color.inspect_rl_bg_color));
                    SharedPreferencesHelper.getInstance(this.getContext()).put(CommonKeyName.inspectionState, InspectionUtils.PAUSE_INSPECTION);
                } catch (Resources.NotFoundException e) {
                    e.printStackTrace();
                }
                break;
            case 3:
                ConfirmDialog confirmDialog = new ConfirmDialog(MapFragment.this.getActivity(), "提示", "确认关闭巡检吗?", new ConfirmDialog.ConfirmOnClickListener() {
@@ -520,6 +527,7 @@
                    public void onClick(ConfirmDialog confirmDialog, View v) {
                        confirmDialog.dismiss();
                        chageInspecState(InspectionUtils.NO_INSPECTION);
                        SharedPreferencesHelper.getInstance(MapFragment.this.getContext()).put(CommonKeyName.inspectionState, InspectionUtils.NO_INSPECTION);
                    }
                });
                confirmDialog.show();