Added unjunk icon button

This commit is contained in:
M66B 2020-03-03 10:10:59 +01:00
parent 869570eb27
commit 6b9de34a7e
1 changed files with 11 additions and 2 deletions

View File

@ -2317,7 +2317,10 @@ 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:
onActionJunk(message); if (EntityFolder.JUNK.equals(message.folderType))
onActionUnjunk(message);
else
onActionJunk(message);
break; break;
case R.id.ibRemove: case R.id.ibRemove:
onActionRemove(message, false); onActionRemove(message, false);
@ -3098,15 +3101,17 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
boolean archive = (!message.folderReadOnly && message.uid != null && (hasArchive && !inArchive)); boolean archive = (!message.folderReadOnly && message.uid != null && (hasArchive && !inArchive));
boolean trash = ((!message.folderReadOnly && message.uid != null) || outbox || debug); boolean trash = ((!message.folderReadOnly && message.uid != null) || outbox || debug);
boolean junk = (!message.folderReadOnly && message.uid != null && (hasJunk && !inJunk)); boolean junk = (!message.folderReadOnly && message.uid != null && (hasJunk && !inJunk));
boolean unjunk = (!message.folderReadOnly && message.uid != null && inJunk);
final boolean delete = (inTrash || !hasTrash || outbox || message.uid == null); final boolean delete = (inTrash || !hasTrash || outbox || message.uid == null);
if (normal) { if (normal) {
ibTrash.setTag(delete); ibTrash.setTag(delete);
ibJunk.setImageResource(unjunk ? R.drawable.baseline_inbox_24 : R.drawable.baseline_flag_24);
ibArchive.setVisibility(archive ? View.VISIBLE : View.GONE); ibArchive.setVisibility(archive ? View.VISIBLE : View.GONE);
ibTrash.setVisibility(trash ? View.VISIBLE : View.GONE); ibTrash.setVisibility(trash ? View.VISIBLE : View.GONE);
ibJunk.setVisibility(junk ? View.VISIBLE : View.GONE); ibJunk.setVisibility(junk || unjunk ? View.VISIBLE : View.GONE);
} else { } else {
if (!hasArchive && !hasJunk) { if (!hasArchive && !hasJunk) {
if (delete) if (delete)
@ -3185,6 +3190,10 @@ 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) {
properties.move(message.id, EntityFolder.INBOX);
}
private void onActionMore(TupleMessageEx message) { private void onActionMore(TupleMessageEx message) {
boolean show_headers = properties.getValue("headers", message.id); boolean show_headers = properties.getValue("headers", message.id);
boolean full = properties.getValue("full", message.id); boolean full = properties.getValue("full", message.id);