Example usage for twitter4j Status getId

List of usage examples for twitter4j Status getId

Introduction

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

Prototype

long getId();

Source Link

Document

Returns the id of the status

Usage

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

License:Apache License

private static void loadUserIcon(Status status, FullStatusView itemView) {
    final User user = getBindingUser(status);
    loadUserIcon(user, status.getId(), itemView);
}

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 .ja va2s .c om*/
    }
    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 loadMediaView(final Status status, final StatusViewBase statusView) {
    final ExtendedMediaEntity[] extendedMediaEntities = getBindingStatus(status).getExtendedMediaEntities();
    final MediaContainer mediaContainer = statusView.getMediaContainer();
    mediaContainer.bindMediaEntities(extendedMediaEntities);
    final int mediaCount = mediaContainer.getThumbCount();
    final long statusId = status.getId();
    for (int i = 0; i < mediaCount; i++) {
        final MediaImageView mediaView = (MediaImageView) mediaContainer.getChildAt(i);
        final String type = extendedMediaEntities[i].getType();
        mediaView.setShowIcon("video".equals(type) || "animated_gif".equals(type));

        final RequestCreator rc = getRequest(mediaContainer.getContext(),
                extendedMediaEntities[i].getMediaURLHttps() + ":thumb", statusId);
        if (mediaContainer.getHeight() == 0 || mediaContainer.getThumbWidth() == 0) {
            rc.fit();/*from  w  w  w.j  a  v a2s  . c  o  m*/
        } else {
            rc.resize(mediaContainer.getThumbWidth(), mediaContainer.getHeight());
        }
        rc.centerCrop().into(mediaView);
    }
}

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  av 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.TimelineAdapter.java

License:Apache License

private void setupMediaView(final Status status, final StatusViewBase statusView) {
    final ExtendedMediaEntity[] extendedMediaEntities = StatusViewImageHelper.getBindingStatus(status)
            .getExtendedMediaEntities();
    if (extendedMediaEntities.length < 1) {
        return;//from w  ww  .  j  a v  a  2s.com
    }
    final MediaContainer mediaContainer = statusView.getMediaContainer();
    final long statusId = status.getId();
    mediaContainer.setOnMediaClickListener(new MediaContainer.OnMediaClickListener() {
        @Override
        public void onMediaClicked(View view, int index) {
            itemViewClickListener.onItemViewClicked(statusView, statusId, view);
            MediaViewActivity.start(view.getContext(), status, index);
        }
    });
}

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

License:Apache License

private void setupQuotedStatusView(Status status, final QuotedStatusView quotedStatusView) {
    final Status quotedStatus = status.isRetweet() ? status.getRetweetedStatus().getQuotedStatus()
            : status.getQuotedStatus();/*from  w ww .ja  v a  2 s . co  m*/
    if (quotedStatus == null) {
        return;
    }
    final long quotedStatusId = quotedStatus.getId();
    quotedStatusView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            itemViewClickListener.onItemViewClicked(quotedStatusView, quotedStatusId, view);
        }
    });
    setupMediaView(quotedStatus, quotedStatusView);
}

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

License:Apache License

protected Status findByStatusId(long statusId) throws Exception {
    for (Status s : responseList) {
        if (s.getId() == statusId) {
            return s;
        }/*from  w ww  .java  2  s  .c o m*/
    }
    throw new TwitterException("status is not found. ID: " + statusId);
}

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 .jav  a  2  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   w ww  . j av  a  2 s . com*/
        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;
}