| | |
| | | public double centerLng; |
| | | public double centerLat; |
| | | |
| | | MarkerBean mMarkerBean; |
| | | |
| | | @Override |
| | | public void onAttach(@NonNull Context context) { |
| | | super.onAttach(context); |
| | |
| | | @Override |
| | | public void onCreate(@Nullable Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | setRetainInstance(true); |
| | | Log.i(TAG, "onCreate"); |
| | | mInspectionState = SharedPreferencesHelper.getInstance(this.getContext()).get(CommonKeyName.inspectionState, 0); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取取水口列表 |
| | | */ |
| | |
| | | //巡检按钮 |
| | | binding.inspectButton.setOnClickListener(v -> { |
| | | if (XXPermissions.isGranted(MapFragment.this.getContext(), Permission.ACCESS_BACKGROUND_LOCATION)) { |
| | | chageInspecState(InspectionUtils.STAT_INSPECTION_ONCLICK); |
| | | new ConfirmDialog(MapFragment.this.getActivity(), (confirmDialog, v1) -> { |
| | | chageInspecState(InspectionUtils.STAT_INSPECTION_ONCLICK); |
| | | confirmDialog.dismiss(); |
| | | }).show(); |
| | | |
| | | } else { |
| | | TipUtil.show(MapFragment.this.getActivity(), "巡检定位需要您选择\"始终允许\"定位信息,否则无法巡检。", new TipUtil.TipListener() { |
| | | @Override |
| | |
| | | }); |
| | | binding.pointCenterImg.setVisibility(View.GONE); |
| | | binding.pointRL.setVisibility(View.GONE); |
| | | mMarkerBean.setLat(lat); |
| | | mMarkerBean.setLng(lng); |
| | | binding.lng.setText(lng); |
| | | binding.lat.setText(lat); |
| | | mWebView.evaluateJavascript("javascript:cancelPin()", value -> { |
| | |
| | | public void onNext(BaseResponse<MarkerResult> t) { |
| | | if (t.isSuccess()) { |
| | | MarkerResult result = t.getContent(); |
| | | MarkerBean markerBean = new MarkerBean(); |
| | | markerBean.setId(result.getId()); |
| | | markerBean.setLng(result.getLng()); |
| | | markerBean.setLat(result.getLat()); |
| | | markerBean.setBlockId(result.getBlockId()); |
| | | markerBean.setName(result.getName()); |
| | | markerBean.setRemarks(result.getRemarks()); |
| | | markerBean.setTownId(result.getTownId()); |
| | | markerBean.setVillageId(result.getVillageId()); |
| | | markerBean.setCountyId(result.getCountyId()); |
| | | markerBean.setAddress(result.getAddress()); |
| | | markerBean.setBlockName(result.getBlockName()); |
| | | markerBean.setDivideId(result.getDivideId()); |
| | | showMarker(markerBean); |
| | | mMarkerBean = new MarkerBean(); |
| | | mMarkerBean.setId(result.getId()); |
| | | mMarkerBean.setLng(result.getLng()); |
| | | mMarkerBean.setLat(result.getLat()); |
| | | mMarkerBean.setBlockId(result.getBlockId()); |
| | | mMarkerBean.setName(result.getName()); |
| | | mMarkerBean.setRemarks(result.getRemarks()); |
| | | mMarkerBean.setTownId(result.getTownId()); |
| | | mMarkerBean.setVillageId(result.getVillageId()); |
| | | mMarkerBean.setCountyId(result.getCountyId()); |
| | | mMarkerBean.setAddress(result.getAddress()); |
| | | mMarkerBean.setBlockName(result.getBlockName()); |
| | | mMarkerBean.setDivideId(result.getDivideId()); |
| | | showMarker(mMarkerBean); |
| | | } else { |
| | | ToastUtil.showToast(MapFragment.this.getContext(), t.getMsg()); |
| | | } |
| | |
| | | public void onDestroy() { |
| | | super.onDestroy(); |
| | | LiveEventBus.get(CommonKeyName.locationData).removeObserver(locationObserver); |
| | | if (mWebView != null) { |
| | | mWebView.destroy(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | mWebView.onResume(); |
| | | mWebView.resumeTimers(); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | mWebView.onPause(); |
| | | mWebView.pauseTimers(); |
| | | } |
| | | |
| | | @Override |
| | | public void onSaveInstanceState(@NonNull Bundle outState) { |
| | | super.onSaveInstanceState(outState); |
| | | mWebView.saveState(outState); |
| | | } |
| | | |
| | | @Override |
| | | public void onViewStateRestored(@Nullable Bundle savedInstanceState) { |
| | | super.onViewStateRestored(savedInstanceState); |
| | | if (savedInstanceState != null) { |
| | | mWebView.restoreState(savedInstanceState); |
| | | } |
| | | } |
| | | } |