mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-03 13:44:40 +00:00
Swipe/ask: added trash/archive
This commit is contained in:
parent
c1909db169
commit
cddcaf6819
1 changed files with 188 additions and 149 deletions
|
@ -3420,6 +3420,22 @@ public class FragmentMessages extends FragmentBase
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onSwipeAsk(final @NonNull TupleMessageEx message, @NonNull View anchor) {
|
private void onSwipeAsk(final @NonNull TupleMessageEx message, @NonNull View anchor) {
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putLong("account", message.account);
|
||||||
|
|
||||||
|
new SimpleTask<Pair<EntityFolder, EntityFolder>>() {
|
||||||
|
@Override
|
||||||
|
protected Pair<EntityFolder, EntityFolder> onExecute(Context context, Bundle args) throws Throwable {
|
||||||
|
long account = args.getLong("account");
|
||||||
|
|
||||||
|
DB db = DB.getInstance(context);
|
||||||
|
return new Pair(
|
||||||
|
db.folder().getFolderByType(account, EntityFolder.ARCHIVE),
|
||||||
|
db.folder().getFolderByType(account, EntityFolder.TRASH));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onExecuted(Bundle args, Pair<EntityFolder, EntityFolder> data) {
|
||||||
// Make sure animations are done
|
// Make sure animations are done
|
||||||
rvMessage.post(new Runnable() {
|
rvMessage.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -3474,6 +3490,15 @@ public class FragmentMessages extends FragmentBase
|
||||||
popupMenu.getMenu().add(Menu.NONE, R.string.title_summarize, order++, R.string.title_summarize)
|
popupMenu.getMenu().add(Menu.NONE, R.string.title_summarize, order++, R.string.title_summarize)
|
||||||
.setIcon(R.drawable.twotone_smart_toy_24);
|
.setIcon(R.drawable.twotone_smart_toy_24);
|
||||||
|
|
||||||
|
if (data.first != null && data.first.id != null)
|
||||||
|
popupMenu.getMenu().add(Menu.NONE, R.string.title_archive, order++, R.string.title_archive)
|
||||||
|
.setIcon(R.drawable.twotone_archive_24)
|
||||||
|
.setIntent(new Intent().putExtra("folder", data.first.id));
|
||||||
|
if (data.second != null && data.second.id != null)
|
||||||
|
popupMenu.getMenu().add(Menu.NONE, R.string.title_trash, order++, R.string.title_trash)
|
||||||
|
.setIcon(R.drawable.twotone_delete_24)
|
||||||
|
.setIntent(new Intent().putExtra("folder", data.second.id));
|
||||||
|
|
||||||
if (message.accountProtocol == EntityAccount.TYPE_IMAP) {
|
if (message.accountProtocol == EntityAccount.TYPE_IMAP) {
|
||||||
popupMenu.getMenu().add(Menu.NONE, R.string.title_move, order++, R.string.title_move)
|
popupMenu.getMenu().add(Menu.NONE, R.string.title_move, order++, R.string.title_move)
|
||||||
.setIcon(R.drawable.twotone_drive_file_move_24);
|
.setIcon(R.drawable.twotone_drive_file_move_24);
|
||||||
|
@ -3522,6 +3547,13 @@ public class FragmentMessages extends FragmentBase
|
||||||
} else if (itemId == R.string.title_summarize) {
|
} else if (itemId == R.string.title_summarize) {
|
||||||
onSwipeSummarize(message);
|
onSwipeSummarize(message);
|
||||||
return true;
|
return true;
|
||||||
|
} else if (itemId == R.string.title_archive || itemId == R.string.title_trash) {
|
||||||
|
Intent intent = target.getIntent();
|
||||||
|
long folder = (intent == null ? -1L : intent.getLongExtra("folder", -1L));
|
||||||
|
if (folder < 0)
|
||||||
|
return false;
|
||||||
|
swipeFolder(message, folder);
|
||||||
|
return true;
|
||||||
} else if (itemId == R.string.title_move) {
|
} else if (itemId == R.string.title_move) {
|
||||||
onSwipeMove(message);
|
onSwipeMove(message);
|
||||||
return true;
|
return true;
|
||||||
|
@ -3574,6 +3606,13 @@ public class FragmentMessages extends FragmentBase
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onException(Bundle args, Throwable ex) {
|
||||||
|
Log.unexpectedError(getParentFragment(), ex);
|
||||||
|
}
|
||||||
|
}.execute(FragmentMessages.this, args, "swipe:ask");
|
||||||
|
}
|
||||||
|
|
||||||
private void onSwipeSnooze(TupleMessageEx message, RecyclerView.ViewHolder viewHolder) {
|
private void onSwipeSnooze(TupleMessageEx message, RecyclerView.ViewHolder viewHolder) {
|
||||||
if (!ActivityBilling.isPro(getContext())) {
|
if (!ActivityBilling.isPro(getContext())) {
|
||||||
redraw(viewHolder);
|
redraw(viewHolder);
|
||||||
|
|
Loading…
Reference in a new issue