diff --git a/app/src/main/java/org/lineageos/glimpse/ext/Intent.kt b/app/src/main/java/org/lineageos/glimpse/ext/Intent.kt index 08540c2..32c3061 100644 --- a/app/src/main/java/org/lineageos/glimpse/ext/Intent.kt +++ b/app/src/main/java/org/lineageos/glimpse/ext/Intent.kt @@ -7,9 +7,16 @@ package org.lineageos.glimpse.ext import android.content.Intent import android.net.Uri +import org.lineageos.glimpse.models.Media fun Intent.shareIntent(vararg uris: Uri) = apply { action = Intent.ACTION_SEND_MULTIPLE putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris.toCollection(ArrayList())) type = "*/*" } + +fun Intent.editIntent(media: Media) = apply { + action = Intent.ACTION_EDIT + setDataAndType(media.externalContentUri, media.mimeType) + flags = Intent.FLAG_GRANT_READ_URI_PERMISSION +} diff --git a/app/src/main/java/org/lineageos/glimpse/fragments/MediaViewerFragment.kt b/app/src/main/java/org/lineageos/glimpse/fragments/MediaViewerFragment.kt index 044f71d..cd7ea09 100644 --- a/app/src/main/java/org/lineageos/glimpse/fragments/MediaViewerFragment.kt +++ b/app/src/main/java/org/lineageos/glimpse/fragments/MediaViewerFragment.kt @@ -285,6 +285,13 @@ class MediaViewerFragment : Fragment( } } + adjustButton.setOnClickListener { + mediaViewerAdapter.getMediaFromMediaStore(viewPager.currentItem)?.let { + val intent = Intent().editIntent(it) + startActivity(Intent.createChooser(intent, null)) + } + } + if (!permissionsUtils.mainPermissionsGranted()) { mainPermissionsRequestLauncher.launch(PermissionsUtils.mainPermissions) } else {