From 29273fb4fadbb0db9f0422d6cd66cb18cc1a6691 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 9 Jun 2016 21:15:43 +0200 Subject: [PATCH] fix sharing videos --- .../gallery/activities/ViewPagerActivity.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java b/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java index 8cda938c6..3adac5d24 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java +++ b/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java @@ -119,11 +119,15 @@ public class ViewPagerActivity extends AppCompatActivity private void shareMedium() { final String shareTitle = getResources().getString(R.string.share_via); final Intent sendIntent = new Intent(); + final Medium medium = getCurrentMedium(); final File file = getCurrentFile(); final Uri uri = Uri.fromFile(file); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_STREAM, uri); - sendIntent.setType("image/*"); + if (medium.getIsVideo()) + sendIntent.setType("video/*"); + else + sendIntent.setType("image/*"); startActivity(Intent.createChooser(sendIntent, shareTitle)); } @@ -316,8 +320,12 @@ public class ViewPagerActivity extends AppCompatActivity setTitle(Utils.getFilename(media.get(pager.getCurrentItem()).getPath())); } + private Medium getCurrentMedium() { + return media.get(pos); + } + private File getCurrentFile() { - return new File(media.get(pos).getPath()); + return new File(getCurrentMedium().getPath()); } private void addUndoMargin() {