From 3242fdc7efc4202c4fa26997b48dcfb364c91071 Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Tue, 29 Dec 2020 18:17:54 -0500 Subject: [PATCH] menu button amelioration --- .../java/awais/instagrabber/fragments/main/FeedFragment.java | 4 ++++ app/src/main/res/menu/feed_menu.xml | 1 + 2 files changed, 5 insertions(+) diff --git a/app/src/main/java/awais/instagrabber/fragments/main/FeedFragment.java b/app/src/main/java/awais/instagrabber/fragments/main/FeedFragment.java index 5992e17d..0544f395 100644 --- a/app/src/main/java/awais/instagrabber/fragments/main/FeedFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/main/FeedFragment.java @@ -77,6 +77,7 @@ public class FeedFragment extends Fragment implements SwipeRefreshLayout.OnRefre private int downloadChildPosition = -1; private PostsLayoutPreferences layoutPreferences = Utils.getPostsLayoutPreferences(Constants.PREF_POSTS_LAYOUT); private RecyclerView storiesRecyclerView; + private MenuItem storyListMenu; public static List feedStories; @@ -277,6 +278,7 @@ public class FeedFragment extends Fragment implements SwipeRefreshLayout.OnRefre @Override public void onCreateOptionsMenu(@NonNull final Menu menu, @NonNull final MenuInflater inflater) { inflater.inflate(R.menu.feed_menu, menu); + storyListMenu = menu.findItem(R.id.storyList); } @Override @@ -396,12 +398,14 @@ public class FeedFragment extends Fragment implements SwipeRefreshLayout.OnRefre final String cookie = settingsHelper.getString(Constants.COOKIE); storiesFetching = true; updateSwipeRefreshState(); + storyListMenu.setVisible(false); storiesService.getFeedStories(CookieUtils.getCsrfTokenFromCookie(cookie), new ServiceCallback>() { @Override public void onSuccess(final List result) { feedStoriesViewModel.getList().postValue(result); feedStories = result; storiesFetching = false; + storyListMenu.setVisible(true); updateSwipeRefreshState(); } diff --git a/app/src/main/res/menu/feed_menu.xml b/app/src/main/res/menu/feed_menu.xml index db67ad61..3fe7bbd4 100644 --- a/app/src/main/res/menu/feed_menu.xml +++ b/app/src/main/res/menu/feed_menu.xml @@ -5,6 +5,7 @@ android:id="@+id/storyList" android:icon="@drawable/ic_story_list" android:title="@string/feed_stories" + android:visible="false" app:showAsAction="always" />