Allow direct moving from archive to inbox

pull/178/head
M66B 5 years ago
parent 147300cd55
commit 3b31476f99

@ -400,6 +400,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private ImageButton ibArchive; private ImageButton ibArchive;
private ImageButton ibTrash; private ImageButton ibTrash;
private ImageButton ibJunk; private ImageButton ibJunk;
private ImageButton ibInbox;
private ImageButton ibMore; private ImageButton ibMore;
private TextView tvSignedData; private TextView tvSignedData;
@ -595,6 +596,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibArchive = vsBody.findViewById(R.id.ibArchive); ibArchive = vsBody.findViewById(R.id.ibArchive);
ibTrash = vsBody.findViewById(R.id.ibTrash); ibTrash = vsBody.findViewById(R.id.ibTrash);
ibJunk = vsBody.findViewById(R.id.ibJunk); ibJunk = vsBody.findViewById(R.id.ibJunk);
ibInbox = vsBody.findViewById(R.id.ibInbox);
ibMore = vsBody.findViewById(R.id.ibMore); ibMore = vsBody.findViewById(R.id.ibMore);
tvSignedData = vsBody.findViewById(R.id.tvSignedData); tvSignedData = vsBody.findViewById(R.id.tvSignedData);
@ -682,6 +684,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibArchive.setOnClickListener(this); ibArchive.setOnClickListener(this);
ibTrash.setOnClickListener(this); ibTrash.setOnClickListener(this);
ibJunk.setOnClickListener(this); ibJunk.setOnClickListener(this);
ibInbox.setOnClickListener(this);
ibMore.setOnClickListener(this); ibMore.setOnClickListener(this);
ibDownloading.setOnClickListener(this); ibDownloading.setOnClickListener(this);
@ -757,6 +760,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibArchive.setOnClickListener(null); ibArchive.setOnClickListener(null);
ibTrash.setOnClickListener(null); ibTrash.setOnClickListener(null);
ibJunk.setOnClickListener(null); ibJunk.setOnClickListener(null);
ibInbox.setOnClickListener(null);
ibMore.setOnClickListener(null); ibMore.setOnClickListener(null);
ibDownloading.setOnClickListener(null); ibDownloading.setOnClickListener(null);
@ -1198,6 +1202,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibArchive.setVisibility(View.GONE); ibArchive.setVisibility(View.GONE);
ibTrash.setVisibility(View.GONE); ibTrash.setVisibility(View.GONE);
ibJunk.setVisibility(View.GONE); ibJunk.setVisibility(View.GONE);
ibInbox.setVisibility(View.GONE);
ibMore.setVisibility(View.GONE); ibMore.setVisibility(View.GONE);
tvSignedData.setVisibility(View.GONE); tvSignedData.setVisibility(View.GONE);
@ -1483,6 +1488,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibArchive.setVisibility(View.GONE); ibArchive.setVisibility(View.GONE);
ibTrash.setVisibility(View.GONE); ibTrash.setVisibility(View.GONE);
ibJunk.setVisibility(View.GONE); ibJunk.setVisibility(View.GONE);
ibInbox.setVisibility(View.GONE);
ibMore.setVisibility(EntityFolder.OUTBOX.equals(message.folderType) ? View.GONE : View.VISIBLE); ibMore.setVisibility(EntityFolder.OUTBOX.equals(message.folderType) ? View.GONE : View.VISIBLE);
tvSignedData.setVisibility(View.GONE); tvSignedData.setVisibility(View.GONE);
@ -1581,7 +1587,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
boolean trash = (move || outbox || debug || boolean trash = (move || outbox || debug ||
message.accountProtocol == EntityAccount.TYPE_POP); message.accountProtocol == EntityAccount.TYPE_POP);
boolean junk = (move && (hasJunk && !inJunk)); boolean junk = (move && (hasJunk && !inJunk));
boolean unjunk = (move && inJunk); boolean inbox = (move && (inArchive || inJunk));
final boolean delete = (inTrash || !hasTrash || inJunk || outbox || final boolean delete = (inTrash || !hasTrash || inJunk || outbox ||
message.uid == null || message.accountProtocol == EntityAccount.TYPE_POP); message.uid == null || message.accountProtocol == EntityAccount.TYPE_POP);
@ -1593,18 +1599,14 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
boolean expand_one = prefs.getBoolean("expand_one", true); boolean expand_one = prefs.getBoolean("expand_one", true);
ibTrash.setTag(delete); ibTrash.setTag(delete);
ibJunk.setImageResource(unjunk ? R.drawable.baseline_inbox_24 : R.drawable.baseline_flag_24);
String title = context.getString(unjunk ? R.string.title_no_junk : R.string.title_spam);
ibJunk.setContentDescription(title);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
ibJunk.setTooltipText(title);
ibUnsubscribe.setVisibility(message.unsubscribe == null ? View.GONE : View.VISIBLE); ibUnsubscribe.setVisibility(message.unsubscribe == null ? View.GONE : View.VISIBLE);
ibAnswer.setVisibility(outbox || (!expand_all && expand_one) ? View.GONE : View.VISIBLE); ibAnswer.setVisibility(outbox || (!expand_all && expand_one) ? View.GONE : View.VISIBLE);
ibMove.setVisibility(move && button_move ? View.VISIBLE : View.GONE); ibMove.setVisibility(move && button_move ? View.VISIBLE : View.GONE);
ibArchive.setVisibility(archive && button_archive_trash ? View.VISIBLE : View.GONE); ibArchive.setVisibility(archive && button_archive_trash ? View.VISIBLE : View.GONE);
ibTrash.setVisibility(trash && button_archive_trash ? View.VISIBLE : View.GONE); ibTrash.setVisibility(trash && button_archive_trash ? View.VISIBLE : View.GONE);
ibJunk.setVisibility(junk || unjunk ? View.VISIBLE : View.GONE); ibJunk.setVisibility(junk ? View.VISIBLE : View.GONE);
ibInbox.setVisibility(inbox ? View.VISIBLE : View.GONE);
ibTrashBottom.setVisibility(trash && button_archive_trash ? View.VISIBLE : View.GONE); ibTrashBottom.setVisibility(trash && button_archive_trash ? View.VISIBLE : View.GONE);
ibArchiveBottom.setVisibility(archive && button_archive_trash ? View.VISIBLE : View.GONE); ibArchiveBottom.setVisibility(archive && button_archive_trash ? View.VISIBLE : View.GONE);
@ -2662,11 +2664,11 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
onActionTrash(message, (Boolean) ibTrash.getTag()); onActionTrash(message, (Boolean) ibTrash.getTag());
break; break;
case R.id.ibJunk: case R.id.ibJunk:
if (EntityFolder.JUNK.equals(message.folderType))
onActionUnjunk(message);
else
onActionJunk(message); onActionJunk(message);
break; break;
case R.id.ibInbox:
onActionInbox(message);
break;
case R.id.ibMore: case R.id.ibMore:
onActionMore(message); onActionMore(message);
break; break;
@ -3537,7 +3539,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ask.show(parentFragment.getParentFragmentManager(), "message:junk"); ask.show(parentFragment.getParentFragmentManager(), "message:junk");
} }
private void onActionUnjunk(TupleMessageEx message) { private void onActionInbox(TupleMessageEx message) {
properties.move(message.id, EntityFolder.INBOX); properties.move(message.id, EntityFolder.INBOX);
} }

@ -27,7 +27,7 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="3dp" android:layout_marginEnd="3dp"
app:constraint_referenced_ids="ibMore,ibJunk,ibTrash,ibArchive,ibMove,ibAnswer,ibUnsubscribe,ibUndo" app:constraint_referenced_ids="ibMore,ibInbox,ibJunk,ibTrash,ibArchive,ibMove,ibAnswer,ibUnsubscribe,ibUndo"
app:flow_horizontalBias="0" app:flow_horizontalBias="0"
app:flow_horizontalGap="3dp" app:flow_horizontalGap="3dp"
app:flow_horizontalStyle="packed" app:flow_horizontalStyle="packed"
@ -60,6 +60,18 @@
app:srcCompat="@drawable/baseline_flag_24" app:srcCompat="@drawable/baseline_flag_24"
tools:ignore="MissingConstraints" /> tools:ignore="MissingConstraints" />
<ImageButton
android:id="@+id/ibInbox"
android:layout_width="36dp"
android:layout_height="36dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_folder_inbox"
android:padding="6dp"
android:scaleType="fitCenter"
android:tooltipText="@string/title_folder_inbox"
app:srcCompat="@drawable/baseline_inbox_24"
tools:ignore="MissingConstraints" />
<ImageButton <ImageButton
android:id="@+id/ibTrash" android:id="@+id/ibTrash"
android:layout_width="36dp" android:layout_width="36dp"

Loading…
Cancel
Save