diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-05-02 21:23:02 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-05-02 21:23:02 +0200 |
commit | 78b8918524aa065165c0c382440a287c40338348 (patch) | |
tree | 864cbbd2134dcb3c11a3dc2c286e886cb1728273 | |
parent | 13ac701df5221e8c6cc1e0af532f96a17fdd6879 (diff) |
added 'view conversation' to context menu
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/SearchActivity.java | 13 | ||||
-rw-r--r-- | src/main/res/menu/search_result_context.xml | 3 | ||||
-rw-r--r-- | src/main/res/values/strings.xml | 1 |
3 files changed, 14 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/SearchActivity.java b/src/main/java/de/pixart/messenger/ui/SearchActivity.java index 7c43bf37c..298bca6c0 100644 --- a/src/main/java/de/pixart/messenger/ui/SearchActivity.java +++ b/src/main/java/de/pixart/messenger/ui/SearchActivity.java @@ -129,6 +129,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; @@ -140,6 +143,7 @@ public class SearchActivity extends XmppActivity implements TextWatcher, OnSearc break; case R.id.quote_message: quote(message); + break; } } return super.onContextItemSelected(item); @@ -148,17 +152,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 9d68233d4..cea8e6cf7 100644 --- a/src/main/res/menu/search_result_context.xml +++ b/src/main/res/menu/search_result_context.xml @@ -30,6 +30,9 @@ <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item + android:id="@+id/open_conversation" + android:title="@string/view_conversation" /> + <item android:id="@+id/share_with" android:title="@string/share_with" /> <item diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index e8edc5d50..281374208 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -783,4 +783,5 @@ <string name="no_microphone_permission">Conversations needs access to the microphone</string> <string name="search_messages">Search messages</string> <string name="gif">GIF</string> + <string name="view_conversation">View conversation</string> </resources> |