Exemple #1
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);
  }