@Override public void handleButtonPress(int index) { ISBNParsedResult isbnResult = (ISBNParsedResult) getResult(); switch (index) { case 0: openProductSearch(isbnResult.getISBN()); break; case 1: openBookSearch(isbnResult.getISBN()); break; case 2: searchBookContents(isbnResult.getISBN()); break; case 3: openURL(fillInCustomSearchURL(isbnResult.getISBN())); break; } }
@Override public void handleButtonPress(int index) { ISBNParsedResult isbnResult = (ISBNParsedResult) getResult(); switch (index) { case 0: openProductSearch(isbnResult.getISBN()); break; case 1: openBookSearch(isbnResult.getISBN()); break; case 2: // searchBookContents(isbnResult.getISBN()); break; case 3: openURL(fillInCustomSearchURL(isbnResult.getISBN())); break; } }
public ISBNResultHandler(Activity activity, ParsedResult result, Result rawResult) { super(activity, result, rawResult); buttons = new int[]{ fakeR.getId("string", "button_product_search"), fakeR.getId("string", "button_book_search"), fakeR.getId("string", "button_search_book_contents"), fakeR.getId("string", "button_custom_product_search") }; showGoogleShopperButton(new View.OnClickListener() { @Override public void onClick(View view) { ISBNParsedResult isbnResult = (ISBNParsedResult) getResult(); openGoogleShopper(isbnResult.getISBN()); } }); }
public static void maybeInvokeRetrieval(TextView textView, ParsedResult result, HistoryManager historyManager, Context context) { AsyncTaskExecInterface taskExec = new AsyncTaskExecManager().build(); if (result instanceof URIParsedResult) { taskExec.execute(new URIResultInfoRetriever(textView, (URIParsedResult) result, historyManager, context)); taskExec.execute(new TitleRetriever(textView, (URIParsedResult) result, historyManager)); } else if (result instanceof ProductParsedResult) { String productID = ((ProductParsedResult) result).getProductID(); taskExec.execute(new ProductResultInfoRetriever(textView, productID, historyManager, context)); } else if (result instanceof ISBNParsedResult) { String isbn = ((ISBNParsedResult) result).getISBN(); taskExec.execute(new ProductResultInfoRetriever(textView, isbn, historyManager, context)); taskExec.execute(new BookResultInfoRetriever(textView, isbn, historyManager, context)); } }
public static void maybeInvokeRetrieval(TextView textView, ParsedResult result, HistoryManager historyManager, Context context) { AsyncTaskExecInterface taskExec = new AsyncTaskExecManager().build(); if (result instanceof URIParsedResult) { taskExec.execute(new URIResultInfoRetriever(textView, (URIParsedResult) result, historyManager, context)); taskExec.execute(new TitleRetriever(textView, (URIParsedResult) result, historyManager)); } else if (result instanceof ProductParsedResult) { String productID = ((ProductParsedResult) result).getProductID(); taskExec.execute(new ProductResultInfoRetriever(textView, productID, historyManager, context)); switch (productID.length()) { case 12: taskExec.execute(new AmazonInfoRetriever(textView, "UPC", productID, historyManager, context)); break; case 13: taskExec.execute(new AmazonInfoRetriever(textView, "EAN", productID, historyManager, context)); break; } } else if (result instanceof ISBNParsedResult) { String isbn = ((ISBNParsedResult) result).getISBN(); taskExec.execute(new ProductResultInfoRetriever(textView, isbn, historyManager, context)); taskExec.execute(new BookResultInfoRetriever(textView, isbn, historyManager, context)); taskExec.execute(new AmazonInfoRetriever(textView, "ISBN", isbn, historyManager, context)); } }
@Override public void handleClick(int buttonID) { ISBNParsedResult isbnResult = (ISBNParsedResult) getResult(); switch (buttonID) { case R.id.button_product_search: openProductSearch(isbnResult.getISBN()); break; case R.id.button_book_search: openBookSearch(isbnResult.getISBN()); break; case R.id.button_search_book_contents: searchBookContents(isbnResult.getISBN()); break; case R.id.button_custom_product_search: openURL(fillInCustomSearchURL(isbnResult.getISBN())); break; } }