Added sort on subject

pull/152/head
M66B 6 years ago
parent ef2d3940a6
commit bebc100c6d

@ -68,12 +68,13 @@ public interface DaoMessage {
" GROUP BY account.id, CASE WHEN message.thread IS NULL OR NOT :threading THEN message.id ELSE message.thread END" +
" HAVING :found OR SUM(unified) > 0" +
" ORDER BY" +
" CASE WHEN 'sender' = :sort THEN message.sender ELSE '' END," +
" CASE" +
" WHEN 'unread' = :sort THEN " + unseen_unified + " > 0" +
" WHEN 'starred' = :sort THEN COUNT(message.id) - " + unflagged_unified + " > 0" +
" WHEN 'unread' = :sort THEN " + unseen_unified + " = 0" +
" WHEN 'starred' = :sort THEN COUNT(message.id) - " + unflagged_unified + " = 0" +
" WHEN 'sender' = :sort THEN LOWER(message.sender)" +
" WHEN 'subject' = :sort THEN LOWER(message.subject)" +
" ELSE 0" +
" END DESC, message.received DESC")
" END, message.received DESC")
@SuppressWarnings(RoomWarnings.CURSOR_MISMATCH)
DataSource.Factory<Integer, TupleMessageEx> pagedUnifiedInbox(boolean threading, String sort, boolean snoozed, boolean found, boolean debug);
@ -109,12 +110,13 @@ public interface DaoMessage {
" GROUP BY CASE WHEN message.thread IS NULL OR NOT :threading THEN message.id ELSE message.thread END" +
" HAVING SUM(CASE WHEN folder.id = :folder THEN 1 ELSE 0 END) > 0" +
" ORDER BY" +
" CASE WHEN 'sender' = :sort THEN message.sender ELSE '' END," +
" CASE" +
" WHEN 'unread' = :sort THEN " + unseen_folder + " > 0" +
" WHEN 'starred' = :sort THEN COUNT(message.id) - " + unflagged_folder + " > 0" +
" WHEN 'unread' = :sort THEN " + unseen_folder + " = 0" +
" WHEN 'starred' = :sort THEN COUNT(message.id) - " + unflagged_folder + " = 0" +
" WHEN 'sender' = :sort THEN LOWER(message.sender)" +
" WHEN 'subject' = :sort THEN LOWER(message.subject)" +
" ELSE 0" +
" END DESC, message.received DESC")
" END, message.received DESC")
@SuppressWarnings(RoomWarnings.CURSOR_MISMATCH)
DataSource.Factory<Integer, TupleMessageEx> pagedFolder(long folder, boolean threading, String sort, boolean snoozed, boolean found, boolean debug);

@ -1746,6 +1746,8 @@ public class FragmentMessages extends FragmentBase {
menu.findItem(R.id.menu_sort_on_starred).setChecked(true);
else if ("sender".equals(sort))
menu.findItem(R.id.menu_sort_on_sender).setChecked(true);
else if ("subject".equals(sort))
menu.findItem(R.id.menu_sort_on_subject).setChecked(true);
menu.findItem(R.id.menu_zoom).setVisible(!selection);
@ -1787,6 +1789,11 @@ public class FragmentMessages extends FragmentBase {
onMenuSort("sender");
return true;
case R.id.menu_sort_on_subject:
item.setChecked(true);
onMenuSort("subject");
return true;
case R.id.menu_zoom:
onMenuZoom();
return true;

@ -34,6 +34,9 @@
<item
android:id="@+id/menu_sort_on_sender"
android:title="@string/title_sort_on_sender" />
<item
android:id="@+id/menu_sort_on_subject"
android:title="@string/title_sort_on_subject" />
</group>
</menu>
</item>

@ -417,6 +417,7 @@
<string name="title_sort_on_unread">Unread</string>
<string name="title_sort_on_starred">Starred</string>
<string name="title_sort_on_sender">Sender</string>
<string name="title_sort_on_subject">Subject</string>
<string name="title_compact">Compact view</string>
<string name="title_zoom">Text size</string>

Loading…
Cancel
Save