Пример #1
0
 private void fetchLikeCount(final TextView textView) {
   new HttpRequestTask("liked_count") {
     @Override
     protected void atPostExecute(JSONObject jsonObject) {
       textView.setText("Likes: " + JSONParser.parseLikedCount(jsonObject, getActivity()));
     }
   }.execute(JSONFactory.createLike(post.getId()));
 }
Пример #2
0
 private void changeLike(final Button button, final TextView textView) {
   String routing = "";
   if (post.isLiked()) {
     routing = "delete";
   } else {
     routing = "new";
   }
   new HttpRequestTask(routing) {
     @Override
     protected void atPostExecute(JSONObject jsonObject) {
       toggleLike(button);
       fetchLikeCount(textView);
     }
   }.execute(JSONFactory.createLike(post.getId()));
 }