From 5c4aacd39eef07e28c7d561a9f8be5d4bbc51b9b Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 29 Apr 2018 14:07:58 +0200 Subject: [PATCH] added 'view conversation' to context menu --- .../eu/siacs/conversations/ui/SearchActivity.java | 13 ++++++++++--- src/main/res/menu/search_result_context.xml | 6 +++++- src/main/res/values/strings.xml | 1 + 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/SearchActivity.java b/src/main/java/eu/siacs/conversations/ui/SearchActivity.java index 1d5079700..784394deb 100644 --- a/src/main/java/eu/siacs/conversations/ui/SearchActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/SearchActivity.java @@ -132,6 +132,9 @@ public class SearchActivity extends XmppActivity implements TextWatcher, OnSearc final Message message = selectedMessageReference.get(); if (message != null) { switch (item.getItemId()) { + case R.id.open_conversation: + switchToConversation(wrap(message.getConversation())); + break; case R.id.share_with: ShareUtil.share(this, message); break; @@ -143,6 +146,7 @@ public class SearchActivity extends XmppActivity implements TextWatcher, OnSearc break; case R.id.quote_message: quote(message); + break; } } return super.onContextItemSelected(item); @@ -151,17 +155,20 @@ public class SearchActivity extends XmppActivity implements TextWatcher, OnSearc private void quote(Message message) { String text = MessageUtils.prepareQuote(message); final Conversational conversational = message.getConversation(); + switchToConversationAndQuote(wrap(message.getConversation()), text); + } + + private Conversation wrap(Conversational conversational) { final Conversation conversation; if (conversational instanceof Conversation) { - conversation = (Conversation) conversational; + return (Conversation) conversational; } else { - conversation = xmppConnectionService.findOrCreateConversation(conversational.getAccount(), + return xmppConnectionService.findOrCreateConversation(conversational.getAccount(), conversational.getJid(), conversational.getMode() == Conversational.MODE_MULTI, true, true); } - switchToConversationAndQuote(conversation, text); } @Override diff --git a/src/main/res/menu/search_result_context.xml b/src/main/res/menu/search_result_context.xml index ea32659f6..8abb22dac 100644 --- a/src/main/res/menu/search_result_context.xml +++ b/src/main/res/menu/search_result_context.xml @@ -28,7 +28,11 @@ ~ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --> - + + + Conversations needs access to the microphone Search messages GIF + View conversation