@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()));
    }
  }
  public void bind(MessageEntity item) {

    //        ImageLoader imageLoader = BookFusionApplication_.getImageLoader();
    //        imageLoader.displayImage(item.getAvatar(), userAvatar,
    // CommonUtils.getDefaultImageOptions());
    BookFusionApplication.setImagePicasso(item.getAvatar(), userAvatar);

    messageText.setText(item.getText());

    createDate.setText(Const.parseDateToHHMMA(item.getCreatedAt()));

    if (item.isShow()) {
      btnDelete.setVisibility(View.VISIBLE);
    } else {
      btnDelete.setVisibility(View.GONE);
    }
  }
 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);
   }
 }
  public void bind(BranchResponseEntity item, SearchUsersResponseEntity me, int eventInitializer) {

    this.item = item;
    this.me = me;
    this.eventInitializer = eventInitializer;
    BranchUserActions action = BranchUserActions.findByName(item.getActionKey());
    String actionKey = action.getUserAction();
    ActivityRelatedInfo actionDescription;

    initLikedUsersView();

    if (actionKey.startsWith("ownership") || actionKey.startsWith("book_item_bookmark")) {
      bookInfoFrame.setVisibility(VISIBLE);
      bookInfoSection.setVisibility(VISIBLE);
      bookCommentSection.setVisibility(GONE);
      bookRateSection.setVisibility(GONE);
      if (item.getBook() != null) {
        //                ImageLoader.getInstance().displayImage(item.getBook().getCover(),
        // bookCover, CommonUtils.getSimpleImageOptions());
        BookFusionApplication.setImagePicasso(item.getBook().getCover(), bookCover);
        bookTitle.setText(item.getBook().getTitle());
        if (item.getBook().getRating() != null) {
          bookRating.setRating(Float.valueOf(item.getBook().getRating()));
        }
      }
      bookReadersCount.setText(String.valueOf(item.getComments().length) + " Readers"); // <-- fix

    } else if (actionKey.startsWith("book_comment")) {
      bookInfoFrame.setVisibility(VISIBLE);
      bookCommentSection.setVisibility(VISIBLE);
      bookInfoSection.setVisibility(VISIBLE);
      bookRateSection.setVisibility(GONE);
      if (item.getBook() != null) {
        //                ImageLoader.getInstance().displayImage(item.getBook().getCover(),
        // bookCover, CommonUtils.getSimpleImageOptions());
        BookFusionApplication.setImagePicasso(item.getBook().getCover(), bookCover);
      }

      actionDescription = item.getTrackable();
      if (actionDescription == null) {
        userBookComment.setText("");
      }
      //            try {
      //                if (actionDescription != null) {
      //                    JSONObject comments = actionDescription.getJsonObject();
      //                    String text = comments.getString("text");
      //                    userBookComment.setText(text);
      //                }
      //            } catch (JSONException e) {
      //                e.printStackTrace();
      //            }
    } else if (actionKey.startsWith("book_item_comment")) {
      bookInfoFrame.setVisibility(VISIBLE);
      bookCommentSection.setVisibility(VISIBLE);
      bookInfoSection.setVisibility(VISIBLE);
      bookRateSection.setVisibility(GONE);
      if (item.getBook() != null) {
        //                ImageLoader.getInstance().displayImage(item.getBook().getCover(),
        // bookCover, CommonUtils.getSimpleImageOptions());
        BookFusionApplication.setImagePicasso(item.getBook().getCover(), bookCover);
      }
      actionDescription = item.getTrackable();
      if (actionDescription != null) {
        BookCommentaries comments = actionDescription.getBookCommentaries();
        String text = comments.getText();
        userBookComment.setText(text);
      }
    } else if (actionKey.startsWith("book_rating")) {
      bookInfoFrame.setVisibility(VISIBLE);
      bookRateSection.setVisibility(VISIBLE);
      bookCommentSection.setVisibility(GONE);
      bookInfoSection.setVisibility(VISIBLE);
      if (item.getBook() != null) {
        //                ImageLoader.getInstance().displayImage(item.getBook().getCover(),
        // bookCover, CommonUtils.getSimpleImageOptions());
        BookFusionApplication.setImagePicasso(item.getBook().getCover(), bookCover);
      }

      //            JSONObject actionDescription = item.getTrackable();
      //            try {
      //                if (actionDescription != null) {
      //                    String text = actionDescription.getString("text");
      //                    userBookComment.setText(text);
      //
      // userBookRating.setRating(Float.valueOf(actionDescription.getString("rating")));
      //                }
      //            } catch (JSONException e) {
      //                e.printStackTrace();
      //            }
    } else if (actionKey.startsWith("take")) {
      bookInfoFrame.setVisibility(VISIBLE);
      bookCommentSection.setVisibility(View.VISIBLE);
      bookInfoSection.setVisibility(VISIBLE);
      bookRateSection.setVisibility(GONE);
      if (item.getBook() != null) {
        //                ImageLoader.getInstance().displayImage(item.getBook().getCover(),
        // bookCover, CommonUtils.getSimpleImageOptions());
        BookFusionApplication.setImagePicasso(item.getBook().getCover(), bookCover);
      }
      //            JSONObject actionDescription = item.getTrackable();
      //            try {
      //                if (actionDescription != null) {
      //                    String text = actionDescription.getString("text");
      //                    userBookComment.setText(text);
      //                }
      //            } catch (JSONException e) {
      //                e.printStackTrace();
      //            }
    } else if (actionKey.startsWith("user")) {
      bookInfoFrame.setVisibility(View.GONE);
    }

    if (item.getBook() != null) {
      switch (action) {
        case BOOK_ITEM_BOOKMARK_CREATED:
          {
            String ownerName = item.getOwner().getFullname();
            String bookTitle = item.getBook().getTitle();

            String fullStr = ownerName + " made bookmark for book " + bookTitle;

            SpannableString ss = new SpannableString(fullStr);
            ss.setSpan(
                new StyleSpan(Typeface.BOLD),
                fullStr.indexOf(ownerName),
                fullStr.indexOf(ownerName) + ownerName.length(),
                0);
            ss.setSpan(
                new ForegroundColorSpan(Color.parseColor("#2e3033")),
                fullStr.indexOf(ownerName),
                fullStr.indexOf(ownerName) + ownerName.length(),
                0);

            ss.setSpan(
                new StyleSpan(Typeface.BOLD),
                fullStr.indexOf(bookTitle),
                fullStr.indexOf(bookTitle) + bookTitle.length(),
                0);
            ss.setSpan(
                new ForegroundColorSpan(Color.parseColor("#2e3033")),
                fullStr.indexOf(bookTitle),
                fullStr.indexOf(bookTitle) + bookTitle.length(),
                0);

            userActionDescription.setText(ss);

            //                    userActionDescription.setText(Html.fromHtml(
            //                            "<b style='color:#000000;'>" +
            // item.getOwner().getFullname() + "</b>" +
            //                                    " made bookmark for book " +
            //                                    "<b>" + item.getBook().getTitle() + "</b>"
            //                    ));
          }

          break;
        case BOOK_ITEM_COMMENT_CREATED:
          {
            String ownerName = item.getOwner().getFullname();
            String bookTitle = item.getBook().getTitle();

            String fullStr = ownerName + " made highlight from book " + bookTitle;

            if (item.getTrackable() != null) {
              fullStr += "\n\"" + item.getTrackable().getBookCommentaries().getQuote() + "\"";
            }

            SpannableString ss = new SpannableString(fullStr);
            ss.setSpan(
                new StyleSpan(Typeface.BOLD),
                fullStr.indexOf(ownerName),
                fullStr.indexOf(ownerName) + ownerName.length(),
                0);
            ss.setSpan(
                new ForegroundColorSpan(Color.parseColor("#2e3033")),
                fullStr.indexOf(ownerName),
                fullStr.indexOf(ownerName) + ownerName.length(),
                0);

            ss.setSpan(
                new StyleSpan(Typeface.BOLD),
                fullStr.indexOf(bookTitle),
                fullStr.indexOf(bookTitle) + bookTitle.length(),
                0);
            ss.setSpan(
                new ForegroundColorSpan(Color.parseColor("#2e3033")),
                fullStr.indexOf(bookTitle),
                fullStr.indexOf(bookTitle) + bookTitle.length(),
                0);

            userActionDescription.setText(ss);
          }
          break;
        case BOOK_COMMENT_CREATED:
          {
            String ownerName = item.getOwner().getFullname();
            String bookTitle = item.getBook().getTitle();

            String fullStr = ownerName + " add comment to " + bookTitle;

            SpannableString ss = new SpannableString(fullStr);
            ss.setSpan(
                new StyleSpan(Typeface.BOLD),
                fullStr.indexOf(ownerName),
                fullStr.indexOf(ownerName) + ownerName.length(),
                0);
            ss.setSpan(
                new ForegroundColorSpan(Color.parseColor("#2e3033")),
                fullStr.indexOf(ownerName),
                fullStr.indexOf(ownerName) + ownerName.length(),
                0);

            ss.setSpan(
                new StyleSpan(Typeface.BOLD),
                fullStr.indexOf(bookTitle),
                fullStr.indexOf(bookTitle) + bookTitle.length(),
                0);
            ss.setSpan(
                new ForegroundColorSpan(Color.parseColor("#2e3033")),
                fullStr.indexOf(bookTitle),
                fullStr.indexOf(bookTitle) + bookTitle.length(),
                0);

            userActionDescription.setText(ss);
          }
          break;
        case BOOK_RATING_CREATED:
          {
            String ownerName = item.getOwner().getFullname();
            String bookTitle = item.getBook().getTitle();

            String fullStr = ownerName + " rated book " + bookTitle;

            SpannableString ss = new SpannableString(fullStr);
            ss.setSpan(
                new StyleSpan(Typeface.BOLD),
                fullStr.indexOf(ownerName),
                fullStr.indexOf(ownerName) + ownerName.length(),
                0);
            ss.setSpan(
                new ForegroundColorSpan(Color.parseColor("#2e3033")),
                fullStr.indexOf(ownerName),
                fullStr.indexOf(ownerName) + ownerName.length(),
                0);

            ss.setSpan(
                new StyleSpan(Typeface.BOLD),
                fullStr.indexOf(bookTitle),
                fullStr.indexOf(bookTitle) + bookTitle.length(),
                0);
            ss.setSpan(
                new ForegroundColorSpan(Color.parseColor("#2e3033")),
                fullStr.indexOf(bookTitle),
                fullStr.indexOf(bookTitle) + bookTitle.length(),
                0);

            userActionDescription.setText(ss);
          }
          break;
        case OWNERSHIP_BORROW_REQUEST:
          {
            String ownerName = item.getOwner().getFullname();
            String bookTitle = item.getBook().getTitle();
            String otherName = item.getRecipient().getFullname();

            String fullStr =
                ownerName + " sent request to borrow book " + bookTitle + " from " + otherName;

            SpannableString ss = new SpannableString(fullStr);
            ss.setSpan(
                new StyleSpan(Typeface.BOLD),
                fullStr.indexOf(ownerName),
                fullStr.indexOf(ownerName) + ownerName.length(),
                0);
            ss.setSpan(
                new ForegroundColorSpan(Color.parseColor("#2e3033")),
                fullStr.indexOf(ownerName),
                fullStr.indexOf(ownerName) + ownerName.length(),
                0);

            ss.setSpan(
                new StyleSpan(Typeface.BOLD),
                fullStr.indexOf(bookTitle),
                fullStr.indexOf(bookTitle) + bookTitle.length(),
                0);
            ss.setSpan(
                new ForegroundColorSpan(Color.parseColor("#2e3033")),
                fullStr.indexOf(bookTitle),
                fullStr.indexOf(bookTitle) + bookTitle.length(),
                0);

            ss.setSpan(
                new StyleSpan(Typeface.BOLD),
                fullStr.indexOf(otherName),
                fullStr.indexOf(otherName) + otherName.length(),
                0);
            ss.setSpan(
                new ForegroundColorSpan(Color.parseColor("#2e3033")),
                fullStr.indexOf(otherName),
                fullStr.indexOf(otherName) + otherName.length(),
                0);

            userActionDescription.setText(ss);
          }
          break;
        case OWNERSHIP_LENT:
          {
            String ownerName = item.getOwner().getFullname();
            String bookTitle = item.getBook().getTitle();
            String otherName = item.getRecipient().getFullname();

            String fullStr = ownerName + " lend book " + bookTitle + " to " + otherName;

            SpannableString ss = new SpannableString(fullStr);
            ss.setSpan(
                new StyleSpan(Typeface.BOLD),
                fullStr.indexOf(ownerName),
                fullStr.indexOf(ownerName) + ownerName.length(),
                0);
            ss.setSpan(
                new ForegroundColorSpan(Color.parseColor("#2e3033")),
                fullStr.indexOf(ownerName),
                fullStr.indexOf(ownerName) + ownerName.length(),
                0);

            ss.setSpan(
                new StyleSpan(Typeface.BOLD),
                fullStr.indexOf(bookTitle),
                fullStr.indexOf(bookTitle) + bookTitle.length(),
                0);
            ss.setSpan(
                new ForegroundColorSpan(Color.parseColor("#2e3033")),
                fullStr.indexOf(bookTitle),
                fullStr.indexOf(bookTitle) + bookTitle.length(),
                0);

            ss.setSpan(
                new StyleSpan(Typeface.BOLD),
                fullStr.indexOf(otherName),
                fullStr.indexOf(otherName) + otherName.length(),
                0);
            ss.setSpan(
                new ForegroundColorSpan(Color.parseColor("#2e3033")),
                fullStr.indexOf(otherName),
                fullStr.indexOf(otherName) + otherName.length(),
                0);

            userActionDescription.setText(ss);
          }
          break;
        case OWNERSHIP_READ_IN_PROGRESS:
          {
            String ownerName = item.getOwner().getFullname();
            String bookTitle = item.getBook().getTitle();

            String fullStr = ownerName + " currently reading " + bookTitle;

            SpannableString ss = new SpannableString(fullStr);
            ss.setSpan(
                new StyleSpan(Typeface.BOLD),
                fullStr.indexOf(ownerName),
                fullStr.indexOf(ownerName) + ownerName.length(),
                0);
            ss.setSpan(
                new ForegroundColorSpan(Color.parseColor("#2e3033")),
                fullStr.indexOf(ownerName),
                fullStr.indexOf(ownerName) + ownerName.length(),
                0);

            ss.setSpan(
                new StyleSpan(Typeface.BOLD),
                fullStr.indexOf(bookTitle),
                fullStr.indexOf(bookTitle) + bookTitle.length(),
                0);
            ss.setSpan(
                new ForegroundColorSpan(Color.parseColor("#2e3033")),
                fullStr.indexOf(bookTitle),
                fullStr.indexOf(bookTitle) + bookTitle.length(),
                0);

            userActionDescription.setText(ss);

            //                    userActionDescription.setText(Html.fromHtml(
            //                            "<b style='color:#000000;'>" +
            // item.getOwner().getFullname() + "</b>" +
            //                                    " currently reading " +
            //                                    "<b style='color:#000000;'>" +
            // item.getBook().getTitle() + "</b>"
            //                    ));
          }
          break;
        case OWNERSHIP_READING_FINISHED:
          {
            String ownerName = item.getOwner().getFullname();
            String bookTitle = item.getBook().getTitle();

            String fullStr = ownerName + " finished reading " + bookTitle;

            SpannableString ss = new SpannableString(fullStr);
            ss.setSpan(
                new StyleSpan(Typeface.BOLD),
                fullStr.indexOf(ownerName),
                fullStr.indexOf(ownerName) + ownerName.length(),
                0);
            ss.setSpan(
                new ForegroundColorSpan(Color.parseColor("#2e3033")),
                fullStr.indexOf(ownerName),
                fullStr.indexOf(ownerName) + ownerName.length(),
                0);

            ss.setSpan(
                new StyleSpan(Typeface.BOLD),
                fullStr.indexOf(bookTitle),
                fullStr.indexOf(bookTitle) + bookTitle.length(),
                0);
            ss.setSpan(
                new ForegroundColorSpan(Color.parseColor("#2e3033")),
                fullStr.indexOf(bookTitle),
                fullStr.indexOf(bookTitle) + bookTitle.length(),
                0);

            userActionDescription.setText(ss);
          }
          break;
        case OWNERSHIP_RETURNED:
          {
            String ownerName = item.getOwner().getFullname();
            String bookTitle;
            try {
              bookTitle = item.getBook().getTitle();
            } catch (Exception e) {
              bookTitle = "";
            }

            String otherName = item.getRecipient().getFullname();

            String fullStr = ownerName + " returned book " + bookTitle + " to " + otherName;

            SpannableString ss = new SpannableString(fullStr);
            ss.setSpan(
                new StyleSpan(Typeface.BOLD),
                fullStr.indexOf(ownerName),
                fullStr.indexOf(ownerName) + ownerName.length(),
                0);
            ss.setSpan(
                new ForegroundColorSpan(Color.parseColor("#2e3033")),
                fullStr.indexOf(ownerName),
                fullStr.indexOf(ownerName) + ownerName.length(),
                0);

            ss.setSpan(
                new StyleSpan(Typeface.BOLD),
                fullStr.indexOf(bookTitle),
                fullStr.indexOf(bookTitle) + bookTitle.length(),
                0);
            ss.setSpan(
                new ForegroundColorSpan(Color.parseColor("#2e3033")),
                fullStr.indexOf(bookTitle),
                fullStr.indexOf(bookTitle) + bookTitle.length(),
                0);

            ss.setSpan(
                new StyleSpan(Typeface.BOLD),
                fullStr.indexOf(otherName),
                fullStr.indexOf(otherName) + otherName.length(),
                0);
            ss.setSpan(
                new ForegroundColorSpan(Color.parseColor("#2e3033")),
                fullStr.indexOf(otherName),
                fullStr.indexOf(otherName) + otherName.length(),
                0);

            userActionDescription.setText(ss);
          }

          break;
        case OWNERSHIP_STARTED_TO_READ:
          {
            String ownerName = item.getOwner().getFullname();
            String bookTitle = item.getBook().getTitle();

            String fullStr = ownerName + " have started to read book " + bookTitle;

            SpannableString ss = new SpannableString(fullStr);
            ss.setSpan(
                new StyleSpan(Typeface.BOLD),
                fullStr.indexOf(ownerName),
                fullStr.indexOf(ownerName) + ownerName.length(),
                0);
            ss.setSpan(
                new ForegroundColorSpan(Color.parseColor("#2e3033")),
                fullStr.indexOf(ownerName),
                fullStr.indexOf(ownerName) + ownerName.length(),
                0);

            ss.setSpan(
                new StyleSpan(Typeface.BOLD),
                fullStr.indexOf(bookTitle),
                fullStr.indexOf(bookTitle) + bookTitle.length(),
                0);
            ss.setSpan(
                new ForegroundColorSpan(Color.parseColor("#2e3033")),
                fullStr.indexOf(bookTitle),
                fullStr.indexOf(bookTitle) + bookTitle.length(),
                0);

            userActionDescription.setText(ss);
          }

          break;
        case OWNERSHIP_UPLOADED:
          {
            String ownerName = item.getOwner().getFullname();
            String bookTitle = item.getBook().getTitle();

            String fullStr = ownerName + " uploaded book " + bookTitle;

            SpannableString ss = new SpannableString(fullStr);
            ss.setSpan(
                new StyleSpan(Typeface.BOLD),
                fullStr.indexOf(ownerName),
                fullStr.indexOf(ownerName) + ownerName.length(),
                0);
            ss.setSpan(
                new ForegroundColorSpan(Color.parseColor("#2e3033")),
                fullStr.indexOf(ownerName),
                fullStr.indexOf(ownerName) + ownerName.length(),
                0);

            ss.setSpan(
                new StyleSpan(Typeface.BOLD),
                fullStr.indexOf(bookTitle),
                fullStr.indexOf(bookTitle) + bookTitle.length(),
                0);
            ss.setSpan(
                new ForegroundColorSpan(Color.parseColor("#2e3033")),
                fullStr.indexOf(bookTitle),
                fullStr.indexOf(bookTitle) + bookTitle.length(),
                0);

            userActionDescription.setText(ss);
          }

          break;
        case TAKE_CREATED:
          {
            String ownerName = item.getOwner().getFullname();
            String bookTitle = item.getBook().getTitle();

            String fullStr = ownerName + " left his take about the book " + bookTitle;

            SpannableString ss = new SpannableString(fullStr);
            ss.setSpan(
                new StyleSpan(Typeface.BOLD),
                fullStr.indexOf(ownerName),
                fullStr.indexOf(ownerName) + ownerName.length(),
                0);
            ss.setSpan(
                new ForegroundColorSpan(Color.parseColor("#2e3033")),
                fullStr.indexOf(ownerName),
                fullStr.indexOf(ownerName) + ownerName.length(),
                0);

            ss.setSpan(
                new StyleSpan(Typeface.BOLD),
                fullStr.indexOf(bookTitle),
                fullStr.indexOf(bookTitle) + bookTitle.length(),
                0);
            ss.setSpan(
                new ForegroundColorSpan(Color.parseColor("#2e3033")),
                fullStr.indexOf(bookTitle),
                fullStr.indexOf(bookTitle) + bookTitle.length(),
                0);

            userActionDescription.setText(ss);
          }

          break;
        case USER_FOLLOWED:
          {
            String ownerName = item.getOwner().getFullname();
            String bookTitle = item.getBook().getTitle();

            String fullStr = ownerName + " followed " + bookTitle;

            SpannableString ss = new SpannableString(fullStr);
            ss.setSpan(
                new StyleSpan(Typeface.BOLD),
                fullStr.indexOf(ownerName),
                fullStr.indexOf(ownerName) + ownerName.length(),
                0);
            ss.setSpan(
                new ForegroundColorSpan(Color.parseColor("#2e3033")),
                fullStr.indexOf(ownerName),
                fullStr.indexOf(ownerName) + ownerName.length(),
                0);

            ss.setSpan(
                new StyleSpan(Typeface.BOLD),
                fullStr.indexOf(bookTitle),
                fullStr.indexOf(bookTitle) + bookTitle.length(),
                0);
            ss.setSpan(
                new ForegroundColorSpan(Color.parseColor("#2e3033")),
                fullStr.indexOf(bookTitle),
                fullStr.indexOf(bookTitle) + bookTitle.length(),
                0);

            userActionDescription.setText(ss);
          }

          break;
        case USER_LIKED:
          {
            String ownerName = item.getOwner().getFullname();
            String bookTitle = item.getBook().getTitle();

            String fullStr = ownerName + " liked " + bookTitle;

            SpannableString ss = new SpannableString(fullStr);
            ss.setSpan(
                new StyleSpan(Typeface.BOLD),
                fullStr.indexOf(ownerName),
                fullStr.indexOf(ownerName) + ownerName.length(),
                0);
            ss.setSpan(
                new ForegroundColorSpan(Color.parseColor("#2e3033")),
                fullStr.indexOf(ownerName),
                fullStr.indexOf(ownerName) + ownerName.length(),
                0);

            ss.setSpan(
                new StyleSpan(Typeface.BOLD),
                fullStr.indexOf(bookTitle),
                fullStr.indexOf(bookTitle) + bookTitle.length(),
                0);
            ss.setSpan(
                new ForegroundColorSpan(Color.parseColor("#2e3033")),
                fullStr.indexOf(bookTitle),
                fullStr.indexOf(bookTitle) + bookTitle.length(),
                0);

            userActionDescription.setText(ss);
          }

          break;
      }
    }

    userActionTime.setText(TimeUtils.getAdapterTimeString(item.getCreationDate()));
    //        ImageLoader.getInstance().displayImage(item.getOwner().getAvatar(), userAvatar,
    // CommonUtils.getSimpleImageOptions());
    BookFusionApplication.setImagePicasso(item.getOwner().getAvatar(), userAvatar);

    // badge
    switch (action) {
      case BOOK_COMMENT_CREATED:
        userBadge.setImageResource(R.drawable.action_highlight_badge);
        break;
      case BOOK_ITEM_COMMENT_CREATED:
        userBadge.setImageResource(R.drawable.action_comment_badge);
        break;
      case BOOK_ITEM_BOOKMARK_CREATED:
        userBadge.setImageResource(R.drawable.action_bookmark_badge);
        break;
      case BOOK_RATING_CREATED:
        userBadge.setImageResource(R.drawable.action_rate_badge);
        break;
      case OWNERSHIP_BORROW_REQUEST:
        userBadge.setImageResource(R.drawable.action_request_borrow_badge);
        break;
      case OWNERSHIP_LENT:
        userBadge.setImageResource(R.drawable.action_lent_badge);
        break;
      case OWNERSHIP_READ_IN_PROGRESS:
      case OWNERSHIP_READING_FINISHED:
      case OWNERSHIP_STARTED_TO_READ:
        userBadge.setImageResource(R.drawable.action_reading_badge);
        break;
      case OWNERSHIP_RETURNED:
        break;
      case OWNERSHIP_UPLOADED:
        break;
      case TAKE_CREATED:
        break;
      case USER_FOLLOWED:
        userBadge.setImageResource(R.drawable.action_follow_badge);
        break;
      case USER_LIKED:
        userBadge.setImageResource(R.drawable.action_like_badge);
        break;
    }

    // init comments section
    activityCommentsSection.removeAllViews();
    if (item.getComments().length != 0) {
      initCommentariesSection(item.getComments());
    }

    if (item.isLiked()) {
      addActivityLikeButton.setCompoundDrawablesWithIntrinsicBounds(
          getResources().getDrawable(R.drawable.branch_item_like_badge_active), null, null, null);
      addActivityLikeButton.setText(String.valueOf(item.getLikedUsers().size()));
    } else {
      addActivityLikeButton.setCompoundDrawablesWithIntrinsicBounds(
          getResources().getDrawable(R.drawable.branch_item_like_badge), null, null, null);
      int likedUsersCount = item.getLikedUsers().size();
      if (likedUsersCount != 0) {
        addActivityLikeButton.setText(String.valueOf(likedUsersCount));
      } else {
        addActivityLikeButton.setText("");
      }
    }
  }