Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3cd637ac authored by Mohammed Althaf T's avatar Mohammed Althaf T 😊
Browse files

camera: Fix wrong file uri sent in intent.

- Delete option in gallery became unusable
- Disable edit only if uri is not accessible at all.
parent 5daab802
Loading
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -4156,8 +4156,9 @@ public class MainActivity extends AppCompatActivity {
        if( MyDebug.LOG )
            Log.d(TAG, "openGallery");
        //Intent intent = new Intent(Intent.ACTION_VIEW, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
        Uri uri = applicationInterface.getStorageUtils().getLastMediaScanned();
        boolean is_raw = uri != null && applicationInterface.getStorageUtils().getLastMediaScannedIsRaw();
        Uri primaryUri = applicationInterface.getStorageUtils().getLastMediaScanned();
        Uri uri = null;
        boolean is_raw = false;
        if( MyDebug.LOG && uri != null ) {
            Log.d(TAG, "found cached most recent uri: " + uri);
            Log.d(TAG, "    is_raw: " + is_raw);
@@ -4208,6 +4209,14 @@ public class MainActivity extends AppCompatActivity {
            uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
            is_raw = false;
        }

        boolean allowEdit = true;
        if( uri == null ) {
            uri = primaryUri;
            is_raw = uri != null && applicationInterface.getStorageUtils().getLastMediaScannedIsRaw();
            allowEdit = false;
        }

        if( !is_test ) {
            // don't do if testing, as unclear how to exit activity to finish test (for testGallery())
            if( MyDebug.LOG )
@@ -4225,7 +4234,7 @@ public class MainActivity extends AppCompatActivity {
                    Log.d(TAG, "try REVIEW_ACTION");
                try {
                    Intent intent = new Intent(REVIEW_ACTION, uri);
                    intent.putExtra(KEY_FROM_SNAPCAM, true);
                    intent.putExtra(KEY_FROM_SNAPCAM, allowEdit);
                    this.startActivity(intent);
                    done = true;
                }
@@ -4238,7 +4247,7 @@ public class MainActivity extends AppCompatActivity {
                    Log.d(TAG, "try ACTION_VIEW");
                try {
                    Intent intent = new Intent(Intent.ACTION_VIEW, uri);
                    intent.putExtra(KEY_FROM_SNAPCAM, true);
                    intent.putExtra(KEY_FROM_SNAPCAM, allowEdit);
                    this.startActivity(intent);
                }
                catch(ActivityNotFoundException e) {