Example usage for twitter4j Status isRetweet

List of usage examples for twitter4j Status isRetweet

Introduction

In this page you can find the example usage for twitter4j Status isRetweet.

Prototype

boolean isRetweet();

Source Link

Usage

From source file:net.lacolaco.smileessence.data.FavoriteCache.java

License:Open Source License

/**
 * Put status into cache/*  w ww  .ja v a 2s .com*/
 */
public void put(Status status) {
    if (!status.isRetweet()) {
        cache.put(status.getId(), status.isFavorited());
    }
}

From source file:net.lacolaco.smileessence.data.FavoriteCache.java

License:Open Source License

public void put(Status status, boolean favorited) {
    if (status.isRetweet()) {
        cache.put(status.getRetweetedStatus().getId(), favorited);
    } else {//  www .  j  ava 2  s  . c o  m
        cache.put(status.getId(), favorited);
    }
}

From source file:net.lacolaco.smileessence.data.StatusCache.java

License:Open Source License

/**
 * Put status into cache// w  ww.  j a  v a 2  s  .  c  o  m
 *
 * @param status
 * @return the previous value associated with key, or null if there was no mapping for key
 */
public Status put(Status status) {
    if (status.isRetweet()) {
        put(status.getRetweetedStatus());
    }
    if (cache.containsKey(status.getId())) {
        cache.remove(status.getId());
    }
    return cache.put(status.getId(), status);
}

From source file:net.lacolaco.smileessence.twitter.UserStreamListener.java

License:Open Source License

@Override
public void onStatus(Status status) {
    StatusCache.getInstance().put(status);
    if (isIgnoredStatus(status)) {
        return;//from  ww w.  j a  va2s. c  o  m
    }
    StatusViewModel viewModel = new StatusViewModel(status, activity.getCurrentAccount());
    addToHome(viewModel);
    if (status.isRetweet()) {
        if (viewModel.isRetweetOfMe()) {
            addToHistory(new EventViewModel(EnumEvent.RETWEETED, status.getUser(), status));
        }
    } else if (viewModel.isMention()) {
        addToMentions(viewModel);
        EventViewModel mentioned = new EventViewModel(EnumEvent.MENTIONED, status.getUser(), status);
        Notificator.publish(activity, mentioned.getFormattedString(activity));
    }
    StatusFilter.filter(activity, viewModel);
    FavoriteCache.getInstance().put(status);
}

From source file:net.lacolaco.smileessence.twitter.UserStreamListener.java

License:Open Source License

private boolean isIgnoredStatus(Status status) {
    return status.isRetweet() && StatusCache.getInstance().isIgnored(status.getRetweetedStatus().getId());
}

From source file:net.lacolaco.smileessence.twitter.util.TwitterUtils.java

License:Open Source License

/**
 * Return original status text. If status is not retweet, value is same to a given.
 *
 * @param status//from w  ww .  j a  va  2 s . c  o  m
 * @return
 */
public static String getOriginalStatusText(Status status) {
    return status.isRetweet() ? status.getRetweetedStatus().getText() : status.getText();
}

From source file:net.lacolaco.smileessence.twitter.util.TwitterUtils.java

License:Open Source License

public static Status getOriginalStatus(Status status) {
    return StatusCache.getInstance().get((status.isRetweet() ? status.getRetweetedStatus() : status).getId());
}

From source file:net.lacolaco.smileessence.view.dialog.StatusDetailDialogFragment.java

License:Open Source License

private boolean isDeletable(Account account, Status status) {
    boolean deletable;
    if (!status.isRetweet()) {
        deletable = status.getUser().getId() == account.userID;
    } else {// ww  w  .j av  a 2s  . c  o m
        deletable = status.getRetweetedStatus().getUser().getId() == account.userID;
    }
    return deletable;
}

From source file:net.lacolaco.smileessence.view.dialog.StatusDetailDialogFragment.java

License:Open Source License

private boolean isRetweetDeletable(Account account, Status status) {
    return status.isRetweet() && status.getUser().getId() == account.userID;
}

From source file:net.lacolaco.smileessence.view.dialog.StatusDetailDialogFragment.java

License:Open Source License

private void toggleFavorite(MainActivity activity, Account account, Status status, Boolean isFavorited) {
    long statusID = status.isRetweet() ? status.getRetweetedStatus().getId() : status.getId();
    if (isFavorited) {
        new UnfavoriteTask(TwitterApi.getTwitter(account), statusID, activity).execute();
    } else {/*from ww w.j  a v a 2s  .c o  m*/
        new FavoriteTask(TwitterApi.getTwitter(account), statusID, activity).execute();
    }
    dismiss();
}