List of usage examples for twitter4j Status getId
long getId();
From source file:com.freshdigitable.udonroad.datastore.StatusReactionImpl.java
License:Apache License
public StatusReactionImpl(Status status) { this.id = status.getId(); this.favorited = status.isFavorited(); this.retweeted = status.isRetweeted(); }
From source file:com.freshdigitable.udonroad.MediaViewActivity.java
License:Apache License
public static Intent create(@NonNull Context context, @NonNull Status status, int startPage) { final Status bindingStatus = StatusViewImageHelper.getBindingStatus(status); if (bindingStatus.getExtendedMediaEntities().length < startPage + 1) { throw new IllegalArgumentException( "startPage number exceeded ExtendedMediaEntities length: " + startPage); }//w w w .j a v a 2s . co m Intent intent = new Intent(context, MediaViewActivity.class); intent.putExtra(CREATE_STATUS, status.getId()); intent.putExtra(CREATE_START, startPage); return intent; }
From source file:com.freshdigitable.udonroad.module.realm.StatusCacheRealm.java
License:Apache License
@NonNull @Override//w w w .jav a2s .c om public Realm.Transaction upsertTransaction(final Collection<Status> updates) { return new Realm.Transaction() { @Override public void execute(Realm realm) { final ArrayList<StatusRealm> inserts = new ArrayList<>(updates.size()); for (Status s : updates) { final StatusRealm update = findById(realm, s.getId(), StatusRealm.class); if (update == null) { inserts.add(new StatusRealm(s)); } else { update.merge(s); } } realm.insertOrUpdate(inserts); } }; }
From source file:com.freshdigitable.udonroad.module.realm.StatusCacheRealm.java
License:Apache License
@NonNull private Collection<Status> splitUpsertingStatus(Collection<Status> statuses) { final LinkedHashMap<Long, Status> updates = new LinkedHashMap<>(); for (Status s : statuses) { if (!configStore.isIgnoredUser(s.getUser().getId())) { updates.put(s.getId(), s); }/*from w ww .j a v a 2s . co m*/ final Status quotedStatus = s.getQuotedStatus(); if (quotedStatus != null && !configStore.isIgnoredUser(quotedStatus.getUser().getId())) { updates.put(quotedStatus.getId(), quotedStatus); } final Status retweetedStatus = s.getRetweetedStatus(); if (retweetedStatus != null && !configStore.isIgnoredUser(retweetedStatus.getUser().getId())) { updates.put(retweetedStatus.getId(), retweetedStatus); final Status rtQuotedStatus = retweetedStatus.getQuotedStatus(); if (rtQuotedStatus != null && !configStore.isIgnoredUser(rtQuotedStatus.getUser().getId())) { updates.put(rtQuotedStatus.getId(), rtQuotedStatus); } } } return updates.values(); }
From source file:com.freshdigitable.udonroad.module.realm.StatusCacheRealm.java
License:Apache License
private Collection<StatusReaction> splitUpsertingStatusReaction(Collection<Status> statuses) { Map<Long, StatusReaction> res = new LinkedHashMap<>(statuses.size()); for (Status s : statuses) { res.put(s.getId(), new StatusReactionRealm(s)); }//from ww w . j a v a 2s . co m return res.values(); }
From source file:com.freshdigitable.udonroad.module.realm.StatusIDs.java
License:Apache License
StatusIDs(Status status) { this.id = status.getId(); final Status retweetedStatus = status.getRetweetedStatus(); this.retweetedStatusId = retweetedStatus != null ? retweetedStatus.getId() : -1; this.quotedStatusId = status.getQuotedStatusId(); }
From source file:com.freshdigitable.udonroad.module.realm.StatusReactionRealm.java
License:Apache License
public StatusReactionRealm(Status status) { this.id = status.getId(); this.retweeted = status.isRetweeted(); this.favorited = status.isFavorited(); }
From source file:com.freshdigitable.udonroad.module.realm.StatusRealm.java
License:Apache License
StatusRealm(Status status) { this.id = status.getId(); this.createdAt = status.getCreatedAt(); this.retweetedStatus = status.getRetweetedStatus(); this.retweet = status.isRetweet(); if (status.isRetweet()) { this.retweetedStatusId = this.retweetedStatus.getId(); }/*from w w w . ja v a 2s . c om*/ this.text = status.getText(); this.source = status.getSource(); this.retweetCount = status.getRetweetCount(); this.favoriteCount = status.getFavoriteCount(); this.reaction = new StatusReactionImpl(status); this.user = status.getUser(); this.userId = user.getId(); this.urlEntities = URLEntityRealm.createList(status.getURLEntities()); this.mediaEntities = new RealmList<>(); final ExtendedMediaEntity[] me = status.getExtendedMediaEntities(); for (ExtendedMediaEntity m : me) { mediaEntities.add(new ExtendedMediaEntityRealm(m)); } final UserMentionEntity[] userMentionEntities = status.getUserMentionEntities(); this.userMentionEntities = new RealmList<>(); for (UserMentionEntity u : userMentionEntities) { this.userMentionEntities.add(new UserMentionEntityRealm(u)); } this.quotedStatus = status.getQuotedStatus(); this.quotedStatusId = status.getQuotedStatusId(); }
From source file:com.freshdigitable.udonroad.module.realm.TimelineStoreRealm.java
License:Apache License
private List<StatusIDs> createUpdateList(List<Status> statuses) { if (!updateEvent.hasObservers()) { return Collections.emptyList(); }//from w w w . j a v a 2s . c o m final List<StatusIDs> updates = new ArrayList<>(); for (Status s : statuses) { final StatusIDs update = findTimeline(s); if (update != null) { updates.add(update); } final RealmResults<StatusIDs> u = findReferringStatus(s.getId()); if (!u.isEmpty()) { updates.addAll(u); } final long quotedStatusId = s.getQuotedStatusId(); if (quotedStatusId > 0) { final Status quotedStatus = s.getQuotedStatus(); final StatusIDs q = findTimeline(quotedStatus); if (q != null) { updates.add(q); } final RealmResults<StatusIDs> updatedQuotedStatus = findReferringStatus(quotedStatusId); if (!updatedQuotedStatus.isEmpty()) { updates.addAll(updatedQuotedStatus); } } if (!s.isRetweet()) { continue; } final Status retweetedStatus = s.getRetweetedStatus(); final StatusIDs rs = findTimeline(retweetedStatus); if (rs != null) { updates.add(rs); } final RealmResults<StatusIDs> rtedUpdate = findReferringStatus(retweetedStatus.getId()); if (!rtedUpdate.isEmpty()) { updates.addAll(rtedUpdate); } final long rtQuotedStatusId = retweetedStatus.getQuotedStatusId(); if (rtQuotedStatusId > 0) { final RealmResults<StatusIDs> rtUpdatedQuotedStatus = findReferringStatus(rtQuotedStatusId); if (!rtUpdatedQuotedStatus.isEmpty()) { updates.addAll(rtUpdatedQuotedStatus); } } } return updates; }
From source file:com.freshdigitable.udonroad.module.realm.TimelineStoreRealm.java
License:Apache License
@Nullable private StatusIDs findTimeline(Status newer) { if (newer == null) { return null; }// www. j av a 2s . c o m return timeline.where().equalTo(KEY_ID, newer.getId()).findFirst(); }