Hide flag menus if flags disabled

pull/194/merge
M66B 3 years ago
parent 2a5bf1dae7
commit dc5aa24b24

@ -1672,7 +1672,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
flags_background && flagged && !expanded
? ColorUtils.setAlphaComponent(color, 127) : Color.TRANSPARENT);
if (flags)
if (flags || message.ui_flagged)
ibFlagged.setVisibility(message.folderReadOnly ? View.INVISIBLE : View.VISIBLE);
else
ibFlagged.setVisibility(View.GONE);
@ -4650,6 +4650,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
.setIcon(message.ui_snoozed == null ? R.drawable.twotone_visibility_off_24 : R.drawable.twotone_visibility_24);
popupMenu.getMenu().findItem(R.id.menu_flag_color)
.setVisible(flags_background)
.setEnabled((message.uid != null && !message.folderReadOnly) ||
message.accountProtocol != EntityAccount.TYPE_IMAP);

@ -3123,6 +3123,10 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
long[] ids = args.getLongArray("ids");
final Context context = getContext();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean flags = prefs.getBoolean("flags", true);
boolean flags_background = prefs.getBoolean("flags_background", false);
PopupMenuLifecycle popupMenu = new PopupMenuLifecycle(context, getViewLifecycleOwner(), fabMore);
int order = 0;
@ -3144,13 +3148,13 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
popupMenu.getMenu().add(Menu.NONE, R.string.title_unhide, order++, R.string.title_unhide)
.setIcon(R.drawable.twotone_visibility_24);
if (result.unflagged)
if (result.unflagged && flags)
popupMenu.getMenu().add(Menu.NONE, R.string.title_flag, order++, R.string.title_flag)
.setIcon(R.drawable.twotone_star_24);
if (result.flagged)
if (result.flagged && flags)
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)
if ((result.unflagged || result.flagged) && flags_background)
popupMenu.getMenu().add(Menu.NONE, R.string.title_flag_color, order++, R.string.title_flag_color)
.setIcon(R.drawable.twotone_auto_awesome_24);

Loading…
Cancel
Save