Change forward menu into message action

pull/161/head
M66B 5 years ago
parent 2e754c2174
commit 424af55de0

@ -297,6 +297,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private ImageButton ibDecrypt;
private ImageButton ibReply;
private ImageButton ibForward;
private ImageButton ibArchive;
private ImageButton ibMove;
private ImageButton ibDelete;
@ -437,6 +438,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibDecrypt = vsBody.findViewById(R.id.ibDecrypt);
ibReply = vsBody.findViewById(R.id.ibReply);
ibForward = vsBody.findViewById(R.id.ibForward);
ibArchive = vsBody.findViewById(R.id.ibArchive);
ibMove = vsBody.findViewById(R.id.ibMove);
ibDelete = vsBody.findViewById(R.id.ibDelete);
@ -508,6 +510,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibDecrypt.setOnClickListener(this);
ibReply.setOnClickListener(this);
ibForward.setOnClickListener(this);
ibArchive.setOnClickListener(this);
ibMove.setOnClickListener(this);
ibDelete.setOnClickListener(this);
@ -543,6 +546,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibDecrypt.setOnClickListener(null);
ibReply.setOnClickListener(null);
ibForward.setOnClickListener(null);
ibArchive.setOnClickListener(null);
ibMove.setOnClickListener(null);
ibDelete.setOnClickListener(null);
@ -892,6 +896,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibDecrypt.setVisibility(View.GONE);
ibReply.setVisibility(View.GONE);
ibForward.setVisibility(View.GONE);
ibArchive.setVisibility(View.GONE);
ibMove.setVisibility(View.GONE);
ibDelete.setVisibility(View.GONE);
@ -964,6 +969,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibImages.setVisibility(View.GONE);
ibReply.setVisibility(View.GONE);
ibForward.setVisibility(View.GONE);
ibArchive.setVisibility(View.GONE);
ibMove.setVisibility(View.GONE);
ibDelete.setVisibility(View.GONE);
@ -1125,6 +1131,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibReply.setEnabled(message.content);
ibReply.setVisibility(!inOutbox ? View.VISIBLE : View.GONE);
ibForward.setEnabled(message.content);
ibForward.setVisibility(!inOutbox ? View.VISIBLE : View.GONE);
if (!message.folderReadOnly) {
ibArchive.setVisibility(
message.uid != null && (inJunk || (!inArchive && hasArchive))
@ -1479,6 +1488,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
case R.id.ibReply:
onActionReplyMenu(message);
break;
case R.id.ibForward:
onActionForward(message);
break;
case R.id.ibArchive:
if (EntityFolder.JUNK.equals(message.folderType))
onActionMoveJunk(message);
@ -2150,6 +2162,13 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
}.execute(context, owner, new Bundle(), "message:answer");
}
private void onActionForward(final TupleMessageEx message) {
Intent forward = new Intent(context, ActivityCompose.class)
.putExtra("action", "forward")
.putExtra("reference", message.id);
context.startActivity(forward);
}
private void onActionArchive(TupleMessageEx message) {
properties.move(message.id, EntityFolder.ARCHIVE);
}
@ -2257,7 +2276,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
PopupMenuLifecycle popupMenu = new PopupMenuLifecycle(context, powner, ibMore);
popupMenu.inflate(R.menu.menu_message);
popupMenu.getMenu().findItem(R.id.menu_forward).setEnabled(message.content);
popupMenu.getMenu().findItem(R.id.menu_editasnew).setEnabled(message.content);
popupMenu.getMenu().findItem(R.id.menu_unseen).setEnabled(message.uid != null && !message.folderReadOnly);
@ -2292,9 +2310,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override
public boolean onMenuItemClick(MenuItem target) {
switch (target.getItemId()) {
case R.id.menu_forward:
onMenuForward(message);
return true;
case R.id.menu_editasnew:
onMenuEditAsNew(message);
return true;
@ -2593,13 +2608,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
fragment.show(parentFragment.getFragmentManager(), "view:image");
}
private void onMenuForward(final TupleMessageEx message) {
Intent forward = new Intent(context, ActivityCompose.class)
.putExtra("action", "forward")
.putExtra("reference", message.id);
context.startActivity(forward);
}
private void onMenuEditAsNew(final TupleMessageEx message) {
Intent asnew = new Intent(context, ActivityCompose.class)
.putExtra("action", "editasnew")

@ -189,6 +189,22 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/ibMove" />
<ImageButton
android:id="@+id/ibForward"
android:layout_width="36dp"
android:layout_height="48dp"
android:background="?attr/colorSeparator"
android:contentDescription="@string/title_forward"
android:paddingStart="6dp"
android:paddingTop="12dp"
android:paddingEnd="6dp"
android:paddingBottom="12dp"
android:src="@drawable/baseline_forward_24"
android:tint="@color/bottomnav_foreground"
android:tooltipText="@string/title_forward"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ibArchive" />
<ImageButton
android:id="@+id/ibReply"
android:layout_width="36dp"
@ -203,7 +219,7 @@
android:tint="@color/bottomnav_foreground"
android:tooltipText="@string/title_reply"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ibArchive" />
app:layout_constraintTop_toBottomOf="@+id/ibForward" />
<include
android:id="@+id/InCalendar"

@ -1,9 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/menu_forward"
android:title="@string/title_forward" />
<item
android:id="@+id/menu_editasnew"
android:title="@string/title_editasnew" />

Loading…
Cancel
Save