|
|
|
@ -198,12 +198,12 @@ public class FragmentMessage extends FragmentEx {
|
|
|
|
|
@Override
|
|
|
|
|
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
|
|
|
|
|
switch (item.getItemId()) {
|
|
|
|
|
case R.id.action_trash:
|
|
|
|
|
onActionDelete(id);
|
|
|
|
|
return true;
|
|
|
|
|
case R.id.action_spam:
|
|
|
|
|
onActionSpam(id);
|
|
|
|
|
return true;
|
|
|
|
|
case R.id.action_trash:
|
|
|
|
|
onActionDelete(id);
|
|
|
|
|
return true;
|
|
|
|
|
case R.id.action_move:
|
|
|
|
|
onActionMove(id);
|
|
|
|
|
return true;
|
|
|
|
@ -333,8 +333,8 @@ public class FragmentMessage extends FragmentEx {
|
|
|
|
|
top_navigation.getMenu().findItem(R.id.action_reply_all).setVisible(!outbox && message.cc != null);
|
|
|
|
|
top_navigation.setVisibility(View.VISIBLE);
|
|
|
|
|
|
|
|
|
|
bottom_navigation.getMenu().findItem(R.id.action_trash).setVisible(!outbox && !trash && hasTrash);
|
|
|
|
|
bottom_navigation.getMenu().findItem(R.id.action_spam).setVisible(!outbox && !junk && hasJunk);
|
|
|
|
|
bottom_navigation.getMenu().findItem(R.id.action_trash).setVisible(!outbox && !trash && hasTrash);
|
|
|
|
|
bottom_navigation.getMenu().findItem(R.id.action_move).setVisible(!outbox && (!inbox || hasUser));
|
|
|
|
|
bottom_navigation.getMenu().findItem(R.id.action_archive).setVisible(!outbox && !archive && hasArchive);
|
|
|
|
|
bottom_navigation.getMenu().findItem(R.id.action_reply).setVisible(!outbox);
|
|
|
|
@ -439,12 +439,10 @@ public class FragmentMessage extends FragmentEx {
|
|
|
|
|
.putExtra("action", "reply_all"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void onActionDelete(final long id) {
|
|
|
|
|
String folderType = (String) bottom_navigation.getTag();
|
|
|
|
|
if (EntityFolder.TYPE_TRASH.equals(folderType)) {
|
|
|
|
|
private void onActionSpam(final long id) {
|
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
|
|
|
|
builder
|
|
|
|
|
.setMessage(R.string.title_ask_delete)
|
|
|
|
|
.setMessage(R.string.title_ask_spam)
|
|
|
|
|
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
@ -457,7 +455,8 @@ public class FragmentMessage extends FragmentEx {
|
|
|
|
|
message.ui_hide = true;
|
|
|
|
|
db.message().updateMessage(message);
|
|
|
|
|
|
|
|
|
|
EntityOperation.queue(getContext(), message, EntityOperation.DELETE);
|
|
|
|
|
EntityFolder spam = db.folder().getFolderByType(message.account, EntityFolder.TYPE_JUNK);
|
|
|
|
|
EntityOperation.queue(getContext(), message, EntityOperation.MOVE, spam.id);
|
|
|
|
|
EntityOperation.process(getContext());
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
|
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
|
|
|
@ -467,7 +466,17 @@ public class FragmentMessage extends FragmentEx {
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.setNegativeButton(android.R.string.cancel, null).show();
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void onActionDelete(final long id) {
|
|
|
|
|
String folderType = (String) bottom_navigation.getTag();
|
|
|
|
|
if (EntityFolder.TYPE_TRASH.equals(folderType)) {
|
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
|
|
|
|
builder
|
|
|
|
|
.setMessage(R.string.title_ask_delete)
|
|
|
|
|
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
executor.submit(new Runnable() {
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
@ -477,8 +486,7 @@ public class FragmentMessage extends FragmentEx {
|
|
|
|
|
message.ui_hide = true;
|
|
|
|
|
db.message().updateMessage(message);
|
|
|
|
|
|
|
|
|
|
EntityFolder trash = db.folder().getFolderByType(message.account, EntityFolder.TYPE_TRASH);
|
|
|
|
|
EntityOperation.queue(getContext(), message, EntityOperation.MOVE, trash.id);
|
|
|
|
|
EntityOperation.queue(getContext(), message, EntityOperation.DELETE);
|
|
|
|
|
EntityOperation.process(getContext());
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
|
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
|
|
|
@ -486,15 +494,9 @@ public class FragmentMessage extends FragmentEx {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void onActionSpam(final long id) {
|
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
|
|
|
|
builder
|
|
|
|
|
.setMessage(R.string.title_ask_spam)
|
|
|
|
|
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
})
|
|
|
|
|
.setNegativeButton(android.R.string.cancel, null).show();
|
|
|
|
|
} else {
|
|
|
|
|
executor.submit(new Runnable() {
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
@ -504,8 +506,8 @@ public class FragmentMessage extends FragmentEx {
|
|
|
|
|
message.ui_hide = true;
|
|
|
|
|
db.message().updateMessage(message);
|
|
|
|
|
|
|
|
|
|
EntityFolder spam = db.folder().getFolderByType(message.account, EntityFolder.TYPE_JUNK);
|
|
|
|
|
EntityOperation.queue(getContext(), message, EntityOperation.MOVE, spam.id);
|
|
|
|
|
EntityFolder trash = db.folder().getFolderByType(message.account, EntityFolder.TYPE_TRASH);
|
|
|
|
|
EntityOperation.queue(getContext(), message, EntityOperation.MOVE, trash.id);
|
|
|
|
|
EntityOperation.process(getContext());
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
|
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
|
|
|
@ -513,8 +515,6 @@ public class FragmentMessage extends FragmentEx {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.setNegativeButton(android.R.string.cancel, null).show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void onActionMove(final long id) {
|
|
|
|
|