List of usage examples for twitter4j Status isRetweet
boolean isRetweet();
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 ava 2 s . c o 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
protected Status getBindingStatus(Status status) { return status.isRetweet() ? status.getRetweetedStatus() : status; }
From source file:com.freshdigitable.udonroad.StatusViewImageHelper.java
License:Apache License
public static Status getBindingStatus(Status status) { return status.isRetweet() ? status.getRetweetedStatus() : status; }
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 ww . j a v a2 s . 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.subscriber.StatusRequestWorker.java
License:Apache License
public Observable<Status> observeCreateFavorite(final long statusId) { return twitterApi.createFavorite(statusId).observeOn(AndroidSchedulers.mainThread()) .doOnNext(createUpsertAction()).doOnError(new Action1<Throwable>() { @Override/*from w ww .j a v a 2s .co m*/ public void call(Throwable throwable) { final int msg = findMessageByTwitterExeption(throwable); if (msg == R.string.msg_already_fav) { updateStatus(); } userFeedback.offerEvent(msg > 0 ? msg : R.string.msg_fav_create_failed); } private void updateStatus() { final Status status = cache.find(statusId); if (status == null) { return; } final Status bindingStatus = status.isRetweet() ? status.getRetweetedStatus() : status; final StatusReactionImpl reaction = new StatusReactionImpl(bindingStatus); reaction.setFavorited(true); configStore.insert(reaction); } }).doOnCompleted(onCompleteFeedback(R.string.msg_fav_create_success)); }
From source file:com.freshdigitable.udonroad.subscriber.StatusRequestWorker.java
License:Apache License
public Observable<Status> observeRetweetStatus(final long statusId) { return twitterApi.retweetStatus(statusId).observeOn(AndroidSchedulers.mainThread()) .doOnNext(createUpsertAction()).doOnError(new Action1<Throwable>() { @Override/*w w w .j a v a2 s.c om*/ public void call(Throwable throwable) { final int msg = findMessageByTwitterExeption(throwable); if (msg == R.string.msg_already_rt) { updateStatus(); } userFeedback.offerEvent(msg > 0 ? msg : R.string.msg_rt_create_failed); } private void updateStatus() { final Status status = cache.find(statusId); if (status == null) { return; } final Status bindingStatus = status.isRetweet() ? status.getRetweetedStatus() : status; final StatusReactionImpl reaction = new StatusReactionImpl(bindingStatus); reaction.setRetweeted(true); configStore.insert(reaction); } }).doOnCompleted(onCompleteFeedback(R.string.msg_rt_create_success)); }
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 . j a va 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.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 .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.github.jcustenborder.kafka.connect.twitter.StatusConverter.java
License:Apache License
public static void convert(Status status, Struct struct) { struct.put("CreatedAt", status.getCreatedAt()).put("Id", status.getId()).put("Text", status.getText()) .put("Source", status.getSource()).put("Truncated", status.isTruncated()) .put("InReplyToStatusId", status.getInReplyToStatusId()) .put("InReplyToUserId", status.getInReplyToUserId()) .put("InReplyToScreenName", status.getInReplyToScreenName()).put("Favorited", status.isFavorited()) .put("Retweeted", status.isRetweeted()).put("FavoriteCount", status.getFavoriteCount()) .put("Retweet", status.isRetweet()).put("RetweetCount", status.getRetweetCount()) .put("RetweetedByMe", status.isRetweetedByMe()) .put("CurrentUserRetweetId", status.getCurrentUserRetweetId()) .put("PossiblySensitive", status.isPossiblySensitive()).put("Lang", status.getLang()); Struct userStruct;/* ww w .j a v a 2 s . c o m*/ if (null != status.getUser()) { userStruct = new Struct(USER_SCHEMA); convert(status.getUser(), userStruct); } else { userStruct = null; } struct.put("User", userStruct); Struct placeStruct; if (null != status.getPlace()) { placeStruct = new Struct(PLACE_SCHEMA); convert(status.getPlace(), placeStruct); } else { placeStruct = null; } struct.put("Place", placeStruct); Struct geoLocationStruct; if (null != status.getGeoLocation()) { geoLocationStruct = new Struct(GEO_LOCATION_SCHEMA); convert(status.getGeoLocation(), geoLocationStruct); } else { geoLocationStruct = null; } struct.put("GeoLocation", geoLocationStruct); List<Long> contributers = new ArrayList<>(); if (null != status.getContributors()) { for (Long l : status.getContributors()) { contributers.add(l); } } struct.put("Contributors", contributers); List<String> withheldInCountries = new ArrayList<>(); if (null != status.getWithheldInCountries()) { for (String s : status.getWithheldInCountries()) { withheldInCountries.add(s); } } struct.put("WithheldInCountries", withheldInCountries); struct.put("HashtagEntities", convert(status.getHashtagEntities())); struct.put("UserMentionEntities", convert(status.getUserMentionEntities())); struct.put("MediaEntities", convert(status.getMediaEntities())); struct.put("SymbolEntities", convert(status.getSymbolEntities())); struct.put("URLEntities", convert(status.getURLEntities())); }