/* * changes the like on the passed post */ private void togglePostLike() { if (!isAdded() || !hasPost() || !NetworkUtils.checkConnection(getActivity())) { return; } boolean isAskingToLike = !mPost.isLikedByCurrentUser; ReaderIconCountView likeCount = (ReaderIconCountView) getView().findViewById(R.id.count_likes); likeCount.setSelected(isAskingToLike); ReaderAnim.animateLikeButton(likeCount.getImageView(), isAskingToLike); if (!ReaderPostActions.performLikeAction(mPost, isAskingToLike)) { likeCount.setSelected(!isAskingToLike); return; } // get the post again since it has changed, then refresh to show changes mPost = ReaderPostTable.getPost(mBlogId, mPostId, false); refreshLikes(); refreshIconCounts(); if (isAskingToLike) { AnalyticsUtils.trackWithBlogDetails(AnalyticsTracker.Stat.READER_ARTICLE_LIKED, mBlogId); } else { AnalyticsUtils.trackWithBlogDetails(AnalyticsTracker.Stat.READER_ARTICLE_UNLIKED, mBlogId); } }