mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-14 13:03:13 +02:00
Show if attachments in message list item
This commit is contained in:
@@ -32,6 +32,7 @@ import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -58,6 +59,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
View itemView;
|
||||
TextView tvFrom;
|
||||
TextView tvTime;
|
||||
ImageView ivAttachments;
|
||||
TextView tvSubject;
|
||||
TextView tvCount;
|
||||
|
||||
@@ -67,6 +69,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
this.itemView = itemView;
|
||||
tvFrom = itemView.findViewById(R.id.tvFrom);
|
||||
tvTime = itemView.findViewById(R.id.tvTime);
|
||||
ivAttachments = itemView.findViewById(R.id.ivAttachments);
|
||||
tvSubject = itemView.findViewById(R.id.tvSubject);
|
||||
tvCount = itemView.findViewById(R.id.tvCount);
|
||||
}
|
||||
@@ -238,6 +241,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
int visibility = (unseen ? Typeface.BOLD : Typeface.NORMAL);
|
||||
holder.tvFrom.setTypeface(null, visibility);
|
||||
holder.tvTime.setTypeface(null, visibility);
|
||||
holder.ivAttachments.setVisibility(message.attachments > 0 ? View.VISIBLE : View.GONE);
|
||||
holder.tvSubject.setTypeface(null, visibility);
|
||||
holder.tvCount.setTypeface(null, visibility);
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ public interface DaoMessage {
|
||||
@Query("SELECT message.*, folder.name as folderName, folder.type as folderType" +
|
||||
", (SELECT COUNT(m.id) FROM message m WHERE m.account = message.account AND m.thread = message.thread) AS count" +
|
||||
", (SELECT COUNT(m.id) FROM message m WHERE m.account = message.account AND m.thread = message.thread AND NOT m.ui_seen) AS unseen" +
|
||||
", (SELECT COUNT(a.id) FROM attachment a WHERE a.message = message.id) AS attachments" +
|
||||
" FROM folder" +
|
||||
" JOIN message ON folder = folder.id" +
|
||||
" WHERE folder.type = '" + EntityFolder.TYPE_INBOX + "'" +
|
||||
@@ -45,6 +46,7 @@ public interface DaoMessage {
|
||||
@Query("SELECT message.*, folder.name as folderName, folder.type as folderType" +
|
||||
", (SELECT COUNT(m.id) FROM message m WHERE m.account = message.account AND m.thread = message.thread) AS count" +
|
||||
", (SELECT COUNT(m.id) FROM message m WHERE m.account = message.account AND m.thread = message.thread AND NOT m.ui_seen) AS unseen" +
|
||||
", (SELECT COUNT(a.id) FROM attachment a WHERE a.message = message.id) AS attachments" +
|
||||
" FROM folder" +
|
||||
" JOIN message ON folder = folder.id" +
|
||||
" WHERE folder.id = :folder" +
|
||||
@@ -56,6 +58,7 @@ public interface DaoMessage {
|
||||
@Query("SELECT message.*, folder.name as folderName, folder.type as folderType" +
|
||||
", (SELECT COUNT(m.id) FROM message m WHERE m.account = message.account AND m.thread = message.thread) AS count" +
|
||||
", (SELECT COUNT(m.id) FROM message m WHERE m.account = message.account AND m.thread = message.thread AND NOT m.ui_seen) AS unseen" +
|
||||
", (SELECT COUNT(a.id) FROM attachment a WHERE a.message = message.id) AS attachments" +
|
||||
" FROM message" +
|
||||
" JOIN folder ON folder.id = message.folder" +
|
||||
" JOIN message m1 ON m1.id = :msgid AND m1.account = message.account AND m1.thread = message.thread" +
|
||||
@@ -71,6 +74,7 @@ public interface DaoMessage {
|
||||
@Query("SELECT message.*, folder.name as folderName, folder.type as folderType" +
|
||||
", (SELECT COUNT(m.id) FROM message m WHERE m.account = message.account AND m.thread = message.thread) AS count" +
|
||||
", (SELECT COUNT(m.id) FROM message m WHERE m.account = message.account AND m.thread = message.thread AND NOT m.ui_seen) AS unseen" +
|
||||
", (SELECT COUNT(a.id) FROM attachment a WHERE a.message = message.id) AS attachments" +
|
||||
" FROM message" +
|
||||
" JOIN folder ON folder.id = message.folder" +
|
||||
" WHERE message.id = :id")
|
||||
|
||||
@@ -24,6 +24,7 @@ public class TupleMessageEx extends EntityMessage {
|
||||
public String folderType;
|
||||
public int count;
|
||||
public int unseen;
|
||||
public int attachments;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
@@ -32,7 +33,8 @@ public class TupleMessageEx extends EntityMessage {
|
||||
return (super.equals(obj) &&
|
||||
this.folderType.equals(other.folderType) &&
|
||||
this.count == other.count &&
|
||||
this.unseen == other.unseen);
|
||||
this.unseen == other.unseen &&
|
||||
this.attachments == other.attachments);
|
||||
}
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user