From 127bc5103454d05e47feca262e84aa3003b90dde Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Wed, 27 Nov 2024 16:48:42 -0500 Subject: [PATCH] Fix take photo option for choose media (cherry picked from commit 3857d7e52f7485e0055d8f0b9be08fb53250aa4f) --- .../siacs/conversations/ui/ConversationFragment.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index d0a384b50..ae2e3f8c9 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -1427,7 +1427,12 @@ public class ConversationFragment extends XmppFragment case REQUEST_START_VIDEO_CALL: triggerRtpSession(RtpSessionActivity.ACTION_MAKE_VIDEO_CALL); break; - case ATTACHMENT_CHOICE_CHOOSE_IMAGE: + case ATTACHMENT_CHOICE_CHOOSE_IMAGE: { + final Uri takePhotoUri = pendingTakePhotoUri.pop(); + if (takePhotoUri != null && data.getData() == null && data.getClipData() == null) { + mediaPreviewAdapter.addMediaPreviews( + Attachment.of(getActivity(), takePhotoUri, Attachment.Type.IMAGE)); + } final List imageUris = Attachment.extractAttachments(getActivity(), data, Attachment.Type.IMAGE); if (imageUris.size() == 1) { @@ -1437,7 +1442,8 @@ public class ConversationFragment extends XmppFragment toggleInputMethod(); } break; - case ATTACHMENT_CHOICE_TAKE_PHOTO: + } + case ATTACHMENT_CHOICE_TAKE_PHOTO: { final Uri takePhotoUri = pendingTakePhotoUri.pop(); if (takePhotoUri != null) { editImage(takePhotoUri); @@ -1454,6 +1460,7 @@ public class ConversationFragment extends XmppFragment Log.d(Config.LOGTAG, "lost take photo uri. unable to to attach"); } break; + } case ATTACHMENT_CHOICE_CHOOSE_FILE: case ATTACHMENT_CHOICE_RECORD_VIDEO: case ATTACHMENT_CHOICE_RECORD_VOICE: