Example #1
0
 public static void doDownloadBook(Activity activity, final NetworkBookItem book, boolean demo) {
   final UrlInfo.Type resolvedType = demo ? UrlInfo.Type.BookDemo : UrlInfo.Type.Book;
   final BookUrlInfo ref = book.reference(resolvedType);
   if (ref != null) {
     activity.startService(
         new Intent(
                 Intent.ACTION_VIEW,
                 Uri.parse(ref.Url),
                 activity.getApplicationContext(),
                 BookDownloaderService.class)
             .putExtra(BookDownloaderService.Key.BOOK_MIME, ref.Mime.toString())
             .putExtra(BookDownloaderService.Key.BOOK_KIND, resolvedType)
             .putExtra(BookDownloaderService.Key.CLEAN_URL, ref.cleanUrl())
             .putExtra(BookDownloaderService.Key.BOOK_TITLE, book.Title));
   }
 }
 public static void doDownloadBook(Activity activity, final NetworkBookItem book, boolean demo) {
   final UrlInfo.Type resolvedType = demo ? UrlInfo.Type.BookDemo : UrlInfo.Type.Book;
   final BookUrlInfo ref = book.reference(resolvedType);
   if (ref != null) {
     activity.startService(
         new Intent(
                 Intent.ACTION_VIEW,
                 Uri.parse(ref.Url),
                 activity.getApplicationContext(),
                 BookDownloaderService.class)
             .putExtra(BookDownloaderService.BOOK_FORMAT_KEY, ref.BookFormat)
             .putExtra(BookDownloaderService.REFERENCE_TYPE_KEY, resolvedType)
             .putExtra(BookDownloaderService.CLEAN_URL_KEY, ref.cleanUrl())
             .putExtra(BookDownloaderService.TITLE_KEY, book.Title));
   }
 }