ResponseList<Status> result = twitter.getFavorites(); for (Status status : result) { System.out.println(status.getText()); System.out.println(status.isFavorited()); }
QueryResult result = twitter.search(new Query("Some term")); for (Status status : result.getTweets()) { System.out.println(status.getText()); System.out.println(status.getFavoriteCount()); System.out.println(status.isFavorited()); }
/** * Returns whether or not the given tweet has not yet been liked and that thus the interaction with it should be to * like it. * * @param tweet the tweet to check * * @return true if the given tweet is not liked yet but the current user */ boolean notYetLiked(final Status tweet) { return !sessionManager.doWithCurrentTwitter(twitter -> twitter.showStatus(tweet.getId()).isFavorited()) .get(); }
/** * Called on click of the like button. * <p> * Will call {@link #updateLikeVisual(boolean)} on task finish to set the appropriate visual value. * * @see TwitterInteractionService * @see TwitterBinaryInteraction * @see StatusInteraction#LIKE */ private void onLike() { LOG.debug("Like interaction on status {}", targetStatus.getValue().getId()); likeButton.setDisable(true); CompletableFuture.supplyAsync( () -> interactionService.interact(targetStatus.getValue(), LIKE) ).thenAcceptAsync(res -> { updateLikeVisual(res.isFavorited()); likeButton.setDisable(false); }, Platform::runLater); }
@Override public void initialize() { setUpInteractionActions(); targetStatus.addListener((o, prev, cur) -> { updateRetweetVisual(cur.isRetweet() ? cur.getRetweetedStatus().isRetweeted() : cur.isRetweeted()); updateLikeVisual(cur.isFavorited()); }); }
.put("InReplyToUserId", status.getInReplyToUserId()) .put("InReplyToScreenName", status.getInReplyToScreenName()) .put("Favorited", status.isFavorited()) .put("Retweeted", status.isRetweeted()) .put("FavoriteCount", status.getFavoriteCount())