管灌系统巡查员智能手机App
zuoxiao
2024-12-12 c91d4503a63013be3242120ae0ad9cd1b0b8127e
app/src/main/java/com/dayu/pipirrapp/activity/OrderDealActivity.java
@@ -4,7 +4,6 @@
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
@@ -30,7 +29,6 @@
import com.dayu.pipirrapp.net.BaseResponse;
import com.dayu.pipirrapp.net.subscribers.SubscriberListener;
import com.dayu.pipirrapp.net.upload.UploadFileListener;
import com.dayu.pipirrapp.service.MyLocationService;
import com.dayu.pipirrapp.tool.FullyGridLayoutManager;
import com.dayu.pipirrapp.tool.GlideEngine;
import com.dayu.pipirrapp.tool.ImageFileCompressEngine;
@@ -227,10 +225,13 @@
     * @param result
     */
    private void analyticalSelectResults(ArrayList<LocalMedia> result) {
        //获取当前uplodFileStates所有的图片地址
        Set<String> existingPaths = new HashSet<>();
        for (UplodFileState uplodData : uplodFileStates) {
            existingPaths.add(uplodData.getFilePath());
        }
        //获取在PictureSelector的相册时取消选中的图片
        Set<String> resultPaths = new HashSet<>();
        for (LocalMedia media : result) {
            if (media.getWidth() == 0 || media.getHeight() == 0) {
                if (PictureMimeType.isHasImage(media.getMimeType())) {
@@ -269,7 +270,19 @@
                uplodeImg(uplodFileState);
            }
            resultPaths.add(media.getCompressPath());
        }
        //处理从相册返回时取消的图片处理
        existingPaths.removeAll(resultPaths);
        if (!existingPaths.isEmpty()) {
            for (String path : existingPaths) {
                for (UplodFileState uplodFileState : uplodFileStates) {
                    if (path.equals(uplodFileState.getFilePath())) {
                        uplodFileState.getThisCall().cancel();
                        uplodFileStates.remove(uplodFileState);
                    }
                }
            }
        }
        runOnUiThread(new Runnable() {
            @Override
@@ -343,16 +356,7 @@
     * 开始定位相关逻辑
     */
    private void startLocation() {
        if (!ServiceUtils.isServiceRunning(this, MyLocationService.class)) {
            Intent location = new Intent(this, MyLocationService.class);
            location.putExtra("isSingle", true);
            //开启定位
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
                startForegroundService(location);
            } else {
                startService(location);
            }
        }
        ServiceUtils.startLocationService(this,true);
        //获取定位服务传过来的坐标点
        LiveEventBus.get(CommonKeyName.locationData).observeForever(locationObserver);
    }