private static boolean runActionStatic(Activity activity, NetworkBookTree tree, int actionCode) { final NetworkBookItem book = tree.Book; switch (actionCode) { case ActionCode.DOWNLOAD_BOOK: Util.doDownloadBook(activity, book, false); return true; case ActionCode.DOWNLOAD_DEMO: Util.doDownloadBook(activity, book, true); return true; case ActionCode.READ_BOOK: doReadBook(activity, book, false); return true; case ActionCode.READ_DEMO: doReadBook(activity, book, true); return true; case ActionCode.DELETE_BOOK: tryToDeleteBook(activity, book, false); return true; case ActionCode.DELETE_DEMO: tryToDeleteBook(activity, book, true); return true; case ActionCode.BUY_DIRECTLY: doBuyDirectly(activity, tree); return true; case ActionCode.BUY_IN_BROWSER: doBuyInBrowser(activity, book); return true; case ActionCode.ADD_BOOK_TO_BASKET: book.Link.getBasketItem().add(book); return true; case ActionCode.REMOVE_BOOK_FROM_BASKET: book.Link.getBasketItem().remove(book); return true; case ActionCode.OPEN_BASKET: new OpenCatalogAction(activity) .run(NetworkLibrary.Instance().getFakeBasketTree(book.Link.getBasketItem())); return true; } return false; }
private static void doBuyInBrowser(Activity activity, final NetworkBookItem book) { BookUrlInfo reference = book.reference(UrlInfo.Type.BookBuyInBrowser); if (reference != null) { Util.openInBrowser(activity, reference.Url); } }