From d4ee1b9f4217d33cc787697fc5c3435f6ac7946f Mon Sep 17 00:00:00 2001 From: Ammar Githam Date: Wed, 14 Apr 2021 20:23:42 +0900 Subject: [PATCH] Set click listener on parent view. Fixes https://github.com/austinhuang0131/barinsta/issues/1055 --- .../adapters/viewholder/feed/FeedItemViewHolder.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/awais/instagrabber/adapters/viewholder/feed/FeedItemViewHolder.java b/app/src/main/java/awais/instagrabber/adapters/viewholder/feed/FeedItemViewHolder.java index 860bd027..042264c9 100644 --- a/app/src/main/java/awais/instagrabber/adapters/viewholder/feed/FeedItemViewHolder.java +++ b/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) { final long commentsCount = feedModel.getCommentCount(); 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) { @@ -75,6 +75,7 @@ public abstract class FeedItemViewHolder extends RecyclerView.ViewHolder { // final SpannableString spannableString = new SpannableString(); // spannableString.setSpan(new CommentMentionClickSpan(), 0, titleLen, 0); final User user = media.getUser(); + if (user == null) return; final String title = "@" + user.getUsername(); topBinding.title.setText(title); 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( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT )); - } - else { + } else { final String locationName = location.getName(); if (TextUtils.isEmpty(locationName)) { topBinding.location.setVisibility(View.GONE);