mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-22 22:57:29 +00:00
close #489
This commit is contained in:
parent
c52a000255
commit
b790f85d6e
@ -183,11 +183,13 @@ public class PostsRecyclerView extends RecyclerView {
|
|||||||
|
|
||||||
private void initSelf() {
|
private void initSelf() {
|
||||||
feedViewModel = new ViewModelProvider(viewModelStoreOwner).get(FeedViewModel.class);
|
feedViewModel = new ViewModelProvider(viewModelStoreOwner).get(FeedViewModel.class);
|
||||||
feedViewModel.getList().observe(lifeCycleOwner, list -> feedAdapter.submitList(list, () -> {
|
feedViewModel.getList().observe(lifeCycleOwner, list -> {
|
||||||
if (!shouldScrollToTop) return;
|
if (list.size() > 0) feedAdapter.submitList(list, () -> {
|
||||||
smoothScrollToPosition(0);
|
if (!shouldScrollToTop) return;
|
||||||
shouldScrollToTop = false;
|
smoothScrollToPosition(0);
|
||||||
}));
|
shouldScrollToTop = false;
|
||||||
|
});
|
||||||
|
});
|
||||||
postFetcher = new PostFetcher(postFetchService, fetchListener);
|
postFetcher = new PostFetcher(postFetchService, fetchListener);
|
||||||
if (layoutPreferences.getHasGap()) {
|
if (layoutPreferences.getHasGap()) {
|
||||||
addItemDecoration(gridSpacingItemDecoration);
|
addItemDecoration(gridSpacingItemDecoration);
|
||||||
|
@ -510,7 +510,7 @@ public class LocationFragment extends Fragment implements SwipeRefreshLayout.OnR
|
|||||||
public void onSuccess(final Void result) {
|
public void onSuccess(final Void result) {
|
||||||
locationDetailsBinding.favChip.setText(R.string.favorite_short);
|
locationDetailsBinding.favChip.setText(R.string.favorite_short);
|
||||||
locationDetailsBinding.favChip.setChipIconResource(R.drawable.ic_star_check_24);
|
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
|
@Override
|
||||||
|
@ -711,6 +711,8 @@ public class StoryViewerFragment extends Fragment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(final Throwable t) {
|
public void onFailure(final Throwable t) {
|
||||||
|
final Context context = getContext();
|
||||||
|
Toast.makeText(context, t.getMessage(), Toast.LENGTH_SHORT).show();
|
||||||
Log.e(TAG, "Error", t);
|
Log.e(TAG, "Error", t);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -734,6 +736,8 @@ public class StoryViewerFragment extends Fragment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(final Throwable t) {
|
public void onFailure(final Throwable t) {
|
||||||
|
final Context context = getContext();
|
||||||
|
Toast.makeText(context, t.getMessage(), Toast.LENGTH_SHORT).show();
|
||||||
Log.e(TAG, "Error", t);
|
Log.e(TAG, "Error", t);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -581,7 +581,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
|||||||
@Override
|
@Override
|
||||||
public void onSuccess(final Favorite result) {
|
public void onSuccess(final Favorite result) {
|
||||||
profileDetailsBinding.favChip.setChipIconResource(R.drawable.ic_star_check_24);
|
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(
|
favoriteRepository.insertOrUpdateFavorite(new Favorite(
|
||||||
result.getId(),
|
result.getId(),
|
||||||
profileModel.getUsername(),
|
profileModel.getUsername(),
|
||||||
|
Loading…
Reference in New Issue
Block a user