mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 10:19:33 +02:00
BuyBookActivity
This commit is contained in:
parent
ea4a66ab7f
commit
0a9be397a8
15 changed files with 268 additions and 148 deletions
|
@ -30,6 +30,7 @@ import org.geometerplus.fbreader.network.*;
|
|||
import org.geometerplus.fbreader.network.authentication.NetworkAuthenticationManager;
|
||||
import org.geometerplus.fbreader.network.authentication.litres.LitResAuthenticationManager;
|
||||
import org.geometerplus.fbreader.network.urlInfo.UrlInfo;
|
||||
import org.geometerplus.fbreader.network.urlInfo.BookUrlInfo;
|
||||
|
||||
import org.geometerplus.android.util.UIUtil;
|
||||
import org.geometerplus.android.util.PackageUtil;
|
||||
|
@ -159,4 +160,20 @@ public abstract class Util implements UserRegistrationConstants {
|
|||
activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue