diff --git a/app/src/main/java/com/keylesspalace/tusky/ViewMediaActivity.kt b/app/src/main/java/com/keylesspalace/tusky/ViewMediaActivity.kt
index f7c226e9..d6835f10 100644
--- a/app/src/main/java/com/keylesspalace/tusky/ViewMediaActivity.kt
+++ b/app/src/main/java/com/keylesspalace/tusky/ViewMediaActivity.kt
@@ -142,6 +142,7 @@ class ViewMediaActivity : BaseActivity(), ViewImageFragment.PhotoActionsListener
toolbar.setNavigationOnClickListener { supportFinishAfterTransition() }
toolbar.setOnMenuItemClickListener { item: MenuItem ->
when (item.itemId) {
+ R.id.action_open_in_external_app -> openInExternalApp()
R.id.action_download -> requestDownloadMedia()
R.id.action_open_status -> onOpenStatus()
R.id.action_share_media -> shareMedia()
@@ -269,6 +270,19 @@ class ViewMediaActivity : BaseActivity(), ViewImageFragment.PhotoActionsListener
startActivity(Intent.createChooser(sendIntent, resources.getText(R.string.send_media_to)))
}
+ private fun openInExternalApp() {
+ val url = attachments!![viewPager.currentItem].attachment.url
+ val intent = Intent(Intent.ACTION_VIEW)
+ val extension = MimeTypeMap.getFileExtensionFromUrl(url)
+ if(extension != null) {
+ intent.setDataAndType(Uri.parse(url), MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension))
+ } else {
+ intent.data = Uri.parse(url)
+ }
+
+ startActivity(intent)
+ }
+
private var isCreating: Boolean = false
diff --git a/app/src/main/res/drawable/ic_exit_to_app_24px.xml b/app/src/main/res/drawable/ic_exit_to_app_24px.xml
new file mode 100644
index 00000000..ce5bd595
--- /dev/null
+++ b/app/src/main/res/drawable/ic_exit_to_app_24px.xml
@@ -0,0 +1,9 @@
+