Ejemplo n.º 1
0
  public boolean startDownloads() {
    if (queue.isEmpty()) return false;

    boolean hasPendingDownloads = false;
    if (downloadsSubscription == null) initializeSubscriptions();

    for (Download download : queue) {
      if (download.getStatus() != Download.DOWNLOADED) {
        if (download.getStatus() != Download.QUEUE) download.setStatus(Download.QUEUE);
        if (!hasPendingDownloads) hasPendingDownloads = true;
        downloadsQueueSubject.onNext(download);
      }
    }
    return hasPendingDownloads;
  }