Browse Source

menu item stuff

renovate/org.robolectric-robolectric-4.x
Austin Huang 4 years ago
parent
commit
3883c4153c
No known key found for this signature in database GPG Key ID: 84C23AA04587A91F
  1. 5
      app/src/main/java/awais/instagrabber/fragments/main/FeedFragment.java

5
app/src/main/java/awais/instagrabber/fragments/main/FeedFragment.java

@ -279,6 +279,7 @@ public class FeedFragment extends Fragment implements SwipeRefreshLayout.OnRefre
public void onCreateOptionsMenu(@NonNull final Menu menu, @NonNull final MenuInflater inflater) { public void onCreateOptionsMenu(@NonNull final Menu menu, @NonNull final MenuInflater inflater) {
inflater.inflate(R.menu.feed_menu, menu); inflater.inflate(R.menu.feed_menu, menu);
storyListMenu = menu.findItem(R.id.storyList); storyListMenu = menu.findItem(R.id.storyList);
storyListMenu.setVisible(!storiesFetching);
} }
@Override @Override
@ -361,6 +362,7 @@ public class FeedFragment extends Fragment implements SwipeRefreshLayout.OnRefre
} }
private void setupFeedStories() { private void setupFeedStories() {
if (storyListMenu != null) storyListMenu.setVisible(false);
feedStoriesViewModel = new ViewModelProvider(fragmentActivity).get(FeedStoriesViewModel.class); feedStoriesViewModel = new ViewModelProvider(fragmentActivity).get(FeedStoriesViewModel.class);
final FeedStoriesAdapter feedStoriesAdapter = new FeedStoriesAdapter( final FeedStoriesAdapter feedStoriesAdapter = new FeedStoriesAdapter(
new FeedStoriesAdapter.OnFeedStoryClickListener() { new FeedStoriesAdapter.OnFeedStoryClickListener() {
@ -398,14 +400,13 @@ public class FeedFragment extends Fragment implements SwipeRefreshLayout.OnRefre
final String cookie = settingsHelper.getString(Constants.COOKIE); final String cookie = settingsHelper.getString(Constants.COOKIE);
storiesFetching = true; storiesFetching = true;
updateSwipeRefreshState(); updateSwipeRefreshState();
storyListMenu.setVisible(false);
storiesService.getFeedStories(CookieUtils.getCsrfTokenFromCookie(cookie), new ServiceCallback<List<FeedStoryModel>>() { storiesService.getFeedStories(CookieUtils.getCsrfTokenFromCookie(cookie), new ServiceCallback<List<FeedStoryModel>>() {
@Override @Override
public void onSuccess(final List<FeedStoryModel> result) { public void onSuccess(final List<FeedStoryModel> result) {
feedStoriesViewModel.getList().postValue(result); feedStoriesViewModel.getList().postValue(result);
feedStories = result; feedStories = result;
storiesFetching = false; storiesFetching = false;
storyListMenu.setVisible(true);
if (storyListMenu != null) storyListMenu.setVisible(true);
updateSwipeRefreshState(); updateSwipeRefreshState();
} }

Loading…
Cancel
Save