1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-27 10:17:18 +00:00

Sort outbox on send order

This commit is contained in:
M66B 2022-03-19 07:38:34 +01:00
parent 952ed112af
commit c4b1c6a0b6
2 changed files with 13 additions and 8 deletions

View file

@ -945,7 +945,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
boolean compact = prefs.getBoolean("compact", false);
int zoom = prefs.getInt("view_zoom", compact ? 0 : 1);
boolean ascending = prefs.getBoolean(getSortOrder(getContext(), viewType, type), false);
boolean outbox = EntityFolder.OUTBOX.equals(type);
boolean ascending = prefs.getBoolean(getSortOrder(getContext(), viewType, type), outbox);
boolean filter_duplicates = prefs.getBoolean("filter_duplicates", true);
boolean filter_trash = prefs.getBoolean("filter_trash", false);
@ -4702,10 +4703,14 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
public void onPrepareOptionsMenu(Menu menu) {
boolean drafts = EntityFolder.DRAFTS.equals(type);
boolean outbox = EntityFolder.OUTBOX.equals(type);
boolean sent = EntityFolder.SENT.equals(type);
final Context context = getContext();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
String sort = prefs.getString(getSort(context, viewType, type), "time");
boolean ascending = prefs.getBoolean(getSortOrder(context, viewType, type), false);
boolean ascending = prefs.getBoolean(getSortOrder(context, viewType, type), outbox);
boolean filter_seen = prefs.getBoolean(getFilter(context, "seen", viewType, type), false);
boolean filter_unflagged = prefs.getBoolean(getFilter(context, "unflagged", viewType, type), false);
boolean filter_unknown = prefs.getBoolean(getFilter(context, "unknown", viewType, type), false);
@ -4721,10 +4726,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
int padding = prefs.getInt("view_padding", compact ? 0 : 1);
boolean quick_filter = prefs.getBoolean("quick_filter", false);
boolean drafts = EntityFolder.DRAFTS.equals(type);
boolean outbox = EntityFolder.OUTBOX.equals(type);
boolean sent = EntityFolder.SENT.equals(type);
boolean folder =
(viewType == AdapterMessage.ViewType.UNIFIED ||
(viewType == AdapterMessage.ViewType.FOLDER && !outbox));
@ -6613,7 +6614,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
}
static String getSortOrder(Context context, AdapterMessage.ViewType viewType, String type) {
if (viewType == AdapterMessage.ViewType.THREAD)
if (EntityFolder.OUTBOX.equals(type))
return "ascending_outbox";
else if (viewType == AdapterMessage.ViewType.THREAD)
return "ascending_thread";
else if (viewType == AdapterMessage.ViewType.UNIFIED)
return "ascending_unified";

View file

@ -514,9 +514,11 @@ public class ViewModelMessages extends ViewModel {
this.criteria = criteria;
this.server = server;
boolean outbox = EntityFolder.OUTBOX.equals(type);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
this.sort = prefs.getString(FragmentMessages.getSort(context, viewType, type), "time");
this.ascending = prefs.getBoolean(FragmentMessages.getSortOrder(context, viewType, type), false);
this.ascending = prefs.getBoolean(FragmentMessages.getSortOrder(context, viewType, type), outbox);
this.filter_seen = prefs.getBoolean(FragmentMessages.getFilter(context, "seen", viewType, type), false);
this.filter_unflagged = prefs.getBoolean(FragmentMessages.getFilter(context, "unflagged", viewType, type), false);
this.filter_unknown = prefs.getBoolean(FragmentMessages.getFilter(context, "unknown", viewType, type), false);