added 'view conversation' to context menu
This commit is contained in:
parent
43b455974b
commit
5c4aacd39e
|
@ -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
|
||||
|
|
|
@ -30,6 +30,10 @@
|
|||
|
||||
<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"/>
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue