mirror of https://github.com/M66B/FairEmail.git
All child folders
This commit is contained in:
parent
433790bbd0
commit
7a066d774c
|
@ -708,11 +708,11 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|||
submenu.add(Menu.FIRST, R.string.title_notify_batch_disable, 5, R.string.title_notify_batch_disable);
|
||||
submenu.add(Menu.FIRST, R.string.title_unified_inbox_add, 6, R.string.title_unified_inbox_add);
|
||||
submenu.add(Menu.FIRST, R.string.title_unified_inbox_delete, 7, R.string.title_unified_inbox_delete);
|
||||
submenu.add(Menu.FIRST, R.string.title_navigation_folder, 6, R.string.title_navigation_folder);
|
||||
submenu.add(Menu.FIRST, R.string.title_navigation_folder_hide, 7, R.string.title_navigation_folder_hide);
|
||||
submenu.add(Menu.FIRST, R.string.title_synchronize_more, 8, R.string.title_synchronize_more);
|
||||
submenu.add(Menu.FIRST, R.string.title_download_batch_enable, 9, R.string.title_download_batch_enable);
|
||||
submenu.add(Menu.FIRST, R.string.title_download_batch_disable, 10, R.string.title_download_batch_disable);
|
||||
submenu.add(Menu.FIRST, R.string.title_navigation_folder, 8, R.string.title_navigation_folder);
|
||||
submenu.add(Menu.FIRST, R.string.title_navigation_folder_hide, 9, R.string.title_navigation_folder_hide);
|
||||
submenu.add(Menu.FIRST, R.string.title_synchronize_more, 10, R.string.title_synchronize_more);
|
||||
submenu.add(Menu.FIRST, R.string.title_download_batch_enable, 11, R.string.title_download_batch_enable);
|
||||
submenu.add(Menu.FIRST, R.string.title_download_batch_disable, 12, R.string.title_download_batch_disable);
|
||||
}
|
||||
|
||||
if (folder.account != null && folder.accountProtocol == EntityAccount.TYPE_IMAP)
|
||||
|
@ -869,11 +869,10 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|||
EntityOperation.sync(context, folder.id, true, !children);
|
||||
|
||||
if (children) {
|
||||
List<EntityFolder> folders = db.folder().getChildFolders(folder.id);
|
||||
if (folders != null)
|
||||
for (EntityFolder child : folders)
|
||||
if (child.selectable)
|
||||
EntityOperation.sync(context, child.id, true);
|
||||
List<EntityFolder> folders = EntityFolder.getChildFolders(context, folder.id);
|
||||
for (EntityFolder child : folders)
|
||||
if (child.selectable)
|
||||
EntityOperation.sync(context, child.id, true);
|
||||
}
|
||||
|
||||
if (folder.account != null) {
|
||||
|
@ -935,10 +934,8 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|||
DB db = DB.getInstance(context);
|
||||
try {
|
||||
db.beginTransaction();
|
||||
List<EntityFolder> children = db.folder().getChildFolders(id);
|
||||
if (children == null)
|
||||
return null;
|
||||
|
||||
List<EntityFolder> children = EntityFolder.getChildFolders(context, id);
|
||||
for (EntityFolder child : children)
|
||||
db.folder().setFolderSynchronize(child.id, enabled);
|
||||
|
||||
|
@ -973,10 +970,8 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|||
DB db = DB.getInstance(context);
|
||||
try {
|
||||
db.beginTransaction();
|
||||
List<EntityFolder> children = db.folder().getChildFolders(id);
|
||||
if (children == null)
|
||||
return null;
|
||||
|
||||
List<EntityFolder> children = EntityFolder.getChildFolders(context, id);
|
||||
for (EntityFolder child : children)
|
||||
db.folder().setFolderNotify(child.id, enabled);
|
||||
|
||||
|
@ -1009,10 +1004,8 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|||
DB db = DB.getInstance(context);
|
||||
try {
|
||||
db.beginTransaction();
|
||||
List<EntityFolder> children = db.folder().getChildFolders(id);
|
||||
if (children == null)
|
||||
return null;
|
||||
|
||||
List<EntityFolder> children = EntityFolder.getChildFolders(context, id);
|
||||
for (EntityFolder child : children)
|
||||
db.folder().setFolderUnified(child.id, add);
|
||||
|
||||
|
@ -1045,10 +1038,8 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|||
DB db = DB.getInstance(context);
|
||||
try {
|
||||
db.beginTransaction();
|
||||
List<EntityFolder> children = db.folder().getChildFolders(id);
|
||||
if (children == null)
|
||||
return null;
|
||||
|
||||
List<EntityFolder> children = EntityFolder.getChildFolders(context, id);
|
||||
for (EntityFolder child : children)
|
||||
db.folder().setFolderNavigation(child.id, enabled);
|
||||
|
||||
|
@ -1092,10 +1083,8 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|||
DB db = DB.getInstance(context);
|
||||
try {
|
||||
db.beginTransaction();
|
||||
List<EntityFolder> children = db.folder().getChildFolders(id);
|
||||
if (children == null)
|
||||
return null;
|
||||
|
||||
List<EntityFolder> children = EntityFolder.getChildFolders(context, id);
|
||||
for (EntityFolder child : children)
|
||||
db.folder().setFolderDownload(child.id, enabled);
|
||||
|
||||
|
|
|
@ -415,6 +415,16 @@ public class EntityFolder extends EntityOrder implements Serializable {
|
|||
return outbox;
|
||||
}
|
||||
|
||||
static List<EntityFolder> getChildFolders(Context context, long id) {
|
||||
DB db = DB.getInstance(context);
|
||||
List<EntityFolder> children = db.folder().getChildFolders(id);
|
||||
if (children == null)
|
||||
children = new ArrayList<>();
|
||||
for (EntityFolder child : new ArrayList<>(children))
|
||||
children.addAll(getChildFolders(context, child.id));
|
||||
return children;
|
||||
}
|
||||
|
||||
static String getNotificationChannelId(long id) {
|
||||
return "notification.folder." + id;
|
||||
}
|
||||
|
|
|
@ -110,9 +110,8 @@ public class FragmentDialogSync extends FragmentDialogBase {
|
|||
folders.add(folder);
|
||||
|
||||
if (children) {
|
||||
List<EntityFolder> sub = db.folder().getChildFolders(folder.id);
|
||||
if (sub != null)
|
||||
folders.addAll(sub);
|
||||
List<EntityFolder> sub = EntityFolder.getChildFolders(context, folder.id);
|
||||
folders.addAll(sub);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue