From 06dc4474497cd5c72886134254b08a15a893c144 Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 29 Dec 2018 10:53:16 +0000 Subject: [PATCH] Small fixes --- .../eu/faircode/email/AdapterMessage.java | 2 +- .../java/eu/faircode/email/DaoMessage.java | 1 + .../eu/faircode/email/FragmentMessages.java | 31 ++++++++++--------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/AdapterMessage.java b/app/src/main/java/eu/faircode/email/AdapterMessage.java index 4277f311d3..00beaf7b1b 100644 --- a/app/src/main/java/eu/faircode/email/AdapterMessage.java +++ b/app/src/main/java/eu/faircode/email/AdapterMessage.java @@ -419,7 +419,7 @@ public class AdapterMessage extends RecyclerView.Adapter 0); ivFlagged.setImageResource(flagged ? R.drawable.baseline_star_24 : R.drawable.baseline_star_border_24); ivFlagged.setImageTintList(ColorStateList.valueOf(flagged ? colorAccent : textColorSecondary)); - ivFlagged.setVisibility(message.uid == null ? View.GONE : View.VISIBLE); + ivFlagged.setVisibility(message.uid == null ? View.INVISIBLE : View.VISIBLE); tvFrom.setText(MessageHelper.getFormattedAddresses(outgoing ? message.to : message.from, false)); tvSize.setText(message.size == null ? null : Helper.humanReadableByteCount(message.size, true)); diff --git a/app/src/main/java/eu/faircode/email/DaoMessage.java b/app/src/main/java/eu/faircode/email/DaoMessage.java index efd4403b9c..5ec83ba0a8 100644 --- a/app/src/main/java/eu/faircode/email/DaoMessage.java +++ b/app/src/main/java/eu/faircode/email/DaoMessage.java @@ -170,6 +170,7 @@ public interface DaoMessage { " AND thread = :thread" + " AND (:id IS NULL OR message.id = :id)" + " AND (:folder IS NULL OR message.folder = :folder)" + + " AND NOT uid IS NULL" + " AND NOT ui_hide") List getMessageByThread(long account, String thread, Long id, Long folder); diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index 7c12f38b00..9cd6792347 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -465,7 +465,7 @@ public class FragmentMessages extends FragmentEx { return 0; TupleMessageEx message = ((AdapterMessage) rvMessage.getAdapter()).getCurrentList().get(pos); - if (message == null || + if (message == null || message.uid == null || (values.containsKey("expanded") && values.get("expanded").contains(message.id)) || EntityFolder.DRAFTS.equals(message.folderType) || EntityFolder.OUTBOX.equals(message.folderType)) @@ -1826,20 +1826,21 @@ public class FragmentMessages extends FragmentEx { boolean trashable = false; boolean archivable = false; - for (EntityMessage message : messages) { - EntityFolder folder = db.folder().getFolder(message.folder); - if (!EntityFolder.DRAFTS.equals(folder.type) && - !EntityFolder.OUTBOX.equals(folder.type) && - // allow sent - !EntityFolder.TRASH.equals(folder.type) && - !EntityFolder.JUNK.equals(folder.type)) - trashable = true; - if (!EntityFolder.isOutgoing(folder.type) && - !EntityFolder.TRASH.equals(folder.type) && - !EntityFolder.JUNK.equals(folder.type) && - !EntityFolder.ARCHIVE.equals(folder.type)) - archivable = true; - } + for (EntityMessage message : messages) + if (message.uid != null) { + EntityFolder folder = db.folder().getFolder(message.folder); + if (!EntityFolder.DRAFTS.equals(folder.type) && + !EntityFolder.OUTBOX.equals(folder.type) && + // allow sent + !EntityFolder.TRASH.equals(folder.type) && + !EntityFolder.JUNK.equals(folder.type)) + trashable = true; + if (!EntityFolder.isOutgoing(folder.type) && + !EntityFolder.TRASH.equals(folder.type) && + !EntityFolder.JUNK.equals(folder.type) && + !EntityFolder.ARCHIVE.equals(folder.type)) + archivable = true; + } return new Boolean[]{trashable, archivable}; }