1
0
Fork 0
mirror of https://github.com/KokaKiwi/BarInsta synced 2026-03-04 03:21:36 +00:00
This commit is contained in:
Austin Huang 2020-12-22 17:23:48 -05:00
parent 3261bc5987
commit a67b867e1b
No known key found for this signature in database
GPG key ID: 84C23AA04587A91F
5 changed files with 39 additions and 31 deletions

View file

@ -410,9 +410,12 @@ public class HashTagFragment extends Fragment implements SwipeRefreshLayout.OnRe
hashtagDetailsBinding.btnFollowTag.setClickable(true);
if (!result) {
Log.e(TAG, "onSuccess: result is false");
Snackbar.make(root, R.string.downloader_unknown_error, BaseTransientBottomBar.LENGTH_LONG)
.show();
return;
}
onRefresh();
hashtagDetailsBinding.btnFollowTag.setText(R.string.unfollow);
hashtagDetailsBinding.btnFollowTag.setChipIconResource(R.drawable.ic_outline_person_add_disabled_24);
}
@Override
@ -435,9 +438,12 @@ public class HashTagFragment extends Fragment implements SwipeRefreshLayout.OnRe
hashtagDetailsBinding.btnFollowTag.setClickable(true);
if (!result) {
Log.e(TAG, "onSuccess: result is false");
Snackbar.make(root, R.string.downloader_unknown_error, BaseTransientBottomBar.LENGTH_LONG)
.show();
return;
}
onRefresh();
hashtagDetailsBinding.btnFollowTag.setText(R.string.follow);
hashtagDetailsBinding.btnFollowTag.setChipIconResource(R.drawable.ic_outline_person_add_24);
}
@Override
@ -462,8 +468,6 @@ public class HashTagFragment extends Fragment implements SwipeRefreshLayout.OnRe
favoriteRepository.getFavorite(hashtag.substring(1), FavoriteType.HASHTAG, new RepositoryCallback<Favorite>() {
@Override
public void onSuccess(final Favorite result) {
hashtagDetailsBinding.favChip.setChipIconResource(R.drawable.ic_star_check_24);
hashtagDetailsBinding.favChip.setText(R.string.favorite_short);
favoriteRepository.insertOrUpdateFavorite(new Favorite(
result.getId(),
hashtag.substring(1),
@ -473,7 +477,10 @@ public class HashTagFragment extends Fragment implements SwipeRefreshLayout.OnRe
result.getDateAdded()
), new RepositoryCallback<Void>() {
@Override
public void onSuccess(final Void result) {}
public void onSuccess(final Void result) {
hashtagDetailsBinding.favChip.setChipIconResource(R.drawable.ic_star_check_24);
hashtagDetailsBinding.favChip.setText(R.string.favorite_short);
}
@Override
public void onDataNotAvailable() {}

View file

@ -536,11 +536,14 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
});
binding.like.setOnLongClickListener(v -> {
final NavController navController = getNavController();
if (navController != null) {
if (navController != null && isLoggedIn) {
final Bundle bundle = new Bundle();
bundle.putString("postId", feedModel.getPostId());
navController.navigate(R.id.action_global_likesViewerFragment, bundle);
}
else {
Utils.displayToastAboveView(context, v, getString(R.string.like_without_count));
}
return true;
});
}