Sfoglia il codice sorgente

照片水印由当前位置修改选择位置

ychk 5 mesi fa
parent
commit
ed88a1f1d7

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

@@ -97,6 +97,8 @@ public abstract class PhotoActivity extends LatteActivity implements TakePhoto.T
     public static final int VIDEO_REQUEST_CODE = 66;
     private boolean flag = true;
     private boolean isFirst = true;
+    private LocationUtil_xu.CoordinateClass locationWater = null;
+
 
     @Override
     protected void onCreate(@Nullable Bundle savedInstanceState) {
@@ -108,6 +110,7 @@ public abstract class PhotoActivity extends LatteActivity implements TakePhoto.T
         initMap(savedInstanceState);
         mapLoadHelper.setMapLocationListener((aMpPoint, addr, arcgisPoint) -> {
             lo = new LocationUtil_xu.CoordinateClass(arcgisPoint.longitude, arcgisPoint.latitude, addr);
+            locationWater = lo;
             if (TextUtils.isEmpty(addr)) {
                 mapLoadHelper.resetLocation();
             }
@@ -224,6 +227,7 @@ public abstract class PhotoActivity extends LatteActivity implements TakePhoto.T
             public void onRegeocodeSearched(RegeocodeResult regeocodeResult, int i) {
                 RegeocodeAddress regeocodeAddress = regeocodeResult.getRegeocodeAddress();
                 LocationUtil_xu.CoordinateClass loNew = new LocationUtil_xu.CoordinateClass(gisPoint.longitude, gisPoint.latitude, regeocodeAddress.getFormatAddress());
+                locationWater = loNew;
                 String headName = regeocodeAddress.getProvince() +
                         (regeocodeAddress.getCity().isEmpty() ? "" : ("/" + regeocodeAddress.getCity())) +
                         (regeocodeAddress.getDistrict().isEmpty() ? "" : ("/" + regeocodeAddress.getDistrict()) +
@@ -392,11 +396,11 @@ public abstract class PhotoActivity extends LatteActivity implements TakePhoto.T
 
     protected WaterMarkParams getWaterMarkParams() {
         WaterMarkParams params = null;
-        if (lo != null) {
+        if (locationWater != null) {
             params = new WaterMarkParams();
             params.mbNeedGps = 1;
-            String strLng = LocationUtil_xu.formatLocation(lo.Longtitude);
-            String strLat = LocationUtil_xu.formatLocation(lo.Latitude);
+            String strLng = LocationUtil_xu.formatLocation(locationWater.Longtitude);
+            String strLat = LocationUtil_xu.formatLocation(locationWater.Latitude);
             if (!strLng.isEmpty() && !strLat.isEmpty()) {
                 double lng = Double.parseDouble(strLng);
                 double lat = Double.parseDouble(strLat);
@@ -405,7 +409,7 @@ public abstract class PhotoActivity extends LatteActivity implements TakePhoto.T
                 params.mLongitude = strLng;
                 params.mLatitude = strLat;
             }
-            params.mAddress = lo.addr;
+            params.mAddress = locationWater.addr;
             UserBean userBean = new UserBean();
             params.mUser = userBean.getUsername();
             params.mReportTime = DateUtils.getDate();

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

@@ -92,10 +92,12 @@ public abstract class PhotoFragment extends LatteDelegate implements TakePhoto.T
     public AMap aMap;
     public MapView mapView;
     private boolean isLocation = true;
-    private boolean isRed = true;
+
     public static final int VIDEO_REQUEST_CODE = 66;
     private boolean flag = true;
     private boolean isFirst = true;
+    private LocationUtil_xu.CoordinateClass locationWater = null;
+
 
     @CallSuper
     @Override
@@ -107,6 +109,7 @@ public abstract class PhotoFragment extends LatteDelegate implements TakePhoto.T
         initMap(savedInstanceState);
         mapLoadHelper.setMapLocationListener((aMpPoint, addr, arcgisPoint) -> {
             lo = new LocationUtil_xu.CoordinateClass(arcgisPoint.longitude, arcgisPoint.latitude, addr);
+            locationWater = lo;
             if (TextUtils.isEmpty(addr)) {
                 mapLoadHelper.resetLocation();
             }
@@ -134,13 +137,6 @@ public abstract class PhotoFragment extends LatteDelegate implements TakePhoto.T
         this.isLocation = isLocation;
     }
 
-    /**
-     * 设置定位图标
-     */
-    public void setIsRed(boolean isRed) {
-        this.isRed = isRed;
-    }
-
     private void initMap(Bundle savedInstanceState) {
         mapView = rootView.findViewById(R.id.map_view);
         if (mapView != null) {
@@ -188,9 +184,6 @@ public abstract class PhotoFragment extends LatteDelegate implements TakePhoto.T
             double longitude = cameraPosition.target.longitude;
             LatLng latLng = new LatLng(latitude, longitude);
             LocationUtil_xu.CoordinateClass coordinate = LocationUtil_xu.gcj02towgs84(longitude, latitude);
-            if (coordinate == null) {
-                return;
-            }
             double lng = LocationUtil_xu.formatLocationDouble(coordinate.Longtitude);
             double lat = LocationUtil_xu.formatLocationDouble(coordinate.Latitude);
             LatLng mP = new LatLng(lat, lng);
@@ -217,6 +210,7 @@ public abstract class PhotoFragment extends LatteDelegate implements TakePhoto.T
             public void onRegeocodeSearched(RegeocodeResult regeocodeResult, int i) {
                 RegeocodeAddress regeocodeAddress = regeocodeResult.getRegeocodeAddress();
                 LocationUtil_xu.CoordinateClass loNew = new LocationUtil_xu.CoordinateClass(gisPoint.longitude, gisPoint.latitude, regeocodeAddress.getFormatAddress());
+                locationWater = loNew;
                 String headName = regeocodeAddress.getProvince() +
                         (regeocodeAddress.getCity().isEmpty() ? "" : ("/" + regeocodeAddress.getCity())) +
                         (regeocodeAddress.getDistrict().isEmpty() ? "" : ("/" + regeocodeAddress.getDistrict()) +
@@ -343,10 +337,7 @@ public abstract class PhotoFragment extends LatteDelegate implements TakePhoto.T
                 TImage tImage = result.getImage();
                 tImage.setOriginalPath(absolutePath);
             }
-              takeGraffiti(result.getImage().getOriginalPath());
-//            String imgUrl = result.getImage().getOriginalPath();
-//            BitmapUtils.compressImage(imgUrl);
-//            onTakePhotoSuccess(imgUrl);
+            takeGraffiti(result.getImage().getOriginalPath());
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -389,11 +380,11 @@ public abstract class PhotoFragment extends LatteDelegate implements TakePhoto.T
 
     protected WaterMarkParams getWaterMarkParams() {
         WaterMarkParams params = null;
-        if (lo != null) {
+        if (locationWater != null) {
             params = new WaterMarkParams();
             params.mbNeedGps = 1;
-            String strLng = LocationUtil_xu.formatLocation(lo.Longtitude);
-            String strLat = LocationUtil_xu.formatLocation(lo.Latitude);
+            String strLng = LocationUtil_xu.formatLocation(locationWater.Longtitude);
+            String strLat = LocationUtil_xu.formatLocation(locationWater.Latitude);
             if (!strLng.isEmpty() && !strLat.isEmpty()) {
                 double lng = Double.parseDouble(strLng);
                 double lat = Double.parseDouble(strLat);
@@ -402,7 +393,7 @@ public abstract class PhotoFragment extends LatteDelegate implements TakePhoto.T
                 params.mLongitude = strLng;
                 params.mLatitude = strLat;
             }
-            params.mAddress = lo.addr;
+            params.mAddress = locationWater.addr;
             UserBean userBean = new UserBean();
             params.mUser = userBean.getUsername();
             params.mReportTime = DateUtils.getDate();

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

@@ -611,7 +611,6 @@ public class UnCalibrateFragment extends PhotoFragment {
             binding.llMap.mapView.requestDisallowInterceptTouchEvent(motionEvent.getAction() != MotionEvent.ACTION_UP);
             isFirst = false;
         });
-        setIsRed(true);
         aMap.setOnCameraChangeListener(mapCameraChangeListener);
         binding.llMap.imDrag.setVisibility(View.VISIBLE);
         binding.llMap.imgNavit.setVisibility(View.GONE);

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

@@ -968,7 +968,6 @@ public class WaterCheckFragment extends PhotoFragment {
             binding.llMap.mapView.requestDisallowInterceptTouchEvent(motionEvent.getAction() != MotionEvent.ACTION_UP);
             isFirst = false;
         });
-        setIsRed(true);
         aMap.setOnCameraChangeListener(mapCameraChangeListener);
         binding.llMap.imDrag.setVisibility(View.VISIBLE);
         binding.llMap.imgNavit.setVisibility(View.GONE);