Undo selection on hiding message

pull/155/head
M66B 6 years ago
parent 8678c62f57
commit 8810639c64

@ -147,6 +147,12 @@ public interface DaoMessage {
", CASE WHEN folder.type = '" + EntityFolder.ARCHIVE + "' THEN 1 ELSE 0 END") ", CASE WHEN folder.type = '" + EntityFolder.ARCHIVE + "' THEN 1 ELSE 0 END")
DataSource.Factory<Integer, TupleMessageEx> pagedThread(long account, String thread, Long id, boolean debug); DataSource.Factory<Integer, TupleMessageEx> pagedThread(long account, String thread, Long id, boolean debug);
@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" +
" AND ui_hide")
LiveData<List<Long>> liveHidden(Long folder);
@Query("SELECT id FROM message" + @Query("SELECT id FROM message" +
" WHERE account = :account" + " WHERE account = :account" +
" AND thread = :thread" + " AND thread = :thread" +

@ -1754,6 +1754,14 @@ public class FragmentMessages extends FragmentBase {
swipeRefresh.setRefreshing(refreshing); swipeRefresh.setRefreshing(refreshing);
} }
}); });
db.message().liveHidden(null).observe(getViewLifecycleOwner(), new Observer<List<Long>>() {
@Override
public void onChanged(List<Long> ids) {
if (ids != null && selectionTracker != null)
for (long id : ids)
selectionTracker.deselect(id);
}
});
break; break;
case FOLDER: case FOLDER:
@ -1793,6 +1801,14 @@ public class FragmentMessages extends FragmentBase {
swipeRefresh.setRefreshing(refreshing); swipeRefresh.setRefreshing(refreshing);
} }
}); });
db.message().liveHidden(folder).observe(getViewLifecycleOwner(), new Observer<List<Long>>() {
@Override
public void onChanged(List<Long> ids) {
if (ids != null && selectionTracker != null)
for (long id : ids)
selectionTracker.deselect(id);
}
});
break; break;
case THREAD: case THREAD:

Loading…
Cancel
Save