Exemple #1
0
  /*
   * triggered when user chooses to like or follow
   */
  public void doPostAction(View btnAction, ReaderPostActions.PostAction action, ReaderPost post) {
    boolean isSelected = btnAction.isSelected();
    btnAction.setSelected(!isSelected);
    ReaderAniUtils.zoomAction(btnAction);

    if (!ReaderPostActions.performPostAction(this, action, post, null)) {
      btnAction.setSelected(isSelected);
      return;
    }

    // get the post again, since it has changed
    mPost = ReaderPostTable.getPost(mBlogId, mPostId);
    mIsPostChanged = true;

    // call returns before api completes, but local version of post will have been changed
    // so refresh to show those changes
    switch (action) {
      case TOGGLE_LIKE:
        refreshLikes();
        break;
      case TOGGLE_FOLLOW:
        refreshFollowed();
        break;
    }
  }