mirror of https://github.com/M66B/FairEmail.git
Unified system folder fixes/improvements
This commit is contained in:
parent
816ab11ef9
commit
a1bead9301
|
@ -72,7 +72,7 @@ public class AdapterNavUnified extends RecyclerView.Adapter<AdapterNavUnified.Vi
|
|||
}
|
||||
|
||||
private void bindTo(String type) {
|
||||
ivItem.setImageResource(R.drawable.baseline_folder_shared_24);
|
||||
ivItem.setImageResource(EntityFolder.getIcon(type));
|
||||
tvItem.setText(Helper.localizeFolderType(context, type));
|
||||
tvItemExtra.setVisibility(View.GONE);
|
||||
ivWarning.setVisibility(View.GONE);
|
||||
|
|
|
@ -101,9 +101,9 @@ public interface DaoFolder {
|
|||
" LEFT JOIN rule ON rule.folder = folder.id" +
|
||||
" LEFT JOIN operation ON operation.folder = folder.id" +
|
||||
" WHERE account.`synchronize`" +
|
||||
" AND folder.unified" +
|
||||
" AND ((:type IS NULL AND folder.unified) OR folder.type = :type)" +
|
||||
" GROUP BY folder.id")
|
||||
LiveData<List<TupleFolderEx>> liveUnified();
|
||||
LiveData<List<TupleFolderEx>> liveUnified(String type);
|
||||
|
||||
@Query("SELECT folder.*" +
|
||||
", account.`order` AS accountOrder, account.name AS accountName, account.color AS accountColor" +
|
||||
|
@ -158,6 +158,7 @@ public interface DaoFolder {
|
|||
" FROM folder" +
|
||||
" JOIN account ON account.id = folder.account" +
|
||||
" WHERE account.synchronize" +
|
||||
" AND folder.type <> '" + EntityFolder.SYSTEM + "'" +
|
||||
" AND folder.type <> '" + EntityFolder.USER + "'" +
|
||||
" GROUP BY folder.type" +
|
||||
" HAVING COUNT(folder.id) > 1")
|
||||
|
|
|
@ -172,15 +172,16 @@ public interface DaoMessage {
|
|||
|
||||
@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" +
|
||||
" WHERE ((:folder IS NULL AND :type IS NULL AND folder.unified)" +
|
||||
" OR folder.type = :type OR folder.id = :folder)" +
|
||||
" AND ui_hide <> 0")
|
||||
LiveData<List<Long>> liveHidden(Long folder);
|
||||
LiveData<List<Long>> liveHiddenFolder(Long folder, String type);
|
||||
|
||||
@Query("SELECT id FROM message" +
|
||||
" WHERE account = :account" +
|
||||
" AND thread = :thread" +
|
||||
" AND ui_hide <> 0")
|
||||
LiveData<List<Long>> liveHidden(long account, String thread);
|
||||
LiveData<List<Long>> liveHiddenThread(long account, String thread);
|
||||
|
||||
@Query("SELECT *" +
|
||||
" FROM message" +
|
||||
|
|
|
@ -213,6 +213,8 @@ public class EntityFolder extends EntityOrder implements Serializable {
|
|||
return R.drawable.baseline_delete_24;
|
||||
if (EntityFolder.JUNK.equals(type))
|
||||
return R.drawable.baseline_flag_24;
|
||||
if (EntityFolder.SYSTEM.equals(type))
|
||||
return R.drawable.baseline_folder_special_24;
|
||||
return R.drawable.baseline_folder_24;
|
||||
}
|
||||
|
||||
|
|
|
@ -2050,7 +2050,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
// Folder
|
||||
switch (viewType) {
|
||||
case UNIFIED:
|
||||
db.folder().liveUnified().observe(getViewLifecycleOwner(), new Observer<List<TupleFolderEx>>() {
|
||||
db.folder().liveUnified(type).observe(getViewLifecycleOwner(), new Observer<List<TupleFolderEx>>() {
|
||||
@Override
|
||||
public void onChanged(List<TupleFolderEx> folders) {
|
||||
if (folders == null)
|
||||
|
@ -2059,7 +2059,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
updateState(folders);
|
||||
}
|
||||
});
|
||||
db.message().liveHidden(null).observe(getViewLifecycleOwner(), new Observer<List<Long>>() {
|
||||
db.message().liveHiddenFolder(null, type).observe(getViewLifecycleOwner(), new Observer<List<Long>>() {
|
||||
@Override
|
||||
public void onChanged(List<Long> ids) {
|
||||
if (ids != null && selectionTracker != null)
|
||||
|
@ -2086,7 +2086,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
}
|
||||
}
|
||||
});
|
||||
db.message().liveHidden(folder).observe(getViewLifecycleOwner(), new Observer<List<Long>>() {
|
||||
db.message().liveHiddenFolder(folder, null).observe(getViewLifecycleOwner(), new Observer<List<Long>>() {
|
||||
@Override
|
||||
public void onChanged(List<Long> ids) {
|
||||
if (ids != null && selectionTracker != null)
|
||||
|
@ -2115,7 +2115,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
}
|
||||
}
|
||||
});
|
||||
db.message().liveHidden(account, thread).observe(getViewLifecycleOwner(), new Observer<List<Long>>() {
|
||||
db.message().liveHiddenThread(account, thread).observe(getViewLifecycleOwner(), new Observer<List<Long>>() {
|
||||
@Override
|
||||
public void onChanged(List<Long> ids) {
|
||||
if (ids != null) {
|
||||
|
|
Loading…
Reference in New Issue