mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-05 08:33:37 +02:00
Use ShareCompat.IntentBuilder to share an attachment
This way the share sheet will show a preview when sharing images.
This commit is contained in:
@@ -116,6 +116,7 @@ import androidx.appcompat.widget.PopupMenu;
|
||||
import androidx.constraintlayout.helper.widget.Flow;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.constraintlayout.widget.Group;
|
||||
import androidx.core.app.ShareCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.content.FileProvider;
|
||||
import androidx.core.content.pm.ShortcutInfoCompat;
|
||||
@@ -3984,12 +3985,12 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
if (uris == null)
|
||||
return;
|
||||
|
||||
final Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
|
||||
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
|
||||
intent.setType("image/*");
|
||||
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
context.startActivity(Intent.createChooser(intent, context.getString(R.string.app_name)));
|
||||
ShareCompat.IntentBuilder shareIntentBuilder = new ShareCompat.IntentBuilder(context);
|
||||
shareIntentBuilder.setType("image/*");
|
||||
for (Uri uri: uris) {
|
||||
shareIntentBuilder.addStream(uri);
|
||||
}
|
||||
shareIntentBuilder.startChooser();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user