Added select all for search results

pull/159/head
M66B 5 years ago
parent 03f7f4271b
commit 834e84273b

@ -201,13 +201,15 @@ public interface DaoMessage {
List<Long> getMessageIdsByFolder(Long folder);
@Query("SELECT message.id" +
" FROM folder" +
" JOIN message ON message.folder = folder.id" +
" WHERE CASE WHEN :folder IS NULL THEN folder.unified ELSE folder.id = :folder END" +
" FROM message" +
" JOIN folder ON folder.id = message.folder" +
" WHERE ((:search AND ui_found)" +
" OR (NOT :search AND :folder IS NULL AND folder.unified)" +
" OR (NOT :search AND folder.id = :folder))" +
" AND ui_hide = 0" +
" AND (ui_snoozed IS NULL OR :snoozed)" +
" AND (:snoozed OR ui_snoozed IS NULL)" +
" ORDER BY message.received DESC")
List<Long> getMessageAll(Long folder, boolean snoozed);
List<Long> getMessageIds(Long folder, boolean search, boolean snoozed);
@Query("SELECT id" +
" FROM message" +

@ -2445,7 +2445,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
menu.findItem(R.id.menu_compact).setChecked(prefs.getBoolean("compact", false));
menu.findItem(R.id.menu_select_all).setVisible(!outbox &&
(viewType == AdapterMessage.ViewType.UNIFIED || viewType == AdapterMessage.ViewType.FOLDER));
(viewType == AdapterMessage.ViewType.UNIFIED ||
viewType == AdapterMessage.ViewType.FOLDER ||
viewType == AdapterMessage.ViewType.SEARCH));
super.onPrepareOptionsMenu(menu);
}
@ -2610,16 +2612,18 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
Bundle args = new Bundle();
args.putLong("id", folder);
args.putBoolean("search", viewType == AdapterMessage.ViewType.SEARCH);
args.putBoolean("snoozed", snoozed);
new SimpleTask<List<Long>>() {
@Override
protected List<Long> onExecute(Context context, Bundle args) {
long id = args.getLong("id");
boolean search = args.getBoolean("search");
boolean snoozed = args.getBoolean("snoozed");
DB db = DB.getInstance(context);
return db.message().getMessageAll(id < 0 ? null : id, snoozed);
return db.message().getMessageIds(id < 0 ? null : id, search, snoozed);
}
@Override

Loading…
Cancel
Save