Пример #1
0
 @Nullable
 private PreviewInfo getPreviewInfoFromCache() {
   Uri previewUri = UriHelper.of(getActivity()).thumbnail(feedItem);
   return inMemoryCacheService
       .getSizeInfo(feedItem.getId())
       .transform(
           info -> new PreviewInfo(info.getId(), previewUri, info.getWidth(), info.getHeight()))
       .orNull();
 }
Пример #2
0
  private void displayTags(List<Tag> tags_) {
    List<Tag> tags = inMemoryCacheService.enhanceTags(feedItem.getId(), tags_);
    this.tags = ImmutableList.copyOf(tags);

    // show tags now
    infoLineView.setTags(toMap(tags, tag -> Vote.NEUTRAL));

    // and update tags with votes later.
    voteService
        .getTagVotes(tags)
        .filter(votes -> !votes.isEmpty())
        .onErrorResumeNext(Observable.<Map<Long, Vote>>empty())
        .compose(bindToLifecycle())
        .subscribe(
            votes ->
                infoLineView.setTags(
                    toMap(tags, tag -> firstNonNull(votes.get(tag.getId()), Vote.NEUTRAL))));

    hideProgressIfLoop(tags);
  }
Пример #3
0
 private boolean isRepost() {
   return inMemoryCacheService.isRepost(feedItem);
 }