diff --git a/app/src/main/java/awais/instagrabber/customviews/PostsRecyclerView.java b/app/src/main/java/awais/instagrabber/customviews/PostsRecyclerView.java index e5771537..be5c2591 100644 --- a/app/src/main/java/awais/instagrabber/customviews/PostsRecyclerView.java +++ b/app/src/main/java/awais/instagrabber/customviews/PostsRecyclerView.java @@ -183,11 +183,13 @@ public class PostsRecyclerView extends RecyclerView { private void initSelf() { feedViewModel = new ViewModelProvider(viewModelStoreOwner).get(FeedViewModel.class); - feedViewModel.getList().observe(lifeCycleOwner, list -> feedAdapter.submitList(list, () -> { - if (!shouldScrollToTop) return; - smoothScrollToPosition(0); - shouldScrollToTop = false; - })); + feedViewModel.getList().observe(lifeCycleOwner, list -> { + if (list.size() > 0) feedAdapter.submitList(list, () -> { + if (!shouldScrollToTop) return; + smoothScrollToPosition(0); + shouldScrollToTop = false; + }); + }); postFetcher = new PostFetcher(postFetchService, fetchListener); if (layoutPreferences.getHasGap()) { addItemDecoration(gridSpacingItemDecoration); diff --git a/app/src/main/java/awais/instagrabber/fragments/LocationFragment.java b/app/src/main/java/awais/instagrabber/fragments/LocationFragment.java index 55ba2b11..3a0007dc 100644 --- a/app/src/main/java/awais/instagrabber/fragments/LocationFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/LocationFragment.java @@ -510,7 +510,7 @@ public class LocationFragment extends Fragment implements SwipeRefreshLayout.OnR public void onSuccess(final Void result) { locationDetailsBinding.favChip.setText(R.string.favorite_short); locationDetailsBinding.favChip.setChipIconResource(R.drawable.ic_star_check_24); - showSnackbar(getString(R.string.added_to_favs)); + showSnackbar(getString(R.string.added_to_favs_short)); } @Override diff --git a/app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.java b/app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.java index b5b0061e..900537c8 100644 --- a/app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.java @@ -711,6 +711,8 @@ public class StoryViewerFragment extends Fragment { @Override public void onFailure(final Throwable t) { + final Context context = getContext(); + Toast.makeText(context, t.getMessage(), Toast.LENGTH_SHORT).show(); Log.e(TAG, "Error", t); } }); @@ -734,6 +736,8 @@ public class StoryViewerFragment extends Fragment { @Override public void onFailure(final Throwable t) { + final Context context = getContext(); + Toast.makeText(context, t.getMessage(), Toast.LENGTH_SHORT).show(); Log.e(TAG, "Error", t); } }; diff --git a/app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java b/app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java index 82c72607..834e9efd 100644 --- a/app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java @@ -581,7 +581,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe @Override public void onSuccess(final Favorite result) { profileDetailsBinding.favChip.setChipIconResource(R.drawable.ic_star_check_24); - profileDetailsBinding.favChip.setText(R.string.added_to_favs); + profileDetailsBinding.favChip.setText(R.string.added_to_favs_short); favoriteRepository.insertOrUpdateFavorite(new Favorite( result.getId(), profileModel.getUsername(),