Show single inbox / nav menu

This commit is contained in:
M66B 2022-05-04 10:00:26 +02:00
parent d92ddc4447
commit 975fdfe283
3 changed files with 10 additions and 1 deletions

View File

@ -93,7 +93,9 @@ public class AdapterNavUnified extends RecyclerView.Adapter<AdapterNavUnified.Vi
private void bindTo(TupleFolderUnified folder) {
if (EntityFolder.INBOX.equals(folder.type))
ivItem.setImageResource(R.drawable.twotone_all_inbox_24);
ivItem.setImageResource(folder.folders > 1
? R.drawable.twotone_all_inbox_24
: R.drawable.twotone_move_to_inbox_24);
else if (EntityFolder.OUTBOX.equals(folder.type)) {
if ("syncing".equals(folder.sync_state))
ivItem.setImageResource(R.drawable.twotone_compare_arrows_24);
@ -149,6 +151,10 @@ public class AdapterNavUnified extends RecyclerView.Adapter<AdapterNavUnified.Vi
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
if (EntityFolder.OUTBOX.equals(folder.type))
lbm.sendBroadcast(new Intent(ActivityView.ACTION_VIEW_OUTBOX));
else if (folder.folders > 1)
lbm.sendBroadcast(
new Intent(ActivityView.ACTION_VIEW_MESSAGES)
.putExtra("type", folder.type));
else {
Bundle args = new Bundle();
args.putString("type", folder.type);

View File

@ -178,6 +178,7 @@ public interface DaoFolder {
List<EntityFolder> getChildFolders(long parent);
@Query("SELECT folder.type" +
", COUNT(DISTINCT folder.id) AS folders" +
", COUNT(message.id) AS messages" +
", SUM(CASE WHEN NOT message.ui_seen THEN 1 ELSE 0 END) AS unseen" +
", CASE WHEN folder.account IS NULL THEN folder.sync_state ELSE NULL END AS sync_state" +

View File

@ -23,6 +23,7 @@ import java.util.Objects;
public class TupleFolderUnified {
public String type;
public int folders;
public int messages;
public int unseen;
public String sync_state;
@ -34,6 +35,7 @@ public class TupleFolderUnified {
if (obj instanceof TupleFolderUnified) {
TupleFolderUnified other = (TupleFolderUnified) obj;
return (Objects.equals(this.type, other.type) &&
this.folders == other.folders &&
this.messages == other.messages &&
this.unseen == other.unseen &&
Objects.equals(this.sync_state, other.sync_state) &&