added 'view conversation' to context menu

This commit is contained in:
Daniel Gultsch 2018-04-29 14:07:58 +02:00
parent 43b455974b
commit 5c4aacd39e
3 changed files with 16 additions and 4 deletions

View file

@ -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

View file

@ -28,7 +28,11 @@
~ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<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"

View file

@ -705,4 +705,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>