|
@ -198,12 +198,12 @@ public class FragmentMessage extends FragmentEx { |
|
|
@Override |
|
|
@Override |
|
|
public boolean onNavigationItemSelected(@NonNull MenuItem item) { |
|
|
public boolean onNavigationItemSelected(@NonNull MenuItem item) { |
|
|
switch (item.getItemId()) { |
|
|
switch (item.getItemId()) { |
|
|
case R.id.action_trash: |
|
|
|
|
|
onActionDelete(id); |
|
|
|
|
|
return true; |
|
|
|
|
|
case R.id.action_spam: |
|
|
case R.id.action_spam: |
|
|
onActionSpam(id); |
|
|
onActionSpam(id); |
|
|
return true; |
|
|
return true; |
|
|
|
|
|
case R.id.action_trash: |
|
|
|
|
|
onActionDelete(id); |
|
|
|
|
|
return true; |
|
|
case R.id.action_move: |
|
|
case R.id.action_move: |
|
|
onActionMove(id); |
|
|
onActionMove(id); |
|
|
return true; |
|
|
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.getMenu().findItem(R.id.action_reply_all).setVisible(!outbox && message.cc != null); |
|
|
top_navigation.setVisibility(View.VISIBLE); |
|
|
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_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_move).setVisible(!outbox && (!inbox || hasUser)); |
|
|
bottom_navigation.getMenu().findItem(R.id.action_archive).setVisible(!outbox && !archive && hasArchive); |
|
|
bottom_navigation.getMenu().findItem(R.id.action_archive).setVisible(!outbox && !archive && hasArchive); |
|
|
bottom_navigation.getMenu().findItem(R.id.action_reply).setVisible(!outbox); |
|
|
bottom_navigation.getMenu().findItem(R.id.action_reply).setVisible(!outbox); |
|
@ -439,6 +439,35 @@ public class FragmentMessage extends FragmentEx { |
|
|
.putExtra("action", "reply_all")); |
|
|
.putExtra("action", "reply_all")); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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) { |
|
|
|
|
|
executor.submit(new Runnable() { |
|
|
|
|
|
@Override |
|
|
|
|
|
public void run() { |
|
|
|
|
|
try { |
|
|
|
|
|
DB db = DB.getInstance(getContext()); |
|
|
|
|
|
EntityMessage message = db.message().getMessage(id); |
|
|
|
|
|
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); |
|
|
|
|
|
EntityOperation.process(getContext()); |
|
|
|
|
|
} catch (Throwable ex) { |
|
|
|
|
|
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex)); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
.setNegativeButton(android.R.string.cancel, null).show(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private void onActionDelete(final long id) { |
|
|
private void onActionDelete(final long id) { |
|
|
String folderType = (String) bottom_navigation.getTag(); |
|
|
String folderType = (String) bottom_navigation.getTag(); |
|
|
if (EntityFolder.TYPE_TRASH.equals(folderType)) { |
|
|
if (EntityFolder.TYPE_TRASH.equals(folderType)) { |
|
@ -488,35 +517,6 @@ 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) { |
|
|
|
|
|
executor.submit(new Runnable() { |
|
|
|
|
|
@Override |
|
|
|
|
|
public void run() { |
|
|
|
|
|
try { |
|
|
|
|
|
DB db = DB.getInstance(getContext()); |
|
|
|
|
|
EntityMessage message = db.message().getMessage(id); |
|
|
|
|
|
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); |
|
|
|
|
|
EntityOperation.process(getContext()); |
|
|
|
|
|
} catch (Throwable ex) { |
|
|
|
|
|
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex)); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
.setNegativeButton(android.R.string.cancel, null).show(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void onActionMove(final long id) { |
|
|
private void onActionMove(final long id) { |
|
|
Bundle args = new Bundle(); |
|
|
Bundle args = new Bundle(); |
|
|
args.putLong("id", id); |
|
|
args.putLong("id", id); |
|
|