From 65a6bde49652558ada5daa15eca03d5061465a00 Mon Sep 17 00:00:00 2001
From: zuoxiao <470321431@qq.com>
Date: 星期五, 27 十二月 2024 18:00:46 +0800
Subject: [PATCH] 1.图片上传进度相关代码。 2.修复地图定位图标不居中问题。

---
 app/src/main/java/com/dayu/pipirrapp/net/ApiManager.java                |   51 ++++--
 app/src/main/java/com/dayu/pipirrapp/service/MyLocationService.java     |    2 
 app/src/main/assets/js/map.js                                           |   20 +
 app/src/main/java/com/dayu/pipirrapp/bean/net/UplodFileState.java       |   57 +++++-
 app/src/main/res/drawable/ic_error_picture.xml                          |   37 ++++
 app/src/main/java/com/dayu/pipirrapp/net/Constants.java                 |    4 
 app/src/main/java/com/dayu/pipirrapp/activity/OrderDealActivity.java    |   34 ++--
 app/src/main/java/com/dayu/pipirrapp/net/RetrofitClient.java            |    2 
 app/src/main/java/com/dayu/pipirrapp/net/upload/ProgressListener.java   |    2 
 app/src/main/java/com/dayu/pipirrapp/net/upload/IMGProgressLisener.java |   12 +
 app/src/main/res/values/colors.xml                                      |    1 
 app/src/main/java/com/dayu/pipirrapp/adapter/AddPictureAdapter.java     |  137 ++++++++++++----
 app/src/main/res/layout/activity_intake_detail.xml                      |    2 
 app/src/main/java/com/dayu/pipirrapp/bean/net/AddProcessingRequest.java |    7 
 app/src/main/res/layout/item_add_filter_image.xml                       |   27 +++
 app/src/main/java/com/dayu/pipirrapp/activity/AddIssueActivity.java     |   32 +--
 app/src/main/java/com/dayu/pipirrapp/bean/net/AddIssueRequest.java      |    9 
 app/build.gradle                                                        |    4 
 18 files changed, 322 insertions(+), 118 deletions(-)

diff --git a/app/build.gradle b/app/build.gradle
index 7d4ff46..39ae300 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -31,7 +31,6 @@
                 JPUSH_APPKEY  : "375adbd599ceb9977566b929",
                 //鏆傛椂濉啓榛樿鍊煎嵆鍙�.
                 JPUSH_CHANNEL : "developer-default",
-
                 //鑻ヤ笉闆嗘垚鍘傚晢閫氶亾锛屽彲鐩存帴璺宠繃浠ヤ笅閰嶇疆
                 MEIZU_APPKEY  : "MZ-榄呮棌鐨凙PPKEY",
                 MEIZU_APPID   : "MZ-榄呮棌鐨凙PPID",
@@ -189,4 +188,7 @@
         exclude group: 'androidx.core';
     }
 
+    //杩涘害鍔犺浇
+    implementation 'com.github.jenly1314:circleprogressview:1.1.3'
+
 }
\ No newline at end of file
diff --git a/app/src/main/assets/js/map.js b/app/src/main/assets/js/map.js
index cbd35c7..a13de46 100644
--- a/app/src/main/assets/js/map.js
+++ b/app/src/main/assets/js/map.js
@@ -123,10 +123,14 @@
     function locationOverLay(lng, lag) {
         console.log("function銆嬨�嬨�嬨�嬨�媗ocationOverLay");
         map.centerAndZoom(new T.LngLat(lng, lag), map.getZoom());
-        
+        let icon = new T.Icon({
+            iconUrl: CONFIG.IMAGES.LOCATION,
+            iconSize: new T.Point(20, 20),
+            iconAnchor: new T.Point(10, 10)
+        });
         let marker = new T.Marker(
             new T.LngLat(lng, lag), 
-            { icon: createIcon(CONFIG.IMAGES.LOCATION, 27) }
+            { icon: icon }
         );
         map.addOverLay(marker);
     }
@@ -241,16 +245,22 @@
             map.removeOverLay(locationMarker);
         }
         var newPoint = new T.LngLat(log, lat);
+        let icon = new T.Icon({
+            iconUrl: CONFIG.IMAGES.LOCATION,
+            iconSize: new T.Point(20, 20),
+            iconAnchor: new T.Point(10, 10)
+        });
+      
         locationMarker = new T.Marker(
             newPoint, 
-            { icon: createIcon(CONFIG.IMAGES.LOCATION, 20) }
+            { icon: icon }
         );
         map.addOverLay(locationMarker);
         map.panTo(newPoint);
     }
     //淇濆瓨瀹氫綅鍧愭爣鐢熸垚杞ㄨ抗
     var path = [];
-    var lineLayer = new T.Polyline([], { color: '#ff4500', weight: 3, opacity: 0.8 });
+    var lineLayer = new T.Polyline([], { color: '#E9900A', weight: 3, opacity: 0.8 });
     let locationMarker;
     function updateInspectionLocation(log, lat) {
         var lastLat = lat;
@@ -266,7 +276,7 @@
     }
 
     var aginPath = [];
-    var oldLineLayer = new T.Polyline([], { color: '#ff4500', weight: 3, opacity: 0.8 });
+    var oldLineLayer = new T.Polyline([], { color: '#E9900A', weight: 3, opacity: 0.8 });
     //鏄剧ず鍥犲紓甯稿叧闂殑宸℃璁板綍
     function aginShowLocation(lng, lat) {
         // 璋冪敤 Android 鎻愪緵鐨勬帴鍙o紝鑾峰彇鏁版嵁
diff --git a/app/src/main/java/com/dayu/pipirrapp/activity/AddIssueActivity.java b/app/src/main/java/com/dayu/pipirrapp/activity/AddIssueActivity.java
index d1e451e..8c3fa36 100644
--- a/app/src/main/java/com/dayu/pipirrapp/activity/AddIssueActivity.java
+++ b/app/src/main/java/com/dayu/pipirrapp/activity/AddIssueActivity.java
@@ -53,8 +53,10 @@
 import com.tencent.bugly.crashreport.CrashReport;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 import retrofit2.Call;
@@ -77,7 +79,8 @@
     private final List<LocalMedia> mData = new ArrayList<>();
     private ActivityResultLauncher<Intent> launcherResult;
     private ImageEngine imageEngine;
-    List<UplodFileState> uplodFileStates = new ArrayList<>();
+    Map<String, UplodFileState> uplodFileStates = new HashMap<>();
+    //    List<UplodFileState> uplodFileStates = new ArrayList<>();
     LatLonBean latLonBean;
 
     /**
@@ -112,7 +115,7 @@
         }
         mRecyclerView.addItemDecoration(new GridSpacingItemDecoration(4,
                 DensityUtil.dip2px(this, 8), false));
-        mAdapter = new AddPictureAdapter(this, mData);
+        mAdapter = new AddPictureAdapter(this, mData, uplodFileStates);
         mAdapter.setSelectMax(maxSelectNum + maxSelectVideoNum);
         mRecyclerView.setAdapter(mAdapter);
         imageEngine = GlideEngine.createGlideEngine();
@@ -140,7 +143,7 @@
         });
         binding.dealButton.setOnClickListener(v -> {
             boolean isAllPost = true;
-            for (UplodFileState imgData : uplodFileStates) {
+            for (UplodFileState imgData : uplodFileStates.values()) {
                 if (imgData.getState() == 0) {
                     isAllPost = false;
                 }
@@ -223,7 +226,7 @@
     private void analyticalSelectResults(ArrayList<LocalMedia> result) {
         //鑾峰彇褰撳墠uplodFileStates鎵�鏈夌殑鍥剧墖鍦板潃
         Set<String> existingPaths = new HashSet<>();
-        for (UplodFileState uplodData : uplodFileStates) {
+        for (UplodFileState uplodData : uplodFileStates.values()) {
             existingPaths.add(uplodData.getFilePath());
         }
         //鑾峰彇鍦≒ictureSelector鐨勭浉鍐屾椂鍙栨秷閫変腑鐨勫浘鐗�
@@ -262,7 +265,7 @@
             if (!existingPaths.contains(compressPath)) {
                 UplodFileState uplodFileState = new UplodFileState();
                 uplodFileState.setFilePath(compressPath);
-                uplodFileStates.add(uplodFileState);
+                uplodFileStates.put(compressPath, uplodFileState);
                 // 鎵ц涓婁紶鍥剧墖鐨勬搷浣�
                 uplodeImg(uplodFileState);
             }
@@ -273,14 +276,16 @@
         if (!existingPaths.isEmpty()) {
             List<UplodFileState> toRemove = new ArrayList<>();
             for (String path : existingPaths) {
-                for (UplodFileState uplodFileState : uplodFileStates) {
+                for (UplodFileState uplodFileState : uplodFileStates.values()) {
                     if (path.equals(uplodFileState.getFilePath())) {
                         uplodFileState.getThisCall().cancel();
                         toRemove.add(uplodFileState);
                     }
                 }
             }
-            uplodFileStates.removeAll(toRemove);
+            for (UplodFileState removeFile : toRemove) {
+                uplodFileStates.remove(removeFile.getFilePath());
+            }
         }
         runOnUiThread(new Runnable() {
             @Override
@@ -303,17 +308,10 @@
         ApiManager.getInstance().uploadFile(this, uplodFileState, new UploadFileListener() {
             @Override
             public void onBack(UplodFileState state) {
-                for (UplodFileState uplodFile : uplodFileStates) {
-                    if (uplodFile.getFilePath().equals(state.getFilePath())) {
-                        int index = uplodFileStates.indexOf(uplodFile);
-                        if (index != -1) {
-                            uplodFileStates.set(index, uplodFile); // 鏇存柊瀵瑰簲鐨勯」
-                        }
-                    }
-
-                }
+                uplodFileStates.replace(state.getFilePath(), state);
+                mAdapter.updateProgress(uplodFileState);
             }
-        });
+        }, mAdapter);
     }
 
     /**
diff --git a/app/src/main/java/com/dayu/pipirrapp/activity/OrderDealActivity.java b/app/src/main/java/com/dayu/pipirrapp/activity/OrderDealActivity.java
index ffc7a1c..aa18d33 100644
--- a/app/src/main/java/com/dayu/pipirrapp/activity/OrderDealActivity.java
+++ b/app/src/main/java/com/dayu/pipirrapp/activity/OrderDealActivity.java
@@ -53,8 +53,10 @@
 import com.tencent.bugly.crashreport.CrashReport;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 import retrofit2.Call;
@@ -77,7 +79,8 @@
     private final List<LocalMedia> mData = new ArrayList<>();
     private ActivityResultLauncher<Intent> launcherResult;
     private ImageEngine imageEngine;
-    List<UplodFileState> uplodFileStates = new ArrayList<>();
+//    List<UplodFileState> uplodFileStates = new ArrayList<>();
+Map<String, UplodFileState> uplodFileStates = new HashMap<>();
     String workOrderId;
     LatLonBean latLonBean;
 
@@ -116,7 +119,7 @@
         }
         mRecyclerView.addItemDecoration(new GridSpacingItemDecoration(4,
                 DensityUtil.dip2px(this, 8), false));
-        mAdapter = new AddPictureAdapter(this, mData);
+        mAdapter = new AddPictureAdapter(this, mData, uplodFileStates);
         mAdapter.setSelectMax(maxSelectNum + maxSelectVideoNum);
         mRecyclerView.setAdapter(mAdapter);
         imageEngine = GlideEngine.createGlideEngine();
@@ -144,7 +147,7 @@
         });
         binding.dealButton.setOnClickListener(v -> {
             boolean isAllPost = true;
-            for (UplodFileState imgData : uplodFileStates) {
+            for (UplodFileState imgData : uplodFileStates.values()) {
                 if (imgData.getState() == 0) {
                     isAllPost = false;
                 }
@@ -227,7 +230,7 @@
     private void analyticalSelectResults(ArrayList<LocalMedia> result) {
         //鑾峰彇褰撳墠uplodFileStates鎵�鏈夌殑鍥剧墖鍦板潃
         Set<String> existingPaths = new HashSet<>();
-        for (UplodFileState uplodData : uplodFileStates) {
+        for (UplodFileState uplodData : uplodFileStates.values()) {
             existingPaths.add(uplodData.getFilePath());
         }
         //鑾峰彇鍦≒ictureSelector鐨勭浉鍐屾椂鍙栨秷閫変腑鐨勫浘鐗�
@@ -265,7 +268,7 @@
             if (!existingPaths.contains(compressPath)) {
                 UplodFileState uplodFileState = new UplodFileState();
                 uplodFileState.setFilePath(compressPath);
-                uplodFileStates.add(uplodFileState);
+                uplodFileStates.put(compressPath, uplodFileState);
                 // 鎵ц涓婁紶鍥剧墖鐨勬搷浣�
                 uplodeImg(uplodFileState);
             }
@@ -277,14 +280,16 @@
         if (!existingPaths.isEmpty()) {
             List<UplodFileState> toRemove = new ArrayList<>();
             for (String path : existingPaths) {
-                for (UplodFileState uplodFileState : uplodFileStates) {
+                for (UplodFileState uplodFileState : uplodFileStates.values()) {
                     if (path.equals(uplodFileState.getFilePath())) {
                         uplodFileState.getThisCall().cancel();
                         toRemove.add(uplodFileState);
                     }
                 }
             }
-            uplodFileStates.removeAll(toRemove);
+            for (UplodFileState removeFile : toRemove) {
+                uplodFileStates.remove(removeFile.getFilePath());
+            }
         }
         runOnUiThread(() -> {
             boolean isMaxSize = result.size() == mAdapter.getSelectMax();
@@ -304,17 +309,10 @@
         ApiManager.getInstance().uploadFile(this, uplodFileState, new UploadFileListener() {
             @Override
             public void onBack(UplodFileState state) {
-                for (UplodFileState uplodFile : uplodFileStates) {
-                    if (uplodFile.getFilePath().equals(state.getFilePath())) {
-                        int index = uplodFileStates.indexOf(uplodFile);
-                        if (index != -1) {
-                            uplodFileStates.set(index, uplodFile); // 鏇存柊瀵瑰簲鐨勯」
-                        }
-                    }
-
-                }
+                uplodFileStates.replace(state.getFilePath(), state);
+                mAdapter.updateProgress(uplodFileState);
             }
-        });
+        }, mAdapter);
     }
 
     /**
@@ -355,7 +353,7 @@
      * 寮�濮嬪畾浣嶇浉鍏抽�昏緫
      */
     private void startLocation() {
-        ServiceUtils.startLocationService(this,true);
+        ServiceUtils.startLocationService(this, true);
         //鑾峰彇瀹氫綅鏈嶅姟浼犺繃鏉ョ殑鍧愭爣鐐�
         LiveEventBus.get(CommonKeyName.locationData).observeForever(locationObserver);
     }
diff --git a/app/src/main/java/com/dayu/pipirrapp/adapter/AddPictureAdapter.java b/app/src/main/java/com/dayu/pipirrapp/adapter/AddPictureAdapter.java
index f2f00db..b30b0fa 100644
--- a/app/src/main/java/com/dayu/pipirrapp/adapter/AddPictureAdapter.java
+++ b/app/src/main/java/com/dayu/pipirrapp/adapter/AddPictureAdapter.java
@@ -6,6 +6,7 @@
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.ImageView;
+import android.widget.RelativeLayout;
 import android.widget.TextView;
 
 import androidx.annotation.NonNull;
@@ -14,7 +15,10 @@
 import com.bumptech.glide.Glide;
 import com.bumptech.glide.load.engine.DiskCacheStrategy;
 import com.dayu.pipirrapp.R;
+import com.dayu.pipirrapp.bean.net.UplodFileState;
 import com.dayu.pipirrapp.listener.OnItemLongClickListener;
+import com.dayu.pipirrapp.utils.MyLog;
+import com.king.view.circleprogressview.CircleProgressView;
 import com.luck.picture.lib.config.PictureMimeType;
 import com.luck.picture.lib.config.SelectMimeType;
 import com.luck.picture.lib.entity.LocalMedia;
@@ -22,6 +26,7 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 /**
  * AddPictureAdapter -
@@ -37,26 +42,16 @@
     public static final int TYPE_PICTURE = 2;
     private final LayoutInflater mInflater;
     private final ArrayList<LocalMedia> list = new ArrayList<>();
+    Map<String, UplodFileState> fileStates;
     private int selectMax = 9;
+    private Context mContext;
 
-    /**
-     * 鍒犻櫎
-     */
-    public void delete(int position) {
-        try {
-            if (position != RecyclerView.NO_POSITION && list.size() > position) {
-                list.remove(position);
-                notifyItemRemoved(position);
-                notifyItemRangeChanged(position, list.size());
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
 
-    public AddPictureAdapter(Context context, List<LocalMedia> result) {
+    public AddPictureAdapter(Context context, List<LocalMedia> result, Map<String, UplodFileState> fileStates) {
         this.mInflater = LayoutInflater.from(context);
         this.list.addAll(result);
+        this.mContext = context;
+        this.fileStates = fileStates;
     }
 
     public void setSelectMax(int selectMax) {
@@ -77,19 +72,6 @@
         }
     }
 
-    public static class ViewHolder extends RecyclerView.ViewHolder {
-
-        ImageView mImg;
-        ImageView mIvDel;
-        TextView tvDuration;
-
-        public ViewHolder(View view) {
-            super(view);
-            mImg = view.findViewById(R.id.fiv);
-            mIvDel = view.findViewById(R.id.iv_del);
-            tvDuration = view.findViewById(R.id.tv_duration);
-        }
-    }
 
     @Override
     public int getItemCount() {
@@ -132,16 +114,15 @@
         //灏戜簬MaxSize寮狅紝鏄剧ず缁х画娣诲姞鐨勫浘鏍�
         if (getItemViewType(position) == TYPE_CAMERA) {
             viewHolder.mImg.setImageResource(R.mipmap.ic_add_image);
-            viewHolder.mImg.setOnClickListener(new View.OnClickListener() {
-                @Override
-                public void onClick(View view) {
-                    if (mItemClickListener != null) {
-                        mItemClickListener.openPicture();
-                    }
+            viewHolder.mImg.setOnClickListener(view -> {
+                if (mItemClickListener != null) {
+                    mItemClickListener.openPicture();
                 }
             });
             viewHolder.mIvDel.setVisibility(View.INVISIBLE);
+            viewHolder.circleProgressView.setVisibility(View.GONE);
         } else {
+            //鍒犻櫎鍥剧墖
             viewHolder.mIvDel.setVisibility(View.VISIBLE);
             viewHolder.mIvDel.setOnClickListener(view -> {
                 int index = viewHolder.getAbsoluteAdapterPosition();
@@ -179,6 +160,29 @@
                         .diskCacheStrategy(DiskCacheStrategy.ALL)
                         .into(viewHolder.mImg);
             }
+
+            // 鏇存柊杩涘害
+            UplodFileState uplodFileState = fileStates.get(media.getCompressPath());
+            uplodFileState.setAdapterPosition(position);
+            MyLog.d("progressRequestBodyHolder>>>" + "State:" + uplodFileState.getState() + ">>>position:" + position + ">>>Progress: " + uplodFileState.getProgress());
+
+            if (uplodFileState.getState() == UplodFileState.STATE_UPDING) {
+                if (uplodFileState.getProgress() < 100) {
+                    viewHolder.maskLayerBg.setVisibility(View.VISIBLE);
+                    viewHolder.circleProgressView.setVisibility(View.VISIBLE);
+                    viewHolder.circleProgressView.setProgress(uplodFileState.getProgress());
+
+                } else {
+                    viewHolder.circleProgressView.setVisibility(View.GONE);
+                    viewHolder.maskLayerBg.setVisibility(View.GONE);
+                }
+            } else if (fileStates.get(media.getCompressPath()).getState() ==  UplodFileState.STATE_DONE) {
+                viewHolder.maskLayerBg.setVisibility(View.GONE);
+                viewHolder.circleProgressView.setVisibility(View.GONE);
+            } else {
+                viewHolder.maskLayerBg.setVisibility(View.VISIBLE);
+            }
+
             //itemView 鐨勭偣鍑讳簨浠�
             if (mItemClickListener != null) {
                 viewHolder.itemView.setOnClickListener(v -> {
@@ -194,6 +198,33 @@
                     return true;
                 });
             }
+        }
+    }
+
+    /**
+     * 鏇存柊杩涘害
+     *
+     * @param uplodFileState
+     */
+    public void updateProgress(UplodFileState uplodFileState) {
+        MyLog.d("updateProgress>>>" + "State:" + uplodFileState.getState() + ">>>position:" + uplodFileState.getAdapterPosition() + ">>>Progress: " + uplodFileState.getProgress());
+
+        // 鏇存柊杩涘害鍙傛暟
+        if (fileStates.containsKey(uplodFileState.getFilePath())) {
+            if (uplodFileState.getState()==0){
+                // 鑾峰彇宸叉湁鐨� UplodFileState 瀵硅薄骞舵洿鏂拌繘搴�
+                UplodFileState existingState = fileStates.get(uplodFileState.getFilePath());
+                existingState.setProgress(uplodFileState.getProgress()); // 鏇存柊杩涘害
+                // 鑾峰彇杩涘害鏇存柊椤圭殑浣嶇疆
+                int position = existingState.getAdapterPosition();
+                if (position != RecyclerView.NO_POSITION) {
+                    // 閫氱煡閫傞厤鍣ㄥ埛鏂版寚瀹氫綅缃殑椤�
+                    notifyItemChanged(position);
+                }
+            }else if (uplodFileState.getState()==2){
+
+            }
+
         }
     }
 
@@ -230,4 +261,42 @@
     public void setItemLongClickListener(OnItemLongClickListener l) {
         this.mItemLongClickListener = l;
     }
+
+
+    /**
+     * 鍒犻櫎
+     */
+    public void delete(int position) {
+        try {
+            if (position != RecyclerView.NO_POSITION && list.size() > position) {
+                list.remove(position);
+                notifyItemRemoved(position);
+                notifyItemRangeChanged(position, list.size());
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static class ViewHolder extends RecyclerView.ViewHolder {
+
+        ImageView mImg;
+        ImageView mIvDel;
+        ImageView postError;
+        TextView tvDuration;
+        RelativeLayout maskLayerBg;
+        CircleProgressView circleProgressView;
+
+
+        public ViewHolder(View view) {
+            super(view);
+            mImg = view.findViewById(R.id.fiv);
+            mIvDel = view.findViewById(R.id.iv_del);
+            tvDuration = view.findViewById(R.id.tv_duration);
+            circleProgressView = view.findViewById(R.id.cpv);
+            maskLayerBg=view.findViewById(R.id.mask_layer_bg);
+            postError=view.findViewById(R.id.postError);
+        }
+    }
+
 }
\ No newline at end of file
diff --git a/app/src/main/java/com/dayu/pipirrapp/bean/net/AddIssueRequest.java b/app/src/main/java/com/dayu/pipirrapp/bean/net/AddIssueRequest.java
index de7c782..0f353e3 100644
--- a/app/src/main/java/com/dayu/pipirrapp/bean/net/AddIssueRequest.java
+++ b/app/src/main/java/com/dayu/pipirrapp/bean/net/AddIssueRequest.java
@@ -2,6 +2,7 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 /**
  * AddIssueRequest -
@@ -10,7 +11,7 @@
  * @version 1.0
  * @since 2024-12-09
  */
-public class AddIssueRequest extends BaseRequest{
+public class AddIssueRequest extends BaseRequest {
     String workOrderId;//宸ュ崟ID
     String inspectorId;//宸℃鍛業D
     String content;//缁撴灉鍐呭
@@ -47,12 +48,12 @@
         return images;
     }
 
-    public void setImages(List<UplodFileState> states) {
+    public void setImages(Map<String, UplodFileState> states) {
         images.clear();
-        for (UplodFileState data : states) {
+        for (UplodFileState data : states.values()) {
             ImageRequest image = new ImageRequest();
             image.setWebPath(data.getWebPath());
-            image.setId(data.getId());
+            image.setId(data.getPostId());
             images.add(image);
         }
     }
diff --git a/app/src/main/java/com/dayu/pipirrapp/bean/net/AddProcessingRequest.java b/app/src/main/java/com/dayu/pipirrapp/bean/net/AddProcessingRequest.java
index 16c65f9..1e2f91e 100644
--- a/app/src/main/java/com/dayu/pipirrapp/bean/net/AddProcessingRequest.java
+++ b/app/src/main/java/com/dayu/pipirrapp/bean/net/AddProcessingRequest.java
@@ -2,6 +2,7 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 /**
  * AddProcessingResult -涓婃姤澶勭悊缁撴灉
@@ -72,12 +73,12 @@
         return images;
     }
 
-    public void setImages(List<UplodFileState> states) {
+    public void setImages(Map<String, UplodFileState> states) {
         images.clear();
-        for (UplodFileState data : states) {
+        for (UplodFileState data : states.values()) {
             ImageRequest image = new ImageRequest();
             image.setWebPath(data.getWebPath());
-            image.setId(data.getId());
+            image.setId(data.getPostId());
             images.add(image);
         }
     }
diff --git a/app/src/main/java/com/dayu/pipirrapp/bean/net/UplodFileState.java b/app/src/main/java/com/dayu/pipirrapp/bean/net/UplodFileState.java
index 2980e4b..9b8f46d 100644
--- a/app/src/main/java/com/dayu/pipirrapp/bean/net/UplodFileState.java
+++ b/app/src/main/java/com/dayu/pipirrapp/bean/net/UplodFileState.java
@@ -1,6 +1,7 @@
 package com.dayu.pipirrapp.bean.net;
 
 import com.dayu.pipirrapp.net.BaseResponse;
+import com.luck.picture.lib.entity.LocalMedia;
 
 import retrofit2.Call;
 
@@ -10,13 +11,47 @@
  * Date: 2023-04-15 8:15
  * Description:
  */
-public class UplodFileState {
-    int state = 0;//0姝e湪涓婁紶 1涓婁紶瀹屾垚 2涓婁紶澶辫触
-    String filePath;//涓婁紶鐨勬枃浠�
-    int number;//澶辫触鍚庨噸璇曠殑娆℃暟
-    String id;//涓婁紶鍚庣殑id
-    String webPath;//涓婁紶鍚庣殑鍦板潃
-    Call<BaseResponse> thisCall;//褰撳墠璇锋眰
+public class UplodFileState extends LocalMedia {
+    //姝e湪涓婁紶
+    public final static int STATE_UPDING = 0;
+    //涓婁紶瀹屾垚
+    public final static int STATE_DONE = 1;
+    //涓婁紶澶辫触
+    public final static int STATE_ERROR = 2;
+
+    //0姝e湪涓婁紶 1涓婁紶瀹屾垚 2涓婁紶澶辫触
+    int state = 0;
+    //涓婁紶鐨勬枃浠�
+    String filePath;
+    //澶辫触鍚庨噸璇曠殑娆℃暟
+    int number;
+    //涓婁紶鍚庣殑id
+    String postId;
+    //涓婁紶鍚庣殑鍦板潃
+    String webPath;
+    //褰撳墠璇锋眰
+    Call<BaseResponse> thisCall;
+    //鍥剧墖涓婁紶杩涘害
+    int progress;
+    //adapter涓殑position
+    int adapterPosition = -1;
+
+    public int getAdapterPosition() {
+        return adapterPosition;
+    }
+
+    public void setAdapterPosition(int adapterPosition) {
+        this.adapterPosition = adapterPosition;
+    }
+
+    public int getProgress() {
+        return progress;
+    }
+
+    public void setProgress(int progress) {
+        this.progress = progress;
+    }
+
 
     public Call<BaseResponse> getThisCall() {
         return thisCall;
@@ -54,12 +89,12 @@
         this.filePath = filePath;
     }
 
-    public String getId() {
-        return id;
+    public String getPostId() {
+        return postId;
     }
 
-    public void setId(String id) {
-        this.id = id;
+    public void setPostId(String postId) {
+        this.postId = postId;
     }
 
     public String getWebPath() {
diff --git a/app/src/main/java/com/dayu/pipirrapp/net/ApiManager.java b/app/src/main/java/com/dayu/pipirrapp/net/ApiManager.java
index 12f0033..d0d399a 100644
--- a/app/src/main/java/com/dayu/pipirrapp/net/ApiManager.java
+++ b/app/src/main/java/com/dayu/pipirrapp/net/ApiManager.java
@@ -5,10 +5,12 @@
 import android.annotation.SuppressLint;
 import android.content.Context;
 import android.content.Intent;
+import android.text.TextUtils;
 import android.util.Log;
 
 import com.dayu.pipirrapp.MyApplication;
 import com.dayu.pipirrapp.activity.LoginActivity;
+import com.dayu.pipirrapp.adapter.AddPictureAdapter;
 import com.dayu.pipirrapp.bean.net.CodeResult;
 import com.dayu.pipirrapp.bean.net.UplodFileState;
 import com.dayu.pipirrapp.bean.net.WeatherResponse;
@@ -16,6 +18,7 @@
 import com.dayu.pipirrapp.net.subscribers.CodeListener;
 import com.dayu.pipirrapp.net.subscribers.ProgressSubscriber;
 import com.dayu.pipirrapp.net.subscribers.SubscriberListener;
+import com.dayu.pipirrapp.net.upload.IMGProgressLisener;
 import com.dayu.pipirrapp.net.upload.ProgressListener;
 import com.dayu.pipirrapp.net.upload.ProgressRequestBody;
 import com.dayu.pipirrapp.net.upload.UploadFileListener;
@@ -145,7 +148,12 @@
                             }
                             BaseResponse<T> response = new BaseResponse<>();
                             response.setCode(tem.getCode());
-                            response.setMsg(tem.getMsg());
+                            if (!TextUtils.isEmpty(tem.getMsg())){
+                                response.setMsg(tem.getMsg());
+                            }else {
+                                response.setMsg("");
+                            }
+
 
                             if (tClass != null) {
                                 if (tem.getContent() instanceof Map) {
@@ -280,6 +288,10 @@
     }
 
 
+//    public void uploadFile(final Context context, final UplodFileState uplodData, final UploadFileListener listener) {
+//        uploadFile(context, uplodData, listener, null);
+//    }
+
     /**
      * 涓婁紶鏂囦欢
      *
@@ -287,22 +299,24 @@
      * @param uplodData
      * @param listener
      */
-    public void uploadFile(final Context context, final UplodFileState uplodData, final UploadFileListener listener) {
-
+    public void uploadFile(final Context context, final UplodFileState uplodData, final UploadFileListener listener, final AddPictureAdapter adapter) {
+        MyLog.d("progressRequestBody>>>" + "path:" + uplodData.getFilePath() );
         File file = new File(uplodData.getFilePath());
         RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file);
-        ProgressRequestBody progressRequestBody = new ProgressRequestBody(requestBody, new ProgressListener() {
-            @Override
-            public void onProgress(long bytesWritten, long contentLength, boolean done) {
-                // 鏇存柊杩涘害鏉℃垨杩涜鍏朵粬鎿嶄綔
-                int progress = (int) (100 * bytesWritten / contentLength);
-                // 渚嬪锛氭洿鏂� ProgressBar 鎴栨樉绀鸿繘搴�
-                runOnUiThread(() -> {
-                    // 杩涘害鏉℃洿鏂颁唬鐮�
-                    // progressBar.setProgress(progress);
-                    MyLog.d("progressRequestBody>>>" + "涓婁紶杩涘害: " + progress + "%");
-                });
-            }
+        ProgressRequestBody progressRequestBody = new ProgressRequestBody(requestBody, (bytesWritten, contentLength, done) -> {
+//            MyLog.d("progressRequestBody>>>" + "bytesWritten:" + bytesWritten + ">>>contentLength: " + contentLength );
+            // 鏇存柊杩涘害鏉℃垨杩涜鍏朵粬鎿嶄綔
+            int progress = (int) (100 * bytesWritten / contentLength);
+            // 渚嬪锛氭洿鏂� ProgressBar 鎴栨樉绀鸿繘搴�
+            runOnUiThread(() -> {
+                uplodData.setProgress(progress);
+                // 杩涘害鏉℃洿鏂颁唬鐮�
+                if (adapter != null && uplodData.getAdapterPosition() != -1) {
+                    adapter.updateProgress(uplodData);
+                }
+                MyLog.d("progressRequestBody>>>" + "adapterPosition:" + uplodData.getAdapterPosition() + ">>>涓婁紶杩涘害: " + progress + "%");
+            });
+
         });
         MultipartBody.Part body = MultipartBody.Part.createFormData("file", file.getName(), progressRequestBody);
         RequestBody description = RequestBody.create(MediaType.parse("text/plain"), "file description");
@@ -314,14 +328,14 @@
                 if (response.body() != null) {
                     if (response.body().isSuccess()) {
                         uplodData.setState(1);
-                        uplodData.setId(((LinkedTreeMap) response.body().getContent()).get("id").toString());
+                        uplodData.setPostId(((LinkedTreeMap) response.body().getContent()).get("id").toString());
                         uplodData.setWebPath(((LinkedTreeMap) response.body().getContent()).get("webPath").toString());
                         listener.onBack(uplodData);
                     } else {
                         if (uplodData.getNumber() <= uplodFilerepeatSize) {
                             uplodData.setNumber(uplodData.getNumber() + 1);
                             uplodData.setState(2);
-                            uploadFile(context, uplodData, listener);
+                            uploadFile(context, uplodData, listener, adapter);
                         } else {
                             listener.onBack(uplodData);
                         }
@@ -334,7 +348,7 @@
                 if (uplodData.getNumber() <= uplodFilerepeatSize) {
                     uplodData.setNumber(uplodData.getNumber() + 1);
                     uplodData.setState(2);
-                    uploadFile(context, uplodData, listener);
+                    uploadFile(context, uplodData, listener, adapter);
                 } else {
                     listener.onBack(uplodData);
                 }
@@ -342,7 +356,6 @@
         });
 
     }
-
 
 
     /**
diff --git a/app/src/main/java/com/dayu/pipirrapp/net/Constants.java b/app/src/main/java/com/dayu/pipirrapp/net/Constants.java
index 5954697..1bb800f 100644
--- a/app/src/main/java/com/dayu/pipirrapp/net/Constants.java
+++ b/app/src/main/java/com/dayu/pipirrapp/net/Constants.java
@@ -7,8 +7,8 @@
  */
 public class Constants {
 //    public static final String BASE_URL = "http://192.168.10.52:8088";
-//public static final String BASE_URL = "https://no253541tf71.vicp.fun";
-public static final String BASE_URL = "http://fve2iz.natappfree.cc";
+public static final String BASE_URL = "https://no253541tf71.vicp.fun";
+//public static final String BASE_URL = "http://fve2iz.natappfree.cc";
     /**
      * 浠h〃璇锋眰鎴愬姛
      */
diff --git a/app/src/main/java/com/dayu/pipirrapp/net/RetrofitClient.java b/app/src/main/java/com/dayu/pipirrapp/net/RetrofitClient.java
index ec2db90..3d4cdc6 100644
--- a/app/src/main/java/com/dayu/pipirrapp/net/RetrofitClient.java
+++ b/app/src/main/java/com/dayu/pipirrapp/net/RetrofitClient.java
@@ -36,7 +36,7 @@
         //娣诲姞鏃ュ織鎷︽埅鍣�
         //娣诲姞鏁版嵁璇锋眰缁熶竴澶勭悊鎷︽埅鍣�
 //        if (BuildConfig.DEBUG) {
-        builder.addInterceptor(loggingInterceptor);
+//        builder.addInterceptor(loggingInterceptor);
 //        }
 
         OkHttpClient client = builder.build();
diff --git a/app/src/main/java/com/dayu/pipirrapp/net/upload/IMGProgressLisener.java b/app/src/main/java/com/dayu/pipirrapp/net/upload/IMGProgressLisener.java
new file mode 100644
index 0000000..5537b14
--- /dev/null
+++ b/app/src/main/java/com/dayu/pipirrapp/net/upload/IMGProgressLisener.java
@@ -0,0 +1,12 @@
+package com.dayu.pipirrapp.net.upload;
+
+/**
+ * IMGProgressLisener -
+ *
+ * @author zuoxiao
+ * @version 1.0
+ * @since 2024-12-24
+ */
+public interface IMGProgressLisener {
+    void onProgress(int progress);
+}
diff --git a/app/src/main/java/com/dayu/pipirrapp/net/upload/ProgressListener.java b/app/src/main/java/com/dayu/pipirrapp/net/upload/ProgressListener.java
index 6a34b04..3dc13f6 100644
--- a/app/src/main/java/com/dayu/pipirrapp/net/upload/ProgressListener.java
+++ b/app/src/main/java/com/dayu/pipirrapp/net/upload/ProgressListener.java
@@ -1,5 +1,5 @@
 package com.dayu.pipirrapp.net.upload;
 
 public interface ProgressListener {
-    void onProgress(long bytesWritten, long totalBytes, boolean done);
+    void onProgress(long progress, long totalBytes, boolean done);
 }
diff --git a/app/src/main/java/com/dayu/pipirrapp/service/MyLocationService.java b/app/src/main/java/com/dayu/pipirrapp/service/MyLocationService.java
index 7e8a6bd..cc6113b 100644
--- a/app/src/main/java/com/dayu/pipirrapp/service/MyLocationService.java
+++ b/app/src/main/java/com/dayu/pipirrapp/service/MyLocationService.java
@@ -162,7 +162,7 @@
                 MyLog.i("鍘熺敓瀹氫綅娌℃湁鏉冮檺>>>>");
                 return;
             }
-            locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 0, listener);
+            locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 1, listener);
         } catch (Exception e) {
             CrashReport.postCatchedException(e);
         }
diff --git a/app/src/main/res/drawable/ic_error_picture.xml b/app/src/main/res/drawable/ic_error_picture.xml
new file mode 100644
index 0000000..eb88036
--- /dev/null
+++ b/app/src/main/res/drawable/ic_error_picture.xml
@@ -0,0 +1,37 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="48"
+    android:viewportHeight="48">
+  <path
+      android:pathData="M44,23.994C44,22.89 43.105,21.994 42,21.994C40.895,21.994 40,22.89 40,23.994H44ZM24,7.994C25.105,7.994 26,7.099 26,5.994C26,4.89 25.105,3.994 24,3.994V7.994ZM39,39.994H9V43.994H39V39.994ZM8,38.994V8.994H4V38.994H8ZM40,23.994V38.994H44V23.994H40ZM9,7.994H24V3.994H9V7.994ZM9,39.994C8.448,39.994 8,39.546 8,38.994H4C4,41.756 6.239,43.994 9,43.994V39.994ZM39,43.994C41.761,43.994 44,41.756 44,38.994H40C40,39.546 39.552,39.994 39,39.994V43.994ZM8,8.994C8,8.442 8.448,7.994 9,7.994V3.994C6.239,3.994 4,6.233 4,8.994H8Z"
+      android:fillColor="#ff0000"/>
+  <path
+      android:pathData="M6,35L16.693,25.198C17.439,24.514 18.578,24.495 19.346,25.154L32,36"
+      android:strokeLineJoin="round"
+      android:strokeWidth="4"
+      android:fillColor="#00000000"
+      android:strokeColor="#ff0000"
+      android:strokeLineCap="round"/>
+  <path
+      android:pathData="M28,31L32.773,26.226C33.477,25.523 34.591,25.444 35.388,26.041L42,31"
+      android:strokeLineJoin="round"
+      android:strokeWidth="4"
+      android:fillColor="#00000000"
+      android:strokeColor="#ff0000"
+      android:strokeLineCap="round"/>
+  <path
+      android:pathData="M33,7L41,15"
+      android:strokeLineJoin="round"
+      android:strokeWidth="4"
+      android:fillColor="#00000000"
+      android:strokeColor="#ff0000"
+      android:strokeLineCap="round"/>
+  <path
+      android:pathData="M41,7L33,15"
+      android:strokeLineJoin="round"
+      android:strokeWidth="4"
+      android:fillColor="#00000000"
+      android:strokeColor="#ff0000"
+      android:strokeLineCap="round"/>
+</vector>
diff --git a/app/src/main/res/layout/activity_intake_detail.xml b/app/src/main/res/layout/activity_intake_detail.xml
index cf66891..f98de27 100644
--- a/app/src/main/res/layout/activity_intake_detail.xml
+++ b/app/src/main/res/layout/activity_intake_detail.xml
@@ -29,7 +29,7 @@
             android:id="@+id/ScrollView"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
-            android:layout_above="@+id/delete_button"
+
             android:layout_below="@+id/title"
             android:layout_marginTop="5dp"
             android:layout_marginBottom="5dp">
diff --git a/app/src/main/res/layout/item_add_filter_image.xml b/app/src/main/res/layout/item_add_filter_image.xml
index 074b184..929c680 100644
--- a/app/src/main/res/layout/item_add_filter_image.xml
+++ b/app/src/main/res/layout/item_add_filter_image.xml
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <com.luck.picture.lib.widget.SquareRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="wrap_content">
@@ -41,4 +42,30 @@
         android:textSize="11sp"
         android:visibility="gone"
         tools:visibility="visible" />
+
+
+    <RelativeLayout
+        android:id="@+id/mask_layer_bg"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:background="@color/mask_layer_bg">
+
+        <com.king.view.circleprogressview.CircleProgressView
+            android:id="@+id/cpv"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_centerHorizontal="true"
+            android:layout_centerVertical="true"
+            app:cpvShowTick="false"
+            app:cpvStrokeWidth="2dp" />
+
+        <ImageView
+            android:id="@+id/postError"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_margin="40dp"
+            android:src="@drawable/ic_error_picture" />
+    </RelativeLayout>
+
+
 </com.luck.picture.lib.widget.SquareRelativeLayout>
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 6aaba63..740b969 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -30,4 +30,5 @@
     <color name="delete_color">#ff0000</color>
     <color name="item_bg_color">#F9F9F9</color>
     <color name="item_name_text_color">#828282</color>
+    <color name="mask_layer_bg">#BF828282</color>
 </resources>
\ No newline at end of file

--
Gitblit v1.8.0