@UiThread void setLikeBadgeToActivity() { addActivityLikeButton.setCompoundDrawablesWithIntrinsicBounds( getResources().getDrawable(R.drawable.branch_item_like_badge_active), null, null, null); likedUsersList.setVisibility(View.VISIBLE); LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); View userAvatarFrame = inflater.inflate(R.layout.branch_item_liked_user_frame, null); ImageView userAvatar = (ImageView) userAvatarFrame.findViewById(R.id.liked_user_avatar); // ImageLoader.getInstance().displayImage(me.getAvatar(), userAvatar, // CommonUtils.getSimpleImageOptions()); BookFusionApplication.setImagePicasso(me.getAvatar(), userAvatar); likedUsersList.addView( userAvatarFrame, new ViewGroup.LayoutParams( (int) (30 * getContext().getResources().getDisplayMetrics().density), (int) (30 * getContext().getResources().getDisplayMetrics().density))); List<SearchUsersResponseEntity> usersList = item.getLikedUsers(); usersList.add(me); item.getLikedUsers().add(me); item.setLikedBy(usersList.toArray(new SearchUsersResponseEntity[usersList.size()])); if (eventInitializer == 0) { BusProvider.getInstance().post(new AddLikeToBranchActivity(item.getId())); } else { BusProvider.getInstance().post(new AddLikeToMainActivity(item.getId())); } }
private void initLikedUsersView() { if (item.getLikedUsers().size() != 0) { likedUsersList.removeAllViews(); for (SearchUsersResponseEntity user : item.getLikedUsers()) { likedUsersList.setVisibility(View.VISIBLE); LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); View userAvatarFrame = inflater.inflate(R.layout.branch_item_liked_user_frame, null /*likedUsersList*/); ImageView userAvatar = (ImageView) userAvatarFrame.findViewById(R.id.liked_user_avatar); // ImageLoader.getInstance().displayImage(user.getAvatar(), userAvatar, // CommonUtils.getSimpleImageOptions()); BookFusionApplication.setImagePicasso(user.getAvatar(), userAvatar); likedUsersList.addView( userAvatarFrame, new ViewGroup.LayoutParams( (int) (30 * getContext().getResources().getDisplayMetrics().density), (int) (30 * getContext().getResources().getDisplayMetrics().density))); } } else { likedUsersList.setVisibility(View.GONE); } }