/**
   * Downloads a feed
   *
   * @param context The application's environment.
   * @param feed Feed to download
   * @param loadAllPages Set to true to download all pages
   */
  public synchronized void downloadFeed(Context context, Feed feed, boolean loadAllPages)
      throws DownloadRequestException {
    if (feedFileValid(feed)) {
      String username =
          (feed.getPreferences() != null) ? feed.getPreferences().getUsername() : null;
      String password =
          (feed.getPreferences() != null) ? feed.getPreferences().getPassword() : null;
      long ifModifiedSince = feed.isPaged() ? 0 : feed.getLastUpdate().getTime();

      Bundle args = new Bundle();
      args.putInt(REQUEST_ARG_PAGE_NR, feed.getPageNr());
      args.putBoolean(REQUEST_ARG_LOAD_ALL_PAGES, loadAllPages);

      download(
          context,
          feed,
          null,
          new File(getFeedfilePath(context), getFeedfileName(feed)),
          true,
          username,
          password,
          ifModifiedSince,
          true,
          args);
    }
  }
Exemple #2
0
 public boolean compareWithOther(Feed other) {
   if (super.compareWithOther(other)) {
     return true;
   }
   if (!title.equals(other.title)) {
     return true;
   }
   if (other.feedIdentifier != null) {
     if (feedIdentifier == null || !feedIdentifier.equals(other.feedIdentifier)) {
       return true;
     }
   }
   if (other.link != null) {
     if (link == null || !link.equals(other.link)) {
       return true;
     }
   }
   if (other.description != null) {
     if (description == null || !description.equals(other.description)) {
       return true;
     }
   }
   if (other.language != null) {
     if (language == null || !language.equals(other.language)) {
       return true;
     }
   }
   if (other.author != null) {
     if (author == null || !author.equals(other.author)) {
       return true;
     }
   }
   if (other.paymentLink != null) {
     if (paymentLink == null || !paymentLink.equals(other.paymentLink)) {
       return true;
     }
   }
   if (other.isPaged() && !this.isPaged()) {
     return true;
   }
   if (!StringUtils.equals(other.getNextPageLink(), this.getNextPageLink())) {
     return true;
   }
   return false;
 }