Example usage for twitter4j Status getUser

List of usage examples for twitter4j Status getUser

Introduction

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

Prototype

User getUser();

Source Link

Document

Return the user associated with the status.
This can be null if the instance is from User.getStatus().

Usage

From source file:com.freshdigitable.udonroad.module.realm.TimelineStoreRealm.java

License:Apache License

private boolean isIgnorable(Status status) {
    return configStore.isIgnoredUser(status.getUser().getId())
            || (status.isRetweet() && configStore.isIgnoredUser(status.getRetweetedStatus().getUser().getId()));
}

From source file:com.freshdigitable.udonroad.StatusViewBase.java

License:Apache License

@CallSuper
public void bindStatus(final Status status) {
    final Status bindingStatus = getBindingStatus(status);

    bindCreatedAt(bindingStatus.getCreatedAt());
    if (status.isRetweet()) {
        setTextColor(ContextCompat.getColor(getContext(), R.color.twitter_action_retweeted));
    }/*  ww w .  j  a v a 2 s .  co m*/
    final User user = bindingStatus.getUser();
    bindTweetUserName(user);

    bindText(status);
    bindSource(bindingStatus);

    bindRT(bindingStatus);
    bindFavorite(bindingStatus);

    bindMediaEntities(status);
}

From source file:com.freshdigitable.udonroad.StatusViewBase.java

License:Apache License

@CallSuper
public void update(Status status) {
    final Status bindingStatus = getBindingStatus(status);
    bindCreatedAt(bindingStatus.getCreatedAt());
    bindRT(bindingStatus);//from  w  ww.  j  a  v  a2  s.  co  m
    bindFavorite(bindingStatus);
    final User user = bindingStatus.getUser();
    bindTweetUserName(user);
}

From source file:com.freshdigitable.udonroad.StatusViewImageHelper.java

License:Apache License

private static void loadRTUserIcon(Status status, FullStatusView itemView) {
    if (!status.isRetweet()) {
        return;//from   w  w w . j  a  v a2s  .  c  o m
    }
    getRequest(itemView.getContext(), status.getUser().getMiniProfileImageURLHttps(), status.getId())
            .resizeDimen(R.dimen.small_user_icon, R.dimen.small_user_icon)
            .placeholder(R.drawable.ic_person_outline_black).into(itemView.getRtUserIcon());
}

From source file:com.freshdigitable.udonroad.StatusViewImageHelper.java

License:Apache License

private static void loadQuotedStatusImages(Status status, QuotedStatusView quotedStatusView) {
    final Status quotedStatus = getBindingStatus(status).getQuotedStatus();
    if (quotedStatus == null) {
        return;//from w  w  w  .  j  a  v a 2 s.c  om
    }
    getRequest(quotedStatusView.getContext(), quotedStatus.getUser().getMiniProfileImageURLHttps(),
            status.getId()).resizeDimen(R.dimen.small_user_icon, R.dimen.small_user_icon)
                    .placeholder(R.drawable.ic_person_outline_black).into(quotedStatusView.getIcon());
    loadMediaView(quotedStatus, quotedStatusView);
}

From source file:com.freshdigitable.udonroad.TweetInputFragment.java

License:Apache License

private Observable<Status> createSendObservable() {
    final String sendingText = binding.mainTweetInputView.getText().toString();
    if (!isStatusUpdateNeeded()) {
        return twitterApi.updateStatus(sendingText);
    }/*from   w w w .j  ava  2s  . c  o  m*/
    String s = sendingText;
    for (long q : quoteStatusIds) {
        final Status status = statusCache.find(q);
        if (status == null) {
            continue;
        }
        s += " https://twitter.com/" + status.getUser().getScreenName() + "/status/" + q;
    }
    final StatusUpdate statusUpdate = new StatusUpdate(s);
    if (replyEntity != null) {
        statusUpdate.setInReplyToStatusId(replyEntity.inReplyToStatusId);
    }
    return twitterApi.updateStatus(statusUpdate);
}

From source file:com.freshdigitable.udonroad.util.TwitterResponseMock.java

License:Apache License

@NonNull
public static StatusDeletionNotice createDeletionNotice(final Status target) {
    final StatusDeletionNotice mock = mock(StatusDeletionNotice.class);
    final long statusId = target.getId();
    when(mock.getStatusId()).thenReturn(statusId);
    final long userId = target.getUser().getId();
    when(mock.getUserId()).thenReturn(userId);
    return mock;/*from w w  w . j ava2 s .  c o  m*/
}

From source file:com.freshdigitable.udonroad.util.TwitterResponseMock.java

License:Apache License

public static Status createStatus(long id, User user) {
    final Status status = mock(Status.class);
    when(status.getId()).thenReturn(id);
    when(status.getCreatedAt()).thenReturn(new Date());
    when(status.getText()).thenReturn(createText(id));
    when(status.isRetweet()).thenReturn(false);
    when(status.getSource()).thenReturn("<a href=\"https://twitter.com/akihito104\">Udonroad</a>");
    when(status.getURLEntities()).thenReturn(new URLEntity[0]);
    when(status.getExtendedMediaEntities()).thenReturn(new ExtendedMediaEntity[0]);
    when(status.getUserMentionEntities()).thenReturn(new UserMentionEntity[0]);
    when(status.getUser()).thenReturn(user);
    return status;
}

From source file:com.freshdigitable.udonroad.util.TwitterResponseMock.java

License:Apache License

public static Status createRtStatus(Status rtedStatus, long newStatusId, int rtCount, int favCount,
        boolean isFromRest) {
    final Status rtStatus = createStatus(rtedStatus.getId(), rtedStatus.getUser());
    if (isFromRest) {
        when(rtStatus.isRetweeted()).thenReturn(true);
        when(rtStatus.getRetweetCount()).thenReturn(rtCount);
        when(rtStatus.getFavoriteCount()).thenReturn(favCount);
    } else {/*from  www.  j a v  a  2 s . c  o m*/
        when(rtStatus.isRetweeted()).thenReturn(false);
        when(rtStatus.getRetweetCount()).thenReturn(0);
        when(rtStatus.getFavoriteCount()).thenReturn(0);
    }

    final Status status = createStatus(newStatusId);
    final String rtText = rtStatus.getText();
    when(status.getText()).thenReturn(rtText);
    when(status.isRetweet()).thenReturn(true);
    when(status.isRetweeted()).thenReturn(isFromRest);
    when(status.getRetweetedStatus()).thenReturn(rtStatus);
    return status;
}

From source file:com.fuzuapp.model.resultados.TwitterAdapter.java

@Override
public List<Resultado> getResultados(GeoPoint ponto, double raio) {

    List<Resultado> resultados = new ArrayList();
    try {//from  ww w . ja v  a  2s  . c  o m
        Query query = new Query("");
        GeoLocation geo = new GeoLocation(ponto.getLatitude(), ponto.getLongitude());
        query.setGeoCode(geo, raio, Query.KILOMETERS);
        query.resultType(Query.RECENT);
        query.setCount(20);
        QueryResult result = twitter.search(query);

        for (Status status : result.getTweets()) {
            Resultado r = new Resultado();

            r.setDescricao(status.getText());
            r.setUrl("http://twitter.com/statuses/" + String.valueOf(status.getId()));
            r.setNomeUsuario(status.getUser().getName());
            r.setHorario(new SimpleDateFormat("dd/MM HH:mm").format(status.getCreatedAt()));
            r.setFotoUrl(status.getUser().getProfileImageURL());
            //r.setLocal(new GeoPoint(status.getGeoLocation().getLatitude(), status.getGeoLocation().getLongitude()));
            r.setTipo(Resultado.TEXTO);

            resultados.add(r);

        }
    } catch (TwitterException ex) {
        Logger.getLogger(TwitterAdapter.class.getName()).log(Level.SEVERE, null, ex);
    }

    return resultados;
}