Added reply menu to send new message

pull/162/head
M66B 5 years ago
parent fd8613a89a
commit 59088b96f4

@ -2292,6 +2292,11 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
if (amessage == null || !amessage.id.equals(message.id))
return;
final Address[] to =
message.replySelf(identities, message.account)
? message.to
: (message.reply == null || message.reply.length == 0 ? message.from : message.reply);
Address[] recipients = message.getAllRecipients(identities, message.account);
View anchor = bnvActions.findViewById(R.id.action_reply);
@ -2301,6 +2306,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
popupMenu.getMenu().findItem(R.id.menu_reply_list).setVisible(message.list_post != null);
popupMenu.getMenu().findItem(R.id.menu_reply_receipt).setVisible(message.receipt_to != null);
popupMenu.getMenu().findItem(R.id.menu_reply_answer).setVisible(answers != 0 || !ActivityBilling.isPro(context));
popupMenu.getMenu().findItem(R.id.menu_new_message).setVisible(to != null && to.length > 0);
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
@ -2323,6 +2329,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
return true;
case R.id.menu_forward:
onMenuReply(message, "forward");
return true;
case R.id.menu_new_message:
onMenuNew(message, to);
return true;
default:
return false;
}
@ -2345,6 +2355,13 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
context.startActivity(reply);
}
private void onMenuNew(TupleMessageEx message, Address[] to) {
Intent reply = new Intent(context, ActivityCompose.class)
.putExtra("action", "new")
.putExtra("to", MessageHelper.formatAddresses(to, true, true));
context.startActivity(reply);
}
private void onMenuAnswer(TupleMessageEx message) {
new SimpleTask<List<EntityAnswer>>() {
@Override

@ -23,4 +23,8 @@
<item
android:id="@+id/menu_forward"
android:title="@string/title_forward" />
<item
android:id="@+id/menu_new_message"
android:title="@string/title_new_message" />
</menu>

@ -503,6 +503,7 @@
<string name="title_flag_color">Colored star &#8230;</string>
<string name="title_unflag">Remove star</string>
<string name="title_forward">Forward</string>
<string name="title_new_message">New message</string>
<string name="title_editasnew">Edit as new</string>
<string name="title_create_rule">Create rule &#8230;</string>
<string name="title_share">Share</string>

Loading…
Cancel
Save