From 50f9b82ac862652e88444d727a32e0da1d824e9e Mon Sep 17 00:00:00 2001
From: zuoxiao <470321431@qq.com>
Date: 星期一, 13 一月 2025 15:57:06 +0800
Subject: [PATCH] 1.分水房相关 2.删除极光推送相关配置 3.优化图片显示相关

---
 app/src/main/java/com/dayu/pipirrapp/fragment/MapFragment.java |   82 ++++++++++++++++++++++++++++++-----------
 1 files changed, 60 insertions(+), 22 deletions(-)

diff --git a/app/src/main/java/com/dayu/pipirrapp/fragment/MapFragment.java b/app/src/main/java/com/dayu/pipirrapp/fragment/MapFragment.java
index 9266ffb..2715f12 100644
--- a/app/src/main/java/com/dayu/pipirrapp/fragment/MapFragment.java
+++ b/app/src/main/java/com/dayu/pipirrapp/fragment/MapFragment.java
@@ -17,7 +17,6 @@
 import android.webkit.WebResourceResponse;
 import android.webkit.WebView;
 import android.webkit.WebViewClient;
-import android.widget.RelativeLayout;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
@@ -32,13 +31,13 @@
 import com.dayu.pipirrapp.bean.db.LatLonBean;
 import com.dayu.pipirrapp.bean.db.MarkerBean;
 import com.dayu.pipirrapp.bean.net.CenterPointResult;
+import com.dayu.pipirrapp.bean.net.DivideResult;
 import com.dayu.pipirrapp.bean.net.InsectionResult;
 import com.dayu.pipirrapp.bean.net.InspectionRequest;
 import com.dayu.pipirrapp.bean.net.MarkerListResult;
 import com.dayu.pipirrapp.bean.net.MarkerResult;
 import com.dayu.pipirrapp.dao.DaoSingleton;
 import com.dayu.pipirrapp.databinding.FragmentMapBinding;
-import com.dayu.pipirrapp.tool.MyWebViewInterface;
 import com.dayu.pipirrapp.net.ApiManager;
 import com.dayu.pipirrapp.net.BaseResponse;
 import com.dayu.pipirrapp.net.Constants;
@@ -46,6 +45,7 @@
 import com.dayu.pipirrapp.observer.MapFragmenObserver;
 import com.dayu.pipirrapp.tool.InspectionUtils;
 import com.dayu.pipirrapp.tool.MarkerUtils;
+import com.dayu.pipirrapp.tool.MyWebViewInterface;
 import com.dayu.pipirrapp.utils.CommonData;
 import com.dayu.pipirrapp.utils.CommonKeyName;
 import com.dayu.pipirrapp.utils.DateUtils;
@@ -339,7 +339,6 @@
         MyLog.i(data);
         MarkerBean markerBean = markerBeanSet.get(data);
         if (markerBean != null) {
-            setWebViewParams(false);
             getInstakeDetail(markerBean);
         }
 
@@ -398,6 +397,7 @@
                 try {
                     if (t.isSuccess()) {
                         if (t.getContent() != null) {
+                            MyLog.d("InspectId:" + String.valueOf(t.getContent().get(0).getInspectId()));
                             mInspectionBean.setInspectId(String.valueOf(t.getContent().get(0).getInspectId()));
                             InspectionUtils.upataInspectionData(MapFragment.this.getContext(), mInspectionBean);
                         }
@@ -429,6 +429,7 @@
                     lastLatLonBean = latLonBean;
                     Log.i("chageInspecState", "lat:" + latLonBean.getLatitude() + ",log:" + latLonBean.getLongitude());
                     InspectionLocationBean inspectionLocationBean = InspectionUtils.createInspectionLocation(latLonBean, mInspectionBean);
+                    //娣诲姞宸℃璁板綍鍧愭爣
                     InspectionUtils.addInspectionLocationData(MapFragment.this.getContext(), inspectionLocationBean);
                     //鏇存柊鍒板湴鍥�
                     mWebView.evaluateJavascript("javascript:updateInspectionLocation(\"" + latLonBean.getLongitude() + "\",\"" + latLonBean.getLatitude() + "\")", value -> {
@@ -556,13 +557,16 @@
     public void setMapMarker(MarkerBean markerBean) {
         if (markerBean != null) {
             if (webViewIsFinished) {
-                mWebView.evaluateJavascript("javascript:addMarker(\"" + markerBean.getId() + "\",\"" + markerBean.getLng() + "\",\"" + markerBean.getLat() + "\",\"" + markerBean.getName() + "\")", new ValueCallback<String>() {
-                    @Override
-                    public void onReceiveValue(String value) {
-                    }
-                });
-                markerBeanSet.put(markerBean.getId(), markerBean);
-
+                if (!TextUtils.isEmpty(markerBean.getLng()) && !TextUtils.isEmpty(markerBean.getLat())) {
+                    mWebView.evaluateJavascript("javascript:addMarker(\"" + markerBean.getId() + "\",\"" + markerBean.getLng() + "\",\"" + markerBean.getLat() + "\",\"" + markerBean.getName() + "\")", new ValueCallback<String>() {
+                        @Override
+                        public void onReceiveValue(String value) {
+                        }
+                    });
+                    markerBeanSet.put(markerBean.getId(), markerBean);
+                } else {
+                    MyLog.d("setMapMarker>" + markerBean.getName() + "缁忕含搴︿负绌�");
+                }
             } else {
                 webNoFinishMarkerData.add(markerBean);
             }
@@ -577,7 +581,7 @@
      */
     private void startLocation() {
         //鑾峰彇瀹氫綅鏈嶅姟浼犺繃鏉ョ殑鍧愭爣鐐�
-        LiveEventBus.get(CommonKeyName.locationData).observeForever(locationObserver);
+        LiveEventBus.get(CommonKeyName.locationData).observe(this, locationObserver);
         binding.inspectRL.setVisibility(View.VISIBLE);
         binding.inspectButton.setVisibility(View.GONE);
         binding.inspectPause.setText("鏆傚仠");
@@ -726,17 +730,20 @@
         binding.lng.setText(markerBean.getLng());
         //淇敼缁忕含搴�
         binding.editePoint.setOnClickListener(v -> {
+
             mWebView.evaluateJavascript("javascript:showPin(\"" + markerBean.getLng() + "\",\"" + markerBean.getLat() + "\")", value -> {
+                binding.pointRL.setVisibility(View.VISIBLE);
+                binding.pointCenterImg.setVisibility(View.VISIBLE);
+                MyLog.d("showPin>>" + value);
             });
-            binding.pointRL.setVisibility(View.VISIBLE);
-            binding.pointCenterImg.setVisibility(View.VISIBLE);
-            setWebViewParams(true);
+
         });
         //鍙栨秷淇敼缁忕含搴�
         binding.pointCancel.setOnClickListener(v -> {
                     binding.pointCenterImg.setVisibility(View.GONE);
                     binding.pointRL.setVisibility(View.GONE);
                     mWebView.evaluateJavascript("javascript:cancelPin()", value -> {
+
                     });
                 }
         );
@@ -750,14 +757,45 @@
         });
     }
 
-    private void setWebViewParams(boolean isAbove) {
-        RelativeLayout.LayoutParams paramsAnotherView = new RelativeLayout.LayoutParams(
-                RelativeLayout.LayoutParams.MATCH_PARENT,
-                RelativeLayout.LayoutParams.MATCH_PARENT);
-        if (isAbove) {
-            paramsAnotherView.addRule(RelativeLayout.ABOVE, binding.bottomLL.getId());
-        }
-        binding.webViewRL.setLayoutParams(paramsAnotherView);
+    /**
+     * 鑾峰彇鍒嗘按鎴�
+     */
+    private void getDivideList() {
+        ApiManager.getInstance().requestPost(MapFragment.this.getContext(), BASE_URL + "/project/divide/getDivides", DivideResult.class, null, new SubscriberListener<BaseResponse<DivideResult>>() {
+            @Override
+            public void onNext(BaseResponse<DivideResult> t) {
+                try {
+                    if (t.isSuccess()) {
+//                       if (t.getContent().)
+//
+//
+//                        // 浣跨敤 RxJava 寮傛鎻掑叆鏁版嵁
+//                        DaoSingleton.getAsynchInstance(MapFragment.this.getContext()).markerDao().insertAll()
+//                                .subscribeOn(Schedulers.io()) // 鍦� IO 绾跨▼涓婃墽琛�
+//                                .observeOn(AndroidSchedulers.mainThread()) // 鍦ㄤ富绾跨▼涓婅瀵�
+//                                .subscribe(() -> {
+//                                    // 鎻掑叆鎴愬姛
+//                                    Log.i("mWebView", "鏁版嵁鎻掑叆鎴愬姛");
+//                                }, throwable -> {
+//                                    // 鎻掑叆澶辫触
+//                                    Log.e("mWebView", "鏁版嵁鎻掑叆澶辫触: " + throwable.getMessage());
+//                                });
+                    } else {
+                        ToastUtil.showToastLong(MapFragment.this.getContext(), t.getMsg());
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    CrashReport.postCatchedException(e);
+                }
+            }
+
+        });
     }
 
+
+    @Override
+    public void onDestroy() {
+        super.onDestroy();
+        LiveEventBus.get(CommonKeyName.locationData).removeObserver(locationObserver);
+    }
 }

--
Gitblit v1.8.0