/* * get the latest version of this post */ private void updatePost() { if (!hasPost() || !mPost.isWP()) { return; } final int numLikesBefore = ReaderLikeTable.getNumLikesForPost(mPost); ReaderActions.UpdateResultListener resultListener = new ReaderActions.UpdateResultListener() { @Override public void onUpdateResult(ReaderActions.UpdateResult result) { if (!isAdded()) { return; } // if the post has changed, reload it from the db and update the like/comment counts if (result.isNewOrChanged()) { mPost = ReaderPostTable.getPost(mBlogId, mPostId, false); refreshIconCounts(); } // refresh likes if necessary - done regardless of whether the post has changed // since it's possible likes weren't stored until the post was updated if (result != ReaderActions.UpdateResult.FAILED && numLikesBefore != ReaderLikeTable.getNumLikesForPost(mPost)) { refreshLikes(); } } }; ReaderPostActions.updatePost(mPost, resultListener); }