Fixed menu item visibility

This commit is contained in:
daniel oeh 2013-10-19 18:28:38 +02:00
parent ddaf1adfe8
commit 3c61058d07
4 changed files with 15 additions and 22 deletions

View File

@ -111,26 +111,18 @@ public class FeedInfoActivity extends ActionBarActivity {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
if (feed != null) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.feedinfo, menu);
return true;
} else {
return false;
}
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.feedinfo, menu);
return true;
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
if (feed != null) {
menu.findItem(R.id.support_item).setVisible(
feed.getPaymentLink() != null);
menu.findItem(R.id.share_link_item).setVisible(feed.getLink() != null);
return true;
} else {
return false;
}
feed != null && feed.getPaymentLink() != null);
menu.findItem(R.id.share_link_item).setVisible(feed != null &&feed.getLink() != null);
return true;
}
@Override

View File

@ -152,11 +152,10 @@ public class FeedItemlistActivity extends ActionBarActivity {
searchView.setSearchableInfo(
searchManager.getSearchableInfo(getComponentName()));
return FeedMenuHandler
FeedMenuHandler
.onCreateOptionsMenu(getMenuInflater(), menu);
} else {
return false;
}
return true;
}
@Override

View File

@ -146,14 +146,15 @@ public class ItemviewActivity extends ActionBarActivity {
if (item != null) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.feeditem, menu);
return true;
} else {
return false;
}
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
if (item == null) {
return false;
}
try {
if (!FeedItemMenuHandler.onMenuItemClicked(this,
menuItem.getItemId(), item)) {
@ -175,7 +176,7 @@ public class ItemviewActivity extends ActionBarActivity {
@Override
public boolean onPrepareOptionsMenu(final Menu menu) {
super.onPrepareOptionsMenu(menu);
return FeedItemMenuHandler.onPrepareMenu(
FeedItemMenuHandler.onPrepareMenu(
new FeedItemMenuHandler.MenuInterface() {
@Override
@ -183,6 +184,7 @@ public class ItemviewActivity extends ActionBarActivity {
menu.findItem(id).setVisible(visible);
}
}, item, true, QueueAccess.NotInQueueAccess());
return true;
}
private EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {

View File

@ -31,7 +31,7 @@ public class FeedMenuHandler {
public static boolean onPrepareOptionsMenu(Menu menu, Feed selectedFeed) {
if (selectedFeed == null) {
return false;
return true;
}
if (AppConfig.DEBUG)