Glimpse: Instance share and edit intents from the extension
Change-Id: Iba3fe9ffc965c15c6763a15e7ec99b4296a48074
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 b66c202..2338024 100644
--- a/app/src/main/java/org/lineageos/glimpse/ext/Intent.kt
+++ b/app/src/main/java/org/lineageos/glimpse/ext/Intent.kt
@@ -10,7 +10,7 @@
import org.lineageos.glimpse.models.MediaType.IMAGE
import org.lineageos.glimpse.models.MediaType.VIDEO
-fun Intent.shareIntent(vararg medias: Media) = apply {
+fun buildShareIntent(vararg medias: Media) = Intent().apply {
assert(medias.isNotEmpty()) { "No media" }
if (medias.size == 1) {
@@ -37,7 +37,7 @@
flags = Intent.FLAG_GRANT_READ_URI_PERMISSION
}
-fun Intent.editIntent(media: Media) = apply {
+fun buildEditIntent(media: Media) = Intent().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 0274464..a9fb446 100644
--- a/app/src/main/java/org/lineageos/glimpse/fragments/MediaViewerFragment.kt
+++ b/app/src/main/java/org/lineageos/glimpse/fragments/MediaViewerFragment.kt
@@ -304,14 +304,14 @@
shareButton.setOnClickListener {
mediaViewerAdapter.getItemAtPosition(viewPager.currentItem).let {
- val intent = Intent().shareIntent(it)
+ val intent = buildShareIntent(it)
startActivity(Intent.createChooser(intent, null))
}
}
adjustButton.setOnClickListener {
mediaViewerAdapter.getItemAtPosition(viewPager.currentItem).let {
- val intent = Intent().editIntent(it)
+ val intent = buildEditIntent(it)
startActivity(Intent.createChooser(intent, null))
}
}