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);
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));

View File

@ -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<EntityMessage> getMessageByThread(long account, String thread, Long id, Long folder);

View File

@ -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};
}