1
0
mirror of https://github.com/moparisthebest/k-9 synced 2025-01-31 15:20:09 -05:00

Disable the 'Add Cc/Bcc' menu option when both fields are visible

This commit is contained in:
cketti 2012-08-10 02:31:55 +02:00
parent ff6bae0eef
commit 1ff3b6b88f

View File

@ -2175,18 +2175,20 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
* Show the menu items "Add attachment (Image)" and "Add attachment (Video)" * Show the menu items "Add attachment (Image)" and "Add attachment (Video)"
* if the work-around for the Gallery bug is enabled (see Issue 1186). * if the work-around for the Gallery bug is enabled (see Issue 1186).
*/ */
int found = 0; menu.findItem(R.id.add_attachment_image).setVisible(K9.useGalleryBugWorkaround());
for (int i = menu.size() - 1; i >= 0; i--) { menu.findItem(R.id.add_attachment_video).setVisible(K9.useGalleryBugWorkaround());
MenuItem item = menu.getItem(i);
int id = item.getItemId(); return true;
if ((id == R.id.add_attachment_image) ||
(id == R.id.add_attachment_video)) {
item.setVisible(K9.useGalleryBugWorkaround());
found++;
} }
// We found all the menu items we were looking for. So stop here. @Override
if (found == 2) break; public boolean onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
// Disable the 'Add Cc/Bcc' menu option when both fields are visible
if (mCcWrapper.getVisibility() == View.VISIBLE &&
mBccWrapper.getVisibility() == View.VISIBLE) {
menu.findItem(R.id.add_cc_bcc).setEnabled(false);
} }
return true; return true;