diff --git a/app/src/main/java/eu/faircode/email/DaoMessage.java b/app/src/main/java/eu/faircode/email/DaoMessage.java
index a98644d8c0..f6689f9d8c 100644
--- a/app/src/main/java/eu/faircode/email/DaoMessage.java
+++ b/app/src/main/java/eu/faircode/email/DaoMessage.java
@@ -76,6 +76,7 @@ public interface DaoMessage {
" WHEN 'sender' = :sort THEN LOWER(message.sender)" +
" WHEN 'subject' = :sort THEN LOWER(message.subject)" +
" WHEN 'size' = :sort THEN -SUM(message.size)" +
+ " WHEN 'snoozed' = :sort THEN SUM(CASE WHEN message.ui_snoozed IS NULL THEN 0 ELSE 1 END) = 0" +
" ELSE 0" +
" END, message.received DESC")
@SuppressWarnings(RoomWarnings.CURSOR_MISMATCH)
@@ -122,6 +123,7 @@ public interface DaoMessage {
" WHEN 'sender' = :sort THEN LOWER(message.sender)" +
" WHEN 'subject' = :sort THEN LOWER(message.subject)" +
" WHEN 'size' = :sort THEN -SUM(message.size)" +
+ " WHEN 'snoozed' = :sort THEN SUM(CASE WHEN message.ui_snoozed IS NULL THEN 0 ELSE 1 END) = 0" +
" ELSE 0" +
" END, message.received DESC")
@SuppressWarnings(RoomWarnings.CURSOR_MISMATCH)
diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java
index f28d91a20e..6b6531e926 100644
--- a/app/src/main/java/eu/faircode/email/FragmentMessages.java
+++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java
@@ -2097,6 +2097,8 @@ public class FragmentMessages extends FragmentBase {
menu.findItem(R.id.menu_sort_on_subject).setChecked(true);
else if ("size".equals(sort))
menu.findItem(R.id.menu_sort_on_size).setChecked(true);
+ else if ("snoozed".equals(sort))
+ menu.findItem(R.id.menu_sort_on_snoozed).setChecked(true);
menu.findItem(R.id.menu_filter).setVisible(viewType != AdapterMessage.ViewType.SEARCH && !outbox);
menu.findItem(R.id.menu_filter_seen).setVisible(viewType != AdapterMessage.ViewType.THREAD);
@@ -2152,6 +2154,11 @@ public class FragmentMessages extends FragmentBase {
onMenuSort("size");
return true;
+ case R.id.menu_sort_on_snoozed:
+ item.setChecked(true);
+ onMenuSort("snoozed");
+ return true;
+
case R.id.menu_filter_seen:
onMenuFilterRead(!item.isChecked());
return true;
diff --git a/app/src/main/res/menu/menu_messages.xml b/app/src/main/res/menu/menu_messages.xml
index b94c549e14..cb5b9b84ee 100644
--- a/app/src/main/res/menu/menu_messages.xml
+++ b/app/src/main/res/menu/menu_messages.xml
@@ -40,6 +40,9 @@
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 8e140a63c5..f401467a70 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -493,6 +493,7 @@
Sender
Subject
Size
+ Snoozed
Filter
Read