Added more menu icons

pull/198/head
M66B 4 years ago
parent 5ed8f5d74b
commit 561d489425

@ -2847,31 +2847,41 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
protected void onExecuted(Bundle args, final MoreResult result) {
long[] ids = args.getLongArray("ids");
PopupMenuLifecycle popupMenu = new PopupMenuLifecycle(getContext(), getViewLifecycleOwner(), fabMore);
final Context context = getContext();
PopupMenuLifecycle popupMenu = new PopupMenuLifecycle(context, getViewLifecycleOwner(), fabMore);
int order = 0;
if (result.unseen) // Unseen, not draft
popupMenu.getMenu().add(Menu.NONE, R.string.title_seen, order++, R.string.title_seen);
popupMenu.getMenu().add(Menu.NONE, R.string.title_seen, order++, R.string.title_seen)
.setIcon(R.drawable.twotone_drafts_24);
if (result.seen) // Seen, not draft
popupMenu.getMenu().add(Menu.NONE, R.string.title_unseen, order++, R.string.title_unseen);
popupMenu.getMenu().add(Menu.NONE, R.string.title_unseen, order++, R.string.title_unseen)
.setIcon(R.drawable.twotone_mail_24);
popupMenu.getMenu().add(Menu.NONE, R.string.title_snooze, order++, R.string.title_snooze);
popupMenu.getMenu().add(Menu.NONE, R.string.title_snooze, order++, R.string.title_snooze)
.setIcon(R.drawable.twotone_timelapse_24);
if (result.visible)
popupMenu.getMenu().add(Menu.NONE, R.string.title_hide, order++, R.string.title_hide);
popupMenu.getMenu().add(Menu.NONE, R.string.title_hide, order++, R.string.title_hide)
.setIcon(R.drawable.twotone_visibility_off_24);
if (result.hidden)
popupMenu.getMenu().add(Menu.NONE, R.string.title_unhide, order++, R.string.title_unhide);
popupMenu.getMenu().add(Menu.NONE, R.string.title_unhide, order++, R.string.title_unhide)
.setIcon(R.drawable.twotone_visibility_24);
if (result.unflagged)
popupMenu.getMenu().add(Menu.NONE, R.string.title_flag, order++, R.string.title_flag);
popupMenu.getMenu().add(Menu.NONE, R.string.title_flag, order++, R.string.title_flag)
.setIcon(R.drawable.twotone_star_24);
if (result.flagged)
popupMenu.getMenu().add(Menu.NONE, R.string.title_unflag, order++, R.string.title_unflag);
popupMenu.getMenu().add(Menu.NONE, R.string.title_unflag, order++, R.string.title_unflag)
.setIcon(R.drawable.twotone_star_border_24);
if (result.unflagged || result.flagged)
popupMenu.getMenu().add(Menu.NONE, R.string.title_flag_color, order++, R.string.title_flag_color);
popupMenu.getMenu().add(Menu.NONE, R.string.title_flag_color, order++, R.string.title_flag_color)
.setIcon(R.drawable.twotone_stars_24);
SubMenu importance = popupMenu.getMenu()
.addSubMenu(Menu.NONE, Menu.NONE, order++, R.string.title_set_importance);
.addSubMenu(Menu.NONE, Menu.NONE, order++, R.string.title_set_importance)
.setIcon(R.drawable.twotone_priority_high_24);
importance.add(Menu.NONE, R.string.title_importance_high, 1, R.string.title_importance_high)
.setEnabled(!EntityMessage.PRIORITIY_HIGH.equals(result.importance));
importance.add(Menu.NONE, R.string.title_importance_normal, 2, R.string.title_importance_normal)
@ -2880,23 +2890,29 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
.setEnabled(!EntityMessage.PRIORITIY_LOW.equals(result.importance));
if (result.hasInbox && !result.isInbox) // not is inbox
popupMenu.getMenu().add(Menu.NONE, R.string.title_folder_inbox, order++, R.string.title_folder_inbox);
popupMenu.getMenu().add(Menu.NONE, R.string.title_folder_inbox, order++, R.string.title_folder_inbox)
.setIcon(R.drawable.twotone_move_to_inbox_24);
if (result.hasArchive && !result.isArchive) // has archive and not is archive
popupMenu.getMenu().add(Menu.NONE, R.string.title_archive, order++, R.string.title_archive);
popupMenu.getMenu().add(Menu.NONE, R.string.title_archive, order++, R.string.title_archive)
.setIcon(R.drawable.twotone_archive_24);
if (result.hasJunk && !result.isJunk && !result.isDrafts) // has junk and not junk/drafts
popupMenu.getMenu().add(Menu.NONE, R.string.title_spam, order++, R.string.title_spam);
popupMenu.getMenu().add(Menu.NONE, R.string.title_spam, order++, R.string.title_spam)
.setIcon(R.drawable.twotone_flag_24);
if (!result.isTrash && result.hasTrash && !result.isJunk) // not trash and has trash and not is junk
popupMenu.getMenu().add(Menu.NONE, R.string.title_trash, order++, R.string.title_trash);
popupMenu.getMenu().add(Menu.NONE, R.string.title_trash, order++, R.string.title_trash)
.setIcon(R.drawable.twotone_delete_24);
if (result.isTrash || !result.hasTrash || result.isJunk ||
ids.length <= MAX_PERMANENT_DELETE) // is trash or no trash or is junk
popupMenu.getMenu().add(Menu.NONE, R.string.title_delete_permanently, order++, R.string.title_delete_permanently);
popupMenu.getMenu().add(Menu.NONE, R.string.title_delete_permanently, order++, R.string.title_delete_permanently)
.setIcon(R.drawable.twotone_delete_forever_24);
if (result.accounts.size() > 0 /* IMAP */ && ids.length < MAX_SEND_RAW)
popupMenu.getMenu().add(Menu.NONE, R.string.title_raw_send, order++, R.string.title_raw_send);
popupMenu.getMenu().add(Menu.NONE, R.string.title_raw_send, order++, R.string.title_raw_send)
.setIcon(R.drawable.twotone_attachment_24);
for (EntityAccount account : result.accounts) {
String title = getString(R.string.title_move_to_account, account.name);
@ -2905,12 +2921,16 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
int i = title.indexOf(account.name);
ss.setSpan(new ForegroundColorSpan(account.color), i, i + 1, 0);
}
MenuItem item = popupMenu.getMenu().add(Menu.NONE, R.string.title_move_to_account, order++, ss);
MenuItem item = popupMenu.getMenu().add(Menu.NONE, R.string.title_move_to_account, order++, ss)
.setIcon(R.drawable.twotone_drive_file_move_24);
item.setIntent(new Intent().putExtra("account", account.id));
}
if (result.copyto != null)
popupMenu.getMenu().add(Menu.NONE, R.string.title_copy_to, order++, R.string.title_copy_to);
popupMenu.getMenu().add(Menu.NONE, R.string.title_copy_to, order++, R.string.title_copy_to)
.setIcon(R.drawable.twotone_file_copy_24);
popupMenu.insertIcons(context);
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override

@ -0,0 +1,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M19.47,9.16c-1.1,-2.87 -3.8,-4.95 -7.01,-5.14l2,4.71 5.01,0.43zM11.54,4.02c-3.22,0.18 -5.92,2.27 -7.02,5.15l5.02,-0.43 2,-4.72zM4.23,10.14C4.08,10.74 4,11.36 4,12c0,2.48 1.14,4.7 2.91,6.17l1.11,-4.75 -3.79,-3.28zM19.77,10.13l-3.79,3.28 1.1,4.76C18.86,16.7 20,14.48 20,12c0,-0.64 -0.09,-1.27 -0.23,-1.87zM7.84,18.82c1.21,0.74 2.63,1.18 4.15,1.18 1.53,0 2.95,-0.44 4.17,-1.18L12,16.31l-4.16,2.51z"
android:strokeAlpha="0.3"
android:fillAlpha="0.3"/>
<path
android:fillColor="@android:color/white"
android:pathData="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM19.47,9.16l-5.01,-0.43 -2,-4.71c3.21,0.19 5.91,2.27 7.01,5.14zM12,8.06l1.09,2.56 2.78,0.24 -2.11,1.83 0.63,2.73L12,13.98l-2.39,1.44 0.63,-2.72 -2.11,-1.83 2.78,-0.24L12,8.06zM11.54,4.02l-2,4.72 -5.02,0.43c1.1,-2.88 3.8,-4.97 7.02,-5.15zM4,12c0,-0.64 0.08,-1.26 0.23,-1.86l3.79,3.28 -1.11,4.75C5.14,16.7 4,14.48 4,12zM11.99,20c-1.52,0 -2.94,-0.44 -4.15,-1.18L12,16.31l4.16,2.51c-1.22,0.74 -2.64,1.18 -4.17,1.18zM17.09,18.17l-1.1,-4.76 3.79,-3.28c0.13,0.6 0.22,1.23 0.22,1.87 0,2.48 -1.14,4.7 -2.91,6.17z"/>
</vector>
Loading…
Cancel
Save