Browse Source

Set click listener on parent view. Fixes https://github.com/austinhuang0131/barinsta/issues/1055

renovate/org.robolectric-robolectric-4.x
Ammar Githam 4 years ago
parent
commit
d4ee1b9f42
  1. 6
      app/src/main/java/awais/instagrabber/adapters/viewholder/feed/FeedItemViewHolder.java

6
app/src/main/java/awais/instagrabber/adapters/viewholder/feed/FeedItemViewHolder.java

@ -55,7 +55,7 @@ public abstract class FeedItemViewHolder extends RecyclerView.ViewHolder {
private void setupComments(@NonNull final Media feedModel) { private void setupComments(@NonNull final Media feedModel) {
final long commentsCount = feedModel.getCommentCount(); final long commentsCount = feedModel.getCommentCount();
bottomBinding.commentsCount.setText(String.valueOf(commentsCount)); bottomBinding.commentsCount.setText(String.valueOf(commentsCount));
bottomBinding.commentsCount.setOnClickListener(v -> feedItemCallback.onCommentsClick(feedModel));
bottomBinding.btnComments.setOnClickListener(v -> feedItemCallback.onCommentsClick(feedModel));
} }
private void setupProfilePic(@NonNull final Media media) { private void setupProfilePic(@NonNull final Media media) {
@ -75,6 +75,7 @@ public abstract class FeedItemViewHolder extends RecyclerView.ViewHolder {
// final SpannableString spannableString = new SpannableString(); // final SpannableString spannableString = new SpannableString();
// spannableString.setSpan(new CommentMentionClickSpan(), 0, titleLen, 0); // spannableString.setSpan(new CommentMentionClickSpan(), 0, titleLen, 0);
final User user = media.getUser(); final User user = media.getUser();
if (user == null) return;
final String title = "@" + user.getUsername(); final String title = "@" + user.getUsername();
topBinding.title.setText(title); topBinding.title.setText(title);
topBinding.title.setOnClickListener(v -> feedItemCallback.onNameClick(media, topBinding.ivProfilePic)); topBinding.title.setOnClickListener(v -> feedItemCallback.onNameClick(media, topBinding.ivProfilePic));
@ -120,8 +121,7 @@ public abstract class FeedItemViewHolder extends RecyclerView.ViewHolder {
topBinding.title.setLayoutParams(new RelativeLayout.LayoutParams( topBinding.title.setLayoutParams(new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT
)); ));
}
else {
} else {
final String locationName = location.getName(); final String locationName = location.getName();
if (TextUtils.isEmpty(locationName)) { if (TextUtils.isEmpty(locationName)) {
topBinding.location.setVisibility(View.GONE); topBinding.location.setVisibility(View.GONE);

Loading…
Cancel
Save