feat(PhotoViewer): rich previews for image sharing

This commit is contained in:
FineFindus 2024-05-22 19:53:57 +02:00
parent f4a94bc42e
commit c0ab3a47ae
No known key found for this signature in database
GPG Key ID: 64873EE210FF8E6B
1 changed files with 2 additions and 1 deletions

View File

@ -648,7 +648,8 @@ public class PhotoViewer implements ZoomPanView.Listener{
private void shareFile(@NonNull File file) { private void shareFile(@NonNull File file) {
Intent intent = new Intent(Intent.ACTION_SEND); Intent intent = new Intent(Intent.ACTION_SEND);
Uri outputUri = FileProvider.getUriForFile(activity, activity.getPackageName() + ".fileprovider", file); 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); intent.putExtra(Intent.EXTRA_STREAM, outputUri);
activity.startActivity(Intent.createChooser(intent, activity.getString(R.string.button_share))); activity.startActivity(Intent.createChooser(intent, activity.getString(R.string.button_share)));
} }