Browse Source

我的任务详情闪退处理

ychk 7 months ago
parent
commit
601084bdc4

+ 3 - 3
app/build.gradle

@@ -10,8 +10,8 @@ android {
         minSdkVersion 21
         //noinspection OldTargetApi
         targetSdkVersion 29
-        versionCode 65
-        versionName "6.5"
+        versionCode 66
+        versionName "6.6"
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
         ndk {
             abiFilters 'arm64-v8a', "x86"
@@ -101,7 +101,7 @@ dependencies {
     implementation 'com.amap.api:navi-3dmap:7.7.1_3dmap7.7.0'  //导航
 
     //noinspection GradleDependency
-    implementation 'id.zelory:compressor:2.1.0' // 图片压缩
+    implementation 'id.zelory:compressor:2.1.1' // 图片压缩
     implementation 'com.jph.takephoto:takephoto_library:4.0.3'
     implementation 'com.google.zxing:core:3.3.3'
     implementation 'com.github.yellowcath:VideoProcessor:2.4.0'

+ 7 - 7
app/src/main/java/com/tofly/yxpc/map/gaode/AmapLocationHelper.java

@@ -10,7 +10,6 @@ import com.amap.api.services.geocoder.GeocodeSearch;
 import com.amap.api.services.geocoder.RegeocodeQuery;
 import com.amap.api.services.geocoder.RegeocodeResult;
 import com.tofly.latte_core.config.Latte;
-import com.tofly.latte_core.utils.NetworkUtil;
 import com.tofly.latte_core.utils.ToastUtils;
 import com.tofly.yxpc.map.LocationUtil_xu;
 
@@ -26,8 +25,9 @@ public class AmapLocationHelper implements GeocodeSearch.OnGeocodeSearchListener
     private boolean isFirstLoc = true;
     private AmapReserveLocListener mReserveLocListener = null;
     private AmapLocChangeListener mLocationListener = null;
-    private int num=0;
-    private int num1=0;
+    private int num = 0;
+    private int num1 = 0;
+
     public AmapLocationHelper() {
         init();
     }
@@ -101,19 +101,19 @@ public class AmapLocationHelper implements GeocodeSearch.OnGeocodeSearchListener
                     double lng = LocationUtil_xu.formatLocationDouble(coordinate.Longtitude);
                     double lat = LocationUtil_xu.formatLocationDouble(coordinate.Latitude);
                     arcgisPoint = new LatLng(lat, lng);
-                    LatLng aMpPoint = new LatLng(location.getLongitude(), location.getLatitude());
+                    LatLng aMpPoint = new LatLng(location.getLatitude(), location.getLongitude());
                     mAddress = location.getAddress();
                     if (mLocationListener != null) {
                         mLocationListener.onLocationed(aMpPoint, mAddress, arcgisPoint);
                     }
                 }
             } else if (location.getErrorCode() == 12) {
-                if(num==0){
+                if (num == 0) {
                     ToastUtils.showToast("请打开定位权限");
                 }
                 num++;
-            }else if(location.getErrorCode() == 4){
-                if(num1==0){
+            } else if (location.getErrorCode() == 4) {
+                if (num1 == 0) {
                     ToastUtils.showToast("定位信号弱,未获取到位置信息!");
                 }
                 num1++;

+ 1 - 1
app/src/main/java/com/tofly/yxpc/ui/activity/PhotoActivity.java

@@ -200,7 +200,7 @@ public abstract class PhotoActivity extends LatteActivity implements TakePhoto.T
         public void onCameraChangeFinish(CameraPosition cameraPosition) {
             double latitude = cameraPosition.target.latitude;
             double longitude = cameraPosition.target.longitude;
-            LatLng latLng = new LatLng(longitude, latitude);
+            LatLng latLng = new LatLng(latitude, longitude);
             LocationUtil_xu.CoordinateClass coordinate = LocationUtil_xu.gcj02towgs84(longitude, latitude);
             if (coordinate == null) {
                 return;

+ 1 - 1
app/src/main/java/com/tofly/yxpc/ui/fragment/PhotoFragment.java

@@ -198,7 +198,7 @@ public abstract class PhotoFragment extends LatteDelegate implements TakePhoto.T
         public void onCameraChangeFinish(CameraPosition cameraPosition) {
             double latitude = cameraPosition.target.latitude;
             double longitude = cameraPosition.target.longitude;
-            LatLng latLng = new LatLng(longitude, latitude);
+            LatLng latLng = new LatLng(latitude, longitude);
             LocationUtil_xu.CoordinateClass coordinate = LocationUtil_xu.gcj02towgs84(longitude, latitude);
             if (coordinate == null) {
                 return;

+ 17 - 7
app/src/main/java/com/tofly/yxpc/ui/fragment/WaterCheckFragment.java

@@ -631,18 +631,22 @@ public class WaterCheckFragment extends PhotoFragment {
         binding.llMap.imgLocation.setOnClickListener(v -> {
             if (MyApp.getInstance().isOverTime() && lo != null) {
                 moveOrigin(lo.Longtitude, lo.Latitude);
-//                aMap.clear();
-//                aMap.addMarker(setMark(lo.Longtitude, lo.Latitude, "1"));
-                binding.edUserAddr.setText(lo.addr);
+                if (!TextUtils.isEmpty(lo.addr)) {
+                    binding.edUserAddr.setText(lo.addr);
+                }
             }
         });
         binding.llMap.imgMap.setOnClickListener(v -> {
             checkMap();
         });
-        locationUtilXuNew = new LocationUtil_xu.CoordinateClass(Double.parseDouble(waterMeterEntity.getLongitude())
-                , Double.parseDouble(waterMeterEntity.getLatitude()));
-        moveOrigin(locationUtilXuNew.Longtitude, locationUtilXuNew.Latitude);
-        binding.edUserAddr.setText(locationUtilXuNew.addr);
+        if (waterMeterEntity != null && waterMeterEntity.getLatitude() != null && waterMeterEntity.getLongitude() != null) {
+            locationUtilXuNew = new LocationUtil_xu.CoordinateClass(Double.parseDouble(waterMeterEntity.getLongitude())
+                    , Double.parseDouble(waterMeterEntity.getLatitude()), waterMeterEntity.getUserAddr());
+            moveOrigin(locationUtilXuNew.Longtitude, locationUtilXuNew.Latitude);
+            if (!TextUtils.isEmpty(locationUtilXuNew.addr)) {
+                binding.edUserAddr.setText(locationUtilXuNew.addr);
+            }
+        }
     }
 
     @Override
@@ -656,6 +660,9 @@ public class WaterCheckFragment extends PhotoFragment {
         super.initMapListener(info);
         locationUtilXuNew = info;
         binding.edInstallPosition.setText("经度:" + locationUtilXuNew.Longtitude + " 纬度:" + locationUtilXuNew.Latitude);
+        if (!TextUtils.isEmpty(locationUtilXuNew.addr)) {
+            binding.edUserAddr.setText(locationUtilXuNew.addr);
+        }
     }
 
     @Override
@@ -677,6 +684,9 @@ public class WaterCheckFragment extends PhotoFragment {
                 if (locationUtilXuNew != null) {
                     moveOrigin(locationUtilXuNew.Longtitude, locationUtilXuNew.Latitude);
                     binding.edInstallPosition.setText("经度:" + locationUtilXuNew.Longtitude + " 纬度:" + locationUtilXuNew.Latitude);
+                    if (!TextUtils.isEmpty(locationUtilXuNew.addr)) {
+                        binding.edUserAddr.setText(locationUtilXuNew.addr);
+                    }
                 }
             }
         }

+ 1 - 0
build.gradle

@@ -16,6 +16,7 @@ allprojects {
         google()
         jcenter()
         maven { url 'https://jitpack.io' }
+        maven { url 'https://maven.aliyun.com/repository/public/' }
     }
 }