From 7d2a7d536d5030b7cd9e10b1fcd41692d05bc6b5 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 5 Aug 2020 21:31:54 +0200 Subject: [PATCH] fix attachments getting lost when switching to chat during call fixes #3854 --- .../eu/siacs/conversations/ui/ConversationFragment.java | 7 +++++-- .../eu/siacs/conversations/ui/ConversationsActivity.java | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index a8fecc6f7..c195fb13b 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -2034,9 +2034,12 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke toggleInputMethod(); } - public void reInit(Conversation conversation, Bundle extras) { + public void reInit(final Conversation conversation, final Bundle extras) { QuickLoader.set(conversation.getUuid()); - this.saveMessageDraftStopAudioPlayer(); + final boolean changedConversation = this.conversation != conversation; + if (changedConversation) { + this.saveMessageDraftStopAudioPlayer(); + } this.clearPending(); if (this.reInit(conversation, extras != null)) { if (extras != null) { diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java index 261907d5b..451f4d105 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java @@ -266,8 +266,8 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio } private boolean processViewIntent(Intent intent) { - String uuid = intent.getStringExtra(EXTRA_CONVERSATION); - Conversation conversation = uuid != null ? xmppConnectionService.findConversationByUuid(uuid) : null; + final String uuid = intent.getStringExtra(EXTRA_CONVERSATION); + final Conversation conversation = uuid != null ? xmppConnectionService.findConversationByUuid(uuid) : null; if (conversation == null) { Log.d(Config.LOGTAG, "unable to view conversation with uuid:" + uuid); return false;