/** * Determines whether a given tweet is a retweet made by the current user. Twitter's API really is unhelpful on this * side so we mostly take an educated guess here, although it should be enough in most cases. * * @param status the tweet to test against * * @return true if and only if the given status is a retweet made by the current user */ public boolean isRetweetByCurrentUser(final Status status) { if (status.isRetweet()) { final Status retweetedStatus = status.getRetweetedStatus(); return retweetedStatus.isRetweeted() || retweetedStatus.isRetweetedByMe() || sessionManager.isCurrentUser(status.getUser()); } else { return false; } }
@Override public void initialize() { setUpInteractionActions(); targetStatus.addListener((o, prev, cur) -> { updateRetweetVisual(cur.isRetweet() ? cur.getRetweetedStatus().isRetweeted() : cur.isRetweeted()); updateLikeVisual(cur.isFavorited()); }); }
.put("InReplyToScreenName", status.getInReplyToScreenName()) .put("Favorited", status.isFavorited()) .put("Retweeted", status.isRetweeted()) .put("FavoriteCount", status.getFavoriteCount()) .put("Retweet", status.isRetweet())
/** * Checks whether a given tweet has been retweeted by the current user. * <p> * PSA : I don't care that you can retweet your own tweets. This is stupid and you should never do it. Will never * allow a PR "fixing" that pass. * * @param tweet the tweet to check * * @return Whether the given tweet had not yet been retweeted by the current user. */ public boolean notYetRetweeted(final Status tweet) { return !sessionManager.doWithCurrentTwitter(twitter -> { final Status updatedTweet = twitter.showStatus(tweet.getId()); final Status originalStatus = updatedTweet.isRetweet() ? updatedTweet.getRetweetedStatus() : updatedTweet; return originalStatus.isRetweeted(); }).get(); }