Delete forever icon

This commit is contained in:
M66B 2022-03-26 07:43:55 +01:00
parent f2018bbf60
commit e2c5f75424
2 changed files with 11 additions and 8 deletions

View File

@ -2066,8 +2066,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
int froms = (message.from == null ? 0 : message.from.length);
int tos = (message.to == null ? 0 : message.to.length);
boolean delete = (inTrash || !hasTrash || inJunk || outbox ||
message.uid == null || pop);
boolean delete = (inTrash || !hasTrash || inJunk || outbox || message.uid == null || pop);
boolean forever = (delete && (!pop || !message.accountLeaveDeleted));
boolean headers = (message.uid != null || (pop && message.headers != null));
@ -2110,9 +2110,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibHide.setImageResource(message.ui_snoozed == null ? R.drawable.twotone_visibility_off_24 : R.drawable.twotone_visibility_24);
ibSeen.setImageResource(message.ui_seen ? R.drawable.twotone_mail_24 : R.drawable.twotone_drafts_24);
ibTrash.setTag(delete);
ibTrash.setImageResource(delete ? R.drawable.twotone_delete_forever_24 : R.drawable.twotone_delete_24);
ibTrash.setImageResource(forever ? R.drawable.twotone_delete_forever_24 : R.drawable.twotone_delete_24);
ibTrash.setImageTintList(ColorStateList.valueOf(outbox ? colorWarning : colorControlNormal));
ibTrashBottom.setImageResource(delete ? R.drawable.twotone_delete_forever_24 : R.drawable.twotone_delete_24);
ibTrashBottom.setImageResource(forever ? R.drawable.twotone_delete_forever_24 : R.drawable.twotone_delete_24);
ibInbox.setImageResource(inJunk ? R.drawable.twotone_report_off_24 : R.drawable.twotone_inbox_24);
ibUndo.setVisibility(outbox ? View.VISIBLE : View.GONE);

View File

@ -6060,9 +6060,11 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
if (junkOnly == null)
junkOnly = false;
boolean pop = (account != null && account.protocol == EntityAccount.TYPE_POP);
ActionData data = new ActionData();
data.delete = (trash == null || junkOnly ||
(account != null && account.protocol == EntityAccount.TYPE_POP));
data.delete = (trash == null || junkOnly || pop);
data.forever = (data.delete && (!pop || !account.leave_deleted));
data.trashable = trashable || junkOnly;
data.snoozable = snoozable;
data.archivable = (archivable && archive != null);
@ -6085,7 +6087,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
bottom_navigation.setTag(data);
bottom_navigation.getMenu().findItem(R.id.action_delete).setIcon(
data.delete ? R.drawable.twotone_delete_forever_24 : R.drawable.twotone_delete_24);
data.forever ? R.drawable.twotone_delete_forever_24 : R.drawable.twotone_delete_24);
bottom_navigation.getMenu().findItem(R.id.action_delete).setVisible(data.trashable);
bottom_navigation.getMenu().findItem(R.id.action_snooze).setVisible(data.snoozable);
bottom_navigation.getMenu().findItem(R.id.action_archive).setVisible(data.archivable);
@ -9181,7 +9183,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
}
private static class ActionData {
private boolean delete;
private boolean delete; // Selects action
private boolean forever; // Selects icon
private boolean trashable;
private boolean snoozable;
private boolean archivable;