From 2fb397e4a31d14880ed2524f898ae67a0d664c06 Mon Sep 17 00:00:00 2001 From: zuoxiao <470321431@qq.com> Date: 星期二, 17 十二月 2024 11:24:29 +0800 Subject: [PATCH] 1.在地图中心显示中心点。 2.优化地图覆盖物显示,使显示的图标正对坐标。 3.优化地图覆盖物文字居中显示。 --- app/src/main/java/com/dayu/pipirrapp/tool/InspectionUtils.java | 24 +++++++++++++++--------- 1 files changed, 15 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/dayu/pipirrapp/tool/InspectionUtils.java b/app/src/main/java/com/dayu/pipirrapp/tool/InspectionUtils.java index add7b6f..0bc4fc2 100644 --- a/app/src/main/java/com/dayu/pipirrapp/tool/InspectionUtils.java +++ b/app/src/main/java/com/dayu/pipirrapp/tool/InspectionUtils.java @@ -21,14 +21,13 @@ import com.dayu.pipirrapp.net.BaseResponse; import com.dayu.pipirrapp.net.subscribers.SubscriberListener; import com.dayu.pipirrapp.utils.DateUtils; +import com.dayu.pipirrapp.utils.MyLog; import com.tencent.bugly.crashreport.CrashReport; import java.util.List; import java.util.UUID; import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers; -import io.reactivex.rxjava3.functions.Action; -import io.reactivex.rxjava3.functions.Consumer; import io.reactivex.rxjava3.schedulers.Schedulers; /** @@ -56,16 +55,20 @@ * @param fragment * @return */ - public static String getInspectionId(MapFragment fragment) { + public static void getInspectionId(MapFragment fragment) { DaoSingleton.getAsynchInstance(fragment.getContext()).inspectionDao().getMostRecentInspectionWithNoStopTime() .subscribeOn(Schedulers.io()) .observeOn(Schedulers.io()).subscribe(inspectionBean -> { }); - return ""; } + /** + * 缁х画鏄剧ず寮傚父鍏抽棴涔嬪墠鐨勫贰妫�鍧愭爣 + * + * @param fragment + */ public static void aginShowLocation(MapFragment fragment) { //鏌ヨ褰撳墠鏈叧闂殑宸℃璁板綍 DaoSingleton.getAsynchInstance(fragment.getContext()).inspectionDao().getMostRecentInspectionWithNoStopTime() @@ -147,7 +150,9 @@ .subscribeOn(Schedulers.io()) .observeOn(Schedulers.io()) .subscribe(inspectionLocationBeans -> { - postInspectionData(context, inspectionBeans, inspectionLocationBeans); + if (inspectionLocationBeans != null && inspectionLocationBeans.size() > 0) { + postInspectionData(context, inspectionBeans, inspectionLocationBeans); + } }); }); } @@ -163,6 +168,7 @@ * @param inspectionLocationBeans */ private static void postInspectionData(Context context, InspectionBean inspectionBean, List<InspectionLocationBean> inspectionLocationBeans) { + MyLog.d("postInspectionData>>>涓婁紶鏈笂浼犳垚鍔熺殑鏁版嵁"); InspectionRequest inspectionRequest = new InspectionRequest(); inspectionRequest.setInspectId(inspectionBean.getInspectId()); inspectionRequest.setInspectorId(inspectionBean.getInspectorId()); @@ -182,19 +188,20 @@ public void onNext(BaseResponse<List<InsectionResult>> t) { try { if (t.isSuccess()) { + MyLog.d("postInspectionData>>>涓婁紶鏈笂浼犳垚鍔熺殑鏁版嵁銆嬨�嬨�嬨�嬫垚鍔�"); if (t.getContent() != null) { inspectionBean.setInspectId(String.valueOf(t.getContent().get(0).getInspectId())); InspectionUtils.upataInspectionData(context, inspectionBean); } DaoSingleton.getAsynchInstance(context).inspectionLocationDao().updataByInspectIdSetIsPost(inspectionBean.getmInspectId()).subscribeOn(Schedulers.io()).observeOn(Schedulers.io()).subscribe(() -> { // 鎻掑叆鎴愬姛鐨勫洖璋� - Log.d(TAG, "addInspectionLocationData鏁版嵁鎻掑叆鎴愬姛"); + Log.d(TAG, "updataByInspectIdSetIsPost鏁版嵁鎻掑叆鎴愬姛"); }, throwable -> { // 澶勭悊閿欒 - Log.e(TAG, "addInspectionLocationData鏁版嵁鎻掑叆澶辫触", throwable); + Log.e(TAG, "updataByInspectIdSetIsPost鏁版嵁鎻掑叆澶辫触", throwable); }); } else { - + MyLog.d("postInspectionData>>>涓婁紶鏈笂浼犳垚鍔熺殑鏁版嵁銆嬨�嬨�嬨�嬪け璐�"); } } catch (Exception e) { e.printStackTrace(); @@ -272,7 +279,6 @@ inspectionLocationBean.setmInspectId(mInspectionBean.getmInspectId()); inspectionLocationBean.setLocateTime(DateUtils.getNowDateStr()); inspectionLocationBean.setPost(false); - inspectionLocationBean.setLng(String.valueOf(latLonBean.getLongitude())); inspectionLocationBean.setLat(String.valueOf(latLonBean.getLatitude())); return inspectionLocationBean; -- Gitblit v1.8.0