管灌系统巡查员智能手机App
zuoxiao
2025-01-10 c2c902a3bf998632ffffa9c1508aceba7b5a7b45
app/src/main/java/com/dayu/pipirrapp/net/ApiManager.java
@@ -313,13 +313,18 @@
                int progress = (int) (100 * bytesWritten / contentLength);
                // 例如:更新 ProgressBar 或显示进度
                runOnUiThread(() -> {
                    if (progress <5) {
                        uplodData.setProgress(0);
                    }
                    // 进度条更新代码
                    if (adapter != null && uplodData.getAdapterPosition() != -1) {
                        //优化不频繁更新进度
                        if (progress - uplodData.getProgress() > 5 || progress == 100){
                        if (progress - uplodData.getProgress() > 5 || progress == 100) {
                            uplodData.setProgress(progress);
                            adapter.updateProgress(uplodData);
                        }
                    }
                    MyLog.d("progressRequestBodyHolder>>>path" + "adapterPosition:" + uplodData.getAdapterPosition() + ">>>上传进度: " + progress + "%");
                });