| | |
| | | |
| | | 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; |
| | |
| | | //关闭定位 |
| | | this.getActivity().stopService(location); |
| | | break; |
| | | case 1: |
| | | case InspectionUtils.STAT_INSPECTION://1开始 |
| | | //添加新的巡检记录 |
| | | startInspection(); |
| | | //获取定位服务传过来的坐标点 |
| | |
| | | } |
| | | 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() { |
| | |
| | | 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(); |