Hide menu items while fragment is loading

fixes #471
This commit is contained in:
daniel oeh 2014-07-15 01:14:55 +02:00
parent 99d68b2982
commit c88ee27baa
5 changed files with 8 additions and 8 deletions

View File

@ -164,7 +164,7 @@ public class ItemlistFragment extends ListFragment {
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater); super.onCreateOptionsMenu(menu, inflater);
if (!MenuItemUtils.isActivityDrawerOpen((NavDrawerActivity) getActivity())) { if (itemsLoaded && !MenuItemUtils.isActivityDrawerOpen((NavDrawerActivity) getActivity())) {
FeedMenuHandler.onCreateOptionsMenu(inflater, menu); FeedMenuHandler.onCreateOptionsMenu(inflater, menu);
final SearchView sv = new SearchView(getActivity()); final SearchView sv = new SearchView(getActivity());
@ -190,7 +190,7 @@ public class ItemlistFragment extends ListFragment {
@Override @Override
public void onPrepareOptionsMenu(Menu menu) { public void onPrepareOptionsMenu(Menu menu) {
if (!MenuItemUtils.isActivityDrawerOpen((NavDrawerActivity) getActivity())) { if (itemsLoaded && !MenuItemUtils.isActivityDrawerOpen((NavDrawerActivity) getActivity())) {
FeedMenuHandler.onPrepareOptionsMenu(menu, feed); FeedMenuHandler.onPrepareOptionsMenu(menu, feed);
} }
} }

View File

@ -139,7 +139,7 @@ public class NewEpisodesFragment extends Fragment {
@Override @Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater); super.onCreateOptionsMenu(menu, inflater);
if (!MenuItemUtils.isActivityDrawerOpen((NavDrawerActivity) getActivity())) { if (itemsLoaded && !MenuItemUtils.isActivityDrawerOpen((NavDrawerActivity) getActivity())) {
inflater.inflate(R.menu.new_episodes, menu); inflater.inflate(R.menu.new_episodes, menu);
final SearchView sv = new SearchView(getActivity()); final SearchView sv = new SearchView(getActivity());
@ -164,7 +164,7 @@ public class NewEpisodesFragment extends Fragment {
@Override @Override
public void onPrepareOptionsMenu(Menu menu) { public void onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu); super.onPrepareOptionsMenu(menu);
if (!MenuItemUtils.isActivityDrawerOpen((NavDrawerActivity) getActivity())) { if (itemsLoaded && !MenuItemUtils.isActivityDrawerOpen((NavDrawerActivity) getActivity())) {
menu.findItem(R.id.mark_all_read_item).setVisible(unreadItems != null && !unreadItems.isEmpty()); menu.findItem(R.id.mark_all_read_item).setVisible(unreadItems != null && !unreadItems.isEmpty());
menu.findItem(R.id.episode_filter_item).setChecked(showOnlyNewEpisodes); menu.findItem(R.id.episode_filter_item).setChecked(showOnlyNewEpisodes);
} }

View File

@ -131,7 +131,7 @@ public class PlaybackHistoryFragment extends ListFragment {
@Override @Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater); super.onCreateOptionsMenu(menu, inflater);
if (!MenuItemUtils.isActivityDrawerOpen((NavDrawerActivity) getActivity())) { if (itemsLoaded && !MenuItemUtils.isActivityDrawerOpen((NavDrawerActivity) getActivity())) {
MenuItem clearHistory = menu.add(Menu.NONE, R.id.clear_history_item, Menu.CATEGORY_CONTAINER, R.string.clear_history_label); MenuItem clearHistory = menu.add(Menu.NONE, R.id.clear_history_item, Menu.CATEGORY_CONTAINER, R.string.clear_history_label);
MenuItemCompat.setShowAsAction(clearHistory, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM); MenuItemCompat.setShowAsAction(clearHistory, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
TypedArray drawables = getActivity().obtainStyledAttributes(new int[]{R.attr.content_discard}); TypedArray drawables = getActivity().obtainStyledAttributes(new int[]{R.attr.content_discard});
@ -143,7 +143,7 @@ public class PlaybackHistoryFragment extends ListFragment {
@Override @Override
public void onPrepareOptionsMenu(Menu menu) { public void onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu); super.onPrepareOptionsMenu(menu);
if (!MenuItemUtils.isActivityDrawerOpen((NavDrawerActivity) getActivity())) { if (itemsLoaded && !MenuItemUtils.isActivityDrawerOpen((NavDrawerActivity) getActivity())) {
menu.findItem(R.id.clear_history_item).setVisible(playbackHistory != null && !playbackHistory.isEmpty()); menu.findItem(R.id.clear_history_item).setVisible(playbackHistory != null && !playbackHistory.isEmpty());
} }
} }

View File

@ -137,7 +137,7 @@ public class QueueFragment extends Fragment {
@Override @Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater); super.onCreateOptionsMenu(menu, inflater);
if (!MenuItemUtils.isActivityDrawerOpen((NavDrawerActivity) getActivity())) { if (itemsLoaded && !MenuItemUtils.isActivityDrawerOpen((NavDrawerActivity) getActivity())) {
final SearchView sv = new SearchView(getActivity()); final SearchView sv = new SearchView(getActivity());
MenuItemUtils.addSearchItem(menu, sv); MenuItemUtils.addSearchItem(menu, sv);
sv.setQueryHint(getString(R.string.search_hint)); sv.setQueryHint(getString(R.string.search_hint));

View File

@ -133,7 +133,7 @@ public class SearchFragment extends ListFragment {
@Override @Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater); super.onCreateOptionsMenu(menu, inflater);
if (!MenuItemUtils.isActivityDrawerOpen((NavDrawerActivity) getActivity())) { if (itemsLoaded && !MenuItemUtils.isActivityDrawerOpen((NavDrawerActivity) getActivity())) {
MenuItem item = menu.add(Menu.NONE, R.id.search_item, Menu.NONE, R.string.search_label); MenuItem item = menu.add(Menu.NONE, R.id.search_item, Menu.NONE, R.string.search_label);
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM); MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
final SearchView sv = new SearchView(getActivity()); final SearchView sv = new SearchView(getActivity());