コード例 #1
0
  @Override
  public void toggleUpvote(Post post) {
    addedOffline = true;

    // if the user has already upvoted the post
    // then we are subtracting votes from the post when we toggle it
    int incrementVotes = 1;
    if (mProfileManager.getIsUpvoted(post)) {
      incrementVotes = -1;
      post.decrementVotes();
    } else {
      post.incrementVotes();
    }

    mProfileManager.toggleIsUpvoted(post);
    post.setUpvotesChangedOffline(incrementVotes);
    save();
  }
コード例 #2
0
 @Override
 public void addReply(Post parent, Reply newReply) {
   addedOffline = true;
   parent.addReply(newReply);
   save();
 }