@Override public void onBindViewHolder(final ViewHolder holder, int position) { HHFriendshipUser friendship = user.getFriendships().get(position); holder.position = position; holder.btnFollowOnClickListener.setFriendship(friendship); holder.btnUnfollowOnClickListener.setFriendship(friendship); holder.txtUserName.setText(friendship.getUser().getName()); holder.onClickUserListener.setUser(friendship.getUser()); boolean friendIsFollowed = HHUser.userIsFollowed(user, friendship.getUser()); boolean friendFollowsMe = HHUser.userFollowsMe(user, friendship.getUser()); boolean friendIsRequested = HHUser.userIsRequested(user, friendship.getUser()); // boolean userRequestedMe = HHUser.userRequestedMe(user, friendship.getUser()); if (friendIsFollowed) { holder.btnFollow.setVisibility(View.GONE); holder.btnUnfollow.setVisibility(View.VISIBLE); } else { holder.btnFollow.setVisibility(View.VISIBLE); holder.btnFollow.setEnabled(true); holder.btnFollow.clearColorFilter(); holder.btnUnfollow.setVisibility(View.GONE); } if (friendIsRequested) { holder.btnFollow.setColorFilter( ZZZUtility.screen(ContextCompat.getColor(context, R.color.adam_theme_darkest))); holder.btnFollow.setEnabled(false); } if (friendIsFollowed && friendFollowsMe) { holder.imgFollowStatus.setImageResource(R.drawable.follow_in_out); } else if (friendIsFollowed) { holder.imgFollowStatus.setImageResource(R.drawable.follow_out); } else if (friendFollowsMe) { holder.imgFollowStatus.setImageResource(R.drawable.follow_in); } else { holder.imgFollowStatus.setImageResource(R.drawable.follow_none); } // get User Image WebHelper.getFacebookProfilePicture( friendship.getUser().getFBUserID(), new WebHelper.GetFacebookProfilePictureCallback() { @Override public void returnFacebookProfilePicture(Bitmap bitmap) { holder.imgProfile.setImageBitmap(bitmap); } }); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setHasOptionsMenu(true); currentUser = HHUser.getCurrentUser(); }