Small fixes

This commit is contained in:
M66B 2018-12-29 10:53:16 +00:00
parent 8c8e3cecdb
commit 06dc447449
3 changed files with 18 additions and 16 deletions

View File

@ -419,7 +419,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
flagged = (message.count - message.unflagged > 0); flagged = (message.count - message.unflagged > 0);
ivFlagged.setImageResource(flagged ? R.drawable.baseline_star_24 : R.drawable.baseline_star_border_24); ivFlagged.setImageResource(flagged ? R.drawable.baseline_star_24 : R.drawable.baseline_star_border_24);
ivFlagged.setImageTintList(ColorStateList.valueOf(flagged ? colorAccent : textColorSecondary)); 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)); tvFrom.setText(MessageHelper.getFormattedAddresses(outgoing ? message.to : message.from, false));
tvSize.setText(message.size == null ? null : Helper.humanReadableByteCount(message.size, true)); tvSize.setText(message.size == null ? null : Helper.humanReadableByteCount(message.size, true));

View File

@ -170,6 +170,7 @@ public interface DaoMessage {
" AND thread = :thread" + " AND thread = :thread" +
" AND (:id IS NULL OR message.id = :id)" + " AND (:id IS NULL OR message.id = :id)" +
" AND (:folder IS NULL OR message.folder = :folder)" + " AND (:folder IS NULL OR message.folder = :folder)" +
" AND NOT uid IS NULL" +
" AND NOT ui_hide") " AND NOT ui_hide")
List<EntityMessage> getMessageByThread(long account, String thread, Long id, Long folder); List<EntityMessage> getMessageByThread(long account, String thread, Long id, Long folder);

View File

@ -465,7 +465,7 @@ public class FragmentMessages extends FragmentEx {
return 0; return 0;
TupleMessageEx message = ((AdapterMessage) rvMessage.getAdapter()).getCurrentList().get(pos); 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)) || (values.containsKey("expanded") && values.get("expanded").contains(message.id)) ||
EntityFolder.DRAFTS.equals(message.folderType) || EntityFolder.DRAFTS.equals(message.folderType) ||
EntityFolder.OUTBOX.equals(message.folderType)) EntityFolder.OUTBOX.equals(message.folderType))
@ -1826,20 +1826,21 @@ public class FragmentMessages extends FragmentEx {
boolean trashable = false; boolean trashable = false;
boolean archivable = false; boolean archivable = false;
for (EntityMessage message : messages) { for (EntityMessage message : messages)
EntityFolder folder = db.folder().getFolder(message.folder); if (message.uid != null) {
if (!EntityFolder.DRAFTS.equals(folder.type) && EntityFolder folder = db.folder().getFolder(message.folder);
!EntityFolder.OUTBOX.equals(folder.type) && if (!EntityFolder.DRAFTS.equals(folder.type) &&
// allow sent !EntityFolder.OUTBOX.equals(folder.type) &&
!EntityFolder.TRASH.equals(folder.type) && // allow sent
!EntityFolder.JUNK.equals(folder.type)) !EntityFolder.TRASH.equals(folder.type) &&
trashable = true; !EntityFolder.JUNK.equals(folder.type))
if (!EntityFolder.isOutgoing(folder.type) && trashable = true;
!EntityFolder.TRASH.equals(folder.type) && if (!EntityFolder.isOutgoing(folder.type) &&
!EntityFolder.JUNK.equals(folder.type) && !EntityFolder.TRASH.equals(folder.type) &&
!EntityFolder.ARCHIVE.equals(folder.type)) !EntityFolder.JUNK.equals(folder.type) &&
archivable = true; !EntityFolder.ARCHIVE.equals(folder.type))
} archivable = true;
}
return new Boolean[]{trashable, archivable}; return new Boolean[]{trashable, archivable};
} }