From c0ab3a47aefbe7b6be23292bd8d1cf6e5f2eb528 Mon Sep 17 00:00:00 2001 From: FineFindus Date: Wed, 22 May 2024 19:53:57 +0200 Subject: [PATCH] feat(PhotoViewer): rich previews for image sharing --- .../org/joinmastodon/android/ui/photoviewer/PhotoViewer.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/photoviewer/PhotoViewer.java b/mastodon/src/main/java/org/joinmastodon/android/ui/photoviewer/PhotoViewer.java index 2e7ada04f..abd203967 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/photoviewer/PhotoViewer.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/photoviewer/PhotoViewer.java @@ -648,7 +648,8 @@ public class PhotoViewer implements ZoomPanView.Listener{ private void shareFile(@NonNull File file) { Intent intent = new Intent(Intent.ACTION_SEND); Uri outputUri = FileProvider.getUriForFile(activity, activity.getPackageName() + ".fileprovider", file); - intent.setType(mimeTypeForFileName(outputUri.getLastPathSegment())); + intent.setDataAndType(outputUri, mimeTypeForFileName(outputUri.getLastPathSegment())); + intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.putExtra(Intent.EXTRA_STREAM, outputUri); activity.startActivity(Intent.createChooser(intent, activity.getString(R.string.button_share))); }