Consistent folder popup menu items

This commit is contained in:
M66B 2024-05-23 10:16:48 +02:00
parent 8fa6b65d7a
commit 889e2a3334
1 changed files with 28 additions and 24 deletions

View File

@ -632,15 +632,19 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
else if (EntityFolder.JUNK.equals(folder.type))
popupMenu.getMenu().add(Menu.NONE, R.string.title_empty_spam, order++, R.string.title_empty_spam);
if (folder.account != null && folder.accountProtocol == EntityAccount.TYPE_IMAP)
popupMenu.getMenu().add(Menu.NONE, R.string.title_synchronize_enabled, order++, R.string.title_synchronize_enabled)
.setCheckable(true).setChecked(folder.synchronize);
if (folder.account != null) {
popupMenu.getMenu().add(Menu.NONE, R.string.title_notify_folder, order++, R.string.title_notify_folder)
.setCheckable(true).setChecked(folder.notify);
popupMenu.getMenu().add(Menu.NONE, R.string.title_unified_folder, order++, R.string.title_unified_folder)
.setCheckable(true).setChecked(folder.unified);
popupMenu.getMenu().add(Menu.NONE, R.string.title_navigation_folder, order++, R.string.title_navigation_folder)
.setCheckable(true).setChecked(folder.navigation);
popupMenu.getMenu().add(Menu.NONE, R.string.title_notify_folder, order++, R.string.title_notify_folder)
.setCheckable(true).setChecked(folder.notify);
}
if (folder.account != null && folder.accountProtocol == EntityAccount.TYPE_IMAP) {
@ -649,9 +653,6 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
popupMenu.getMenu().add(Menu.NONE, R.string.title_subscribe, order++, R.string.title_subscribe)
.setCheckable(true).setChecked(folder.subscribed != null && folder.subscribed);
popupMenu.getMenu().add(Menu.NONE, R.string.title_synchronize_enabled, order++, R.string.title_synchronize_enabled)
.setCheckable(true).setChecked(folder.synchronize);
if (!folder.read_only) {
popupMenu.getMenu().add(Menu.NONE, R.string.title_edit_rules, order++, R.string.title_edit_rules);
popupMenu.getMenu().add(Menu.NONE, R.string.title_execute_rules, order++, R.string.title_execute_rules);
@ -705,15 +706,15 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
.addSubMenu(Menu.NONE, Menu.NONE, order++, R.string.title_synchronize_subfolders);
submenu.add(Menu.FIRST, R.string.title_synchronize_now, 1, R.string.title_synchronize_now);
submenu.add(Menu.FIRST, R.string.title_synchronize_batch_enable, 2, R.string.title_synchronize_batch_enable);
submenu.add(Menu.FIRST, R.string.title_synchronize_batch_disable, 3, R.string.title_synchronize_batch_disable);
submenu.add(Menu.FIRST, R.string.title_notify_batch_enable, 4, R.string.title_notify_batch_enable);
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, 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_synchronize_more, 2, R.string.title_synchronize_more);
submenu.add(Menu.FIRST, R.string.title_synchronize_batch_enable, 3, R.string.title_synchronize_batch_enable);
submenu.add(Menu.FIRST, R.string.title_synchronize_batch_disable, 4, R.string.title_synchronize_batch_disable);
submenu.add(Menu.FIRST, R.string.title_notify_batch_enable, 5, R.string.title_notify_batch_enable);
submenu.add(Menu.FIRST, R.string.title_notify_batch_disable, 6, R.string.title_notify_batch_disable);
submenu.add(Menu.FIRST, R.string.title_unified_inbox_add, 7, R.string.title_unified_inbox_add);
submenu.add(Menu.FIRST, R.string.title_unified_inbox_delete, 8, R.string.title_unified_inbox_delete);
submenu.add(Menu.FIRST, R.string.title_navigation_folder, 9, R.string.title_navigation_folder);
submenu.add(Menu.FIRST, R.string.title_navigation_folder_hide, 10, R.string.title_navigation_folder_hide);
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);
}
@ -736,6 +737,9 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
if (itemId == R.string.title_synchronize_now) {
onActionSync(true);
return true;
} else if (itemId == R.string.title_synchronize_more) {
onActionSyncMore(true);
return true;
} else if (itemId == R.string.title_synchronize_batch_enable) {
onActionEnableSync(true);
return true;
@ -760,9 +764,6 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
} else if (itemId == R.string.title_navigation_folder_hide) {
onActionEnableNavigationMenu(false);
return true;
} else if (itemId == R.string.title_synchronize_more) {
onActionSyncMore(true);
return true;
} else if (itemId == R.string.title_download_batch_enable) {
onActionEnableDownload(true);
return true;
@ -780,12 +781,6 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
} else if (itemId == R.string.title_synchronize_more) {
onActionSyncMore(false);
return true;
} else if (itemId == R.string.title_unified_folder || itemId == R.string.title_navigation_folder || itemId == R.string.title_notify_folder || itemId == R.string.title_synchronize_enabled) {
onActionProperty(itemId, !item.isChecked());
return true;
} else if (itemId == R.string.title_subscribe) {
onActionSubscribe();
return true;
} else if (itemId == R.string.title_delete_local) {
OnActionDeleteLocal(false);
return true;
@ -795,6 +790,15 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
} else if (itemId == R.string.title_expunge) {
onActionExpunge();
return true;
} else if (itemId == R.string.title_synchronize_enabled ||
itemId == R.string.title_notify_folder ||
itemId == R.string.title_unified_folder ||
itemId == R.string.title_navigation_folder) {
onActionProperty(itemId, !item.isChecked());
return true;
} else if (itemId == R.string.title_subscribe) {
onActionSubscribe();
return true;
} else if (itemId == R.string.title_empty_trash) {
onActionEmpty(EntityFolder.TRASH);
return true;