Added sort on priority

pull/172/head
M66B 5 years ago
parent f26d8e44c5
commit cb741da678

@ -79,6 +79,7 @@ public interface DaoMessage {
" ORDER BY CASE" +
" WHEN 'unread' = :sort THEN SUM(1 - message.ui_seen) = 0" +
" WHEN 'starred' = :sort THEN COUNT(message.id) - SUM(1 - message.ui_flagged) = 0" +
" WHEN 'priority' = :sort THEN -MAX(IFNULL(message.priority, 1))" +
" WHEN 'sender' = :sort THEN LOWER(message.sender)" +
" WHEN 'subject' = :sort THEN LOWER(message.subject)" +
" WHEN 'size' = :sort THEN -SUM(message.total)" +
@ -127,6 +128,7 @@ public interface DaoMessage {
" ORDER BY CASE" +
" WHEN 'unread' = :sort THEN SUM(1 - message.ui_seen) = 0" +
" WHEN 'starred' = :sort THEN COUNT(message.id) - SUM(1 - message.ui_flagged) = 0" +
" WHEN 'priority' = :sort THEN -MAX(IFNULL(message.priority, 1))" +
" WHEN 'sender' = :sort THEN LOWER(message.sender)" +
" WHEN 'subject' = :sort THEN LOWER(message.subject)" +
" WHEN 'size' = :sort THEN -SUM(message.total)" +

@ -3025,6 +3025,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
if (viewType == AdapterMessage.ViewType.THREAD) {
menu.findItem(R.id.menu_sort_on_time).setVisible(false);
menu.findItem(R.id.menu_sort_on_unread).setVisible(false);
menu.findItem(R.id.menu_sort_on_priority).setVisible(false);
menu.findItem(R.id.menu_sort_on_starred).setVisible(false);
menu.findItem(R.id.menu_sort_on_sender).setVisible(false);
menu.findItem(R.id.menu_sort_on_subject).setVisible(false);
@ -3039,6 +3040,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
menu.findItem(R.id.menu_sort_on_unread).setChecked(true);
else if ("starred".equals(sort))
menu.findItem(R.id.menu_sort_on_starred).setChecked(true);
else if ("priority".equals(sort))
menu.findItem(R.id.menu_sort_on_priority).setChecked(true);
else if ("sender".equals(sort))
menu.findItem(R.id.menu_sort_on_sender).setChecked(true);
else if ("subject".equals(sort))
@ -3109,6 +3112,11 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
onMenuSort("starred");
return true;
case R.id.menu_sort_on_priority:
item.setChecked(true);
onMenuSort("priority");
return true;
case R.id.menu_sort_on_sender:
item.setChecked(true);
onMenuSort("sender");

@ -31,6 +31,9 @@
<item
android:id="@+id/menu_sort_on_starred"
android:title="@string/title_sort_on_starred" />
<item
android:id="@+id/menu_sort_on_priority"
android:title="@string/title_sort_on_priority" />
<item
android:id="@+id/menu_sort_on_sender"
android:title="@string/title_sort_on_sender" />

@ -816,6 +816,7 @@
<string name="title_sort_on_time">Time</string>
<string name="title_sort_on_unread">Unread</string>
<string name="title_sort_on_starred">Starred</string>
<string name="title_sort_on_priority">Priority</string>
<string name="title_sort_on_sender">Sender</string>
<string name="title_sort_on_subject">Subject</string>
<string name="title_sort_on_size">Size</string>

Loading…
Cancel
Save