mirror of https://github.com/M66B/FairEmail.git
Added batch add to/delete from unified inbox
This commit is contained in:
parent
3900781b6e
commit
1835565ea3
|
@ -675,6 +675,8 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|||
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, 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);
|
||||
|
@ -710,6 +712,12 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|||
} else if (itemId == R.string.title_notify_batch_disable) {
|
||||
onActionEnableNotify(false);
|
||||
return true;
|
||||
} else if (itemId == R.string.title_unified_inbox_add) {
|
||||
onActionUnifiedInbox(true);
|
||||
return true;
|
||||
} else if (itemId == R.string.title_unified_inbox_delete) {
|
||||
onActionUnifiedInbox(false);
|
||||
return true;
|
||||
} else if (itemId == R.string.title_navigation_folder) {
|
||||
onActionEnableNavigationMenu(true);
|
||||
return true;
|
||||
|
@ -945,6 +953,42 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|||
}.execute(context, owner, args, "enable");
|
||||
}
|
||||
|
||||
private void onActionUnifiedInbox(boolean add) {
|
||||
Bundle args = new Bundle();
|
||||
args.putLong("id", folder.id);
|
||||
args.putBoolean("add", add);
|
||||
|
||||
new SimpleTask<Void>() {
|
||||
@Override
|
||||
protected Void onExecute(Context context, Bundle args) throws Throwable {
|
||||
long id = args.getLong("id");
|
||||
boolean add = args.getBoolean("add");
|
||||
|
||||
DB db = DB.getInstance(context);
|
||||
try {
|
||||
db.beginTransaction();
|
||||
List<EntityFolder> childs = db.folder().getChildFolders(id);
|
||||
if (childs == null)
|
||||
return null;
|
||||
|
||||
for (EntityFolder child : childs)
|
||||
db.folder().setFolderUnified(child.id, add);
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Log.unexpectedError(parentFragment.getParentFragmentManager(), ex);
|
||||
}
|
||||
}.execute(context, owner, args, "unified");
|
||||
}
|
||||
|
||||
private void onActionEnableNavigationMenu(boolean enabled) {
|
||||
Bundle args = new Bundle();
|
||||
args.putLong("id", folder.id);
|
||||
|
|
|
@ -1280,6 +1280,8 @@
|
|||
<string name="title_unified_folder">Show in unified inbox</string>
|
||||
<string name="title_navigation_folder">Show in navigation menu</string>
|
||||
<string name="title_navigation_folder_hide">Hide in navigation menu</string>
|
||||
<string name="title_unified_inbox_add">Add to unified inbox</string>
|
||||
<string name="title_unified_inbox_delete">Delete from unified inbox</string>
|
||||
<string name="title_synchronize_folder">Synchronize (receive messages)</string>
|
||||
<string name="title_poll_folder">Check periodically instead of continuous synchronize</string>
|
||||
<string name="title_poll_folder_remark">Most email servers allow push messages for a handful of folders only!</string>
|
||||
|
|
Loading…
Reference in New Issue