com.google.zxing.client.result.ProductParsedResult Java Examples
The following examples show how to use
com.google.zxing.client.result.ProductParsedResult.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SupplementalInfoRetriever.java From android-apps with MIT License | 6 votes |
public static void maybeInvokeRetrieval(TextView textView, ParsedResult result, Handler handler, HistoryManager historyManager, Context context) { Collection<SupplementalInfoRetriever> retrievers = new ArrayList<SupplementalInfoRetriever>(1); if (result instanceof URIParsedResult) { retrievers.add(new URIResultInfoRetriever(textView, (URIParsedResult) result, handler, historyManager, context)); } else if (result instanceof ProductParsedResult) { String productID = ((ProductParsedResult) result).getProductID(); retrievers.add(new ProductResultInfoRetriever(textView, productID, handler, historyManager, context)); } else if (result instanceof ISBNParsedResult) { String isbn = ((ISBNParsedResult) result).getISBN(); retrievers.add(new ProductResultInfoRetriever(textView, isbn, handler, historyManager, context)); retrievers.add(new BookResultInfoRetriever(textView, isbn, handler, historyManager, context)); } for (SupplementalInfoRetriever retriever : retrievers) { ExecutorService executor = getExecutorService(); Future<?> future = executor.submit(retriever); // Make sure it's interrupted after a short time though executor.submit(new KillerCallable(future, 10, TimeUnit.SECONDS)); } }
Example #2
Source File: SupplementalInfoRetriever.java From reacteu-app with MIT License | 6 votes |
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)); } }
Example #3
Source File: SupplementalInfoRetriever.java From ZXing-Standalone-library with Apache License 2.0 | 5 votes |
public static void maybeInvokeRetrieval(TextView textView, ParsedResult result, HistoryManager historyManager, Context context) { try { if (result instanceof URIParsedResult) { SupplementalInfoRetriever uriRetriever = new URIResultInfoRetriever(textView, (URIParsedResult) result, historyManager, context); uriRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); SupplementalInfoRetriever titleRetriever = new TitleRetriever(textView, (URIParsedResult) result, historyManager); titleRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else if (result instanceof ProductParsedResult) { ProductParsedResult productParsedResult = (ProductParsedResult) result; String productID = productParsedResult.getProductID(); SupplementalInfoRetriever productRetriever = new ProductResultInfoRetriever(textView, productID, historyManager, context); productRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else if (result instanceof ISBNParsedResult) { String isbn = ((ISBNParsedResult) result).getISBN(); SupplementalInfoRetriever productInfoRetriever = new ProductResultInfoRetriever(textView, isbn, historyManager, context); productInfoRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); SupplementalInfoRetriever bookInfoRetriever = new BookResultInfoRetriever(textView, isbn, historyManager, context); bookInfoRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } } catch (RejectedExecutionException ree) { // do nothing } }
Example #4
Source File: ResultProcessorFactory.java From BarcodeEye with Apache License 2.0 | 5 votes |
public static ResultProcessor<? extends ParsedResult> makeResultProcessor( Context context, Result result, Uri photoUri) { ParsedResult parsedResult = ResultParser.parseResult(result); switch (parsedResult.getType()) { case PRODUCT: return new ProductResultProcessor(context, (ProductParsedResult) parsedResult, result, photoUri); case URI: return new UriResultProcessor(context, (URIParsedResult) parsedResult, result, photoUri); case ISBN: return new IsbnResultProcessor(context, (ISBNParsedResult) parsedResult, result, photoUri); case SMS: case GEO: case TEL: case CALENDAR: case ADDRESSBOOK: case EMAIL_ADDRESS: case WIFI: // currently unsupported so we let them fall through default: return new TextResultProcessor(context, parsedResult, result, photoUri); } }
Example #5
Source File: SupplementalInfoRetriever.java From zxingfragmentlib with Apache License 2.0 | 5 votes |
public static void maybeInvokeRetrieval(TextView textView, ParsedResult result, HistoryManager historyManager, Context context) { if (result instanceof URIParsedResult) { SupplementalInfoRetriever uriRetriever = new URIResultInfoRetriever(textView, (URIParsedResult) result, historyManager, context); uriRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); SupplementalInfoRetriever titleRetriever = new TitleRetriever(textView, (URIParsedResult) result, historyManager); titleRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else if (result instanceof ProductParsedResult) { ProductParsedResult productParsedResult = (ProductParsedResult) result; String productID = productParsedResult.getProductID(); SupplementalInfoRetriever productRetriever = new ProductResultInfoRetriever(textView, productID, historyManager, context); productRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else if (result instanceof ISBNParsedResult) { String isbn = ((ISBNParsedResult) result).getISBN(); SupplementalInfoRetriever productInfoRetriever = new ProductResultInfoRetriever(textView, isbn, historyManager, context); productInfoRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); SupplementalInfoRetriever bookInfoRetriever = new BookResultInfoRetriever(textView, isbn, historyManager, context); bookInfoRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } }
Example #6
Source File: ProductResultHandler.java From zxingfragmentlib with Apache License 2.0 | 5 votes |
private static String getProductIDFromResult(ParsedResult rawResult) { if (rawResult instanceof ProductParsedResult) { return ((ProductParsedResult) rawResult).getNormalizedProductID(); } if (rawResult instanceof ExpandedProductParsedResult) { return ((ExpandedProductParsedResult) rawResult).getRawText(); } throw new IllegalArgumentException(rawResult.getClass().toString()); }
Example #7
Source File: ProductResultHandler.java From android-quick-response-code with Apache License 2.0 | 5 votes |
@Override public CharSequence getDisplayContents() { ProductParsedResult result = (ProductParsedResult) getResult(); StringBuilder contents = new StringBuilder(100); ParsedResult.maybeAppend(result.getNormalizedProductID(), contents); contents.trimToSize(); return contents.toString(); }
Example #8
Source File: ProductResultHandler.java From barterli_android with Apache License 2.0 | 5 votes |
@Override public CharSequence getDisplayContents() { ProductParsedResult result = (ProductParsedResult) getResult(); StringBuilder contents = new StringBuilder(100); ParsedResult.maybeAppend(result.getNormalizedProductID(), contents); contents.trimToSize(); return contents.toString(); }
Example #9
Source File: ProductResultHandler.java From android-apps with MIT License | 5 votes |
@Override public void handleButtonPress(int index) { ProductParsedResult productResult = (ProductParsedResult) getResult(); switch (index) { case 0: openProductSearch(productResult.getNormalizedProductID()); break; case 1: webSearch(productResult.getNormalizedProductID()); break; case 2: openURL(fillInCustomSearchURL(productResult.getNormalizedProductID())); break; } }
Example #10
Source File: ProductResultHandler.java From android-apps with MIT License | 5 votes |
public ProductResultHandler(Activity activity, ParsedResult result, Result rawResult) { super(activity, result, rawResult); showGoogleShopperButton(new View.OnClickListener() { public void onClick(View view) { ProductParsedResult productResult = (ProductParsedResult) getResult(); openGoogleShopper(productResult.getNormalizedProductID()); } }); }
Example #11
Source File: ProductResultHandler.java From reacteu-app with MIT License | 5 votes |
@Override public void handleButtonPress(int index) { ProductParsedResult productResult = (ProductParsedResult) getResult(); switch (index) { case 0: openProductSearch(productResult.getNormalizedProductID()); break; case 1: webSearch(productResult.getNormalizedProductID()); break; case 2: openURL(fillInCustomSearchURL(productResult.getNormalizedProductID())); break; } }
Example #12
Source File: ProductResultHandler.java From reacteu-app with MIT License | 5 votes |
public ProductResultHandler(Activity activity, ParsedResult result, Result rawResult) { super(activity, result, rawResult); buttons = new int[]{ fakeR.getId("string", "button_product_search"), fakeR.getId("string", "button_web_search"), fakeR.getId("string", "button_custom_product_search") }; showGoogleShopperButton(new View.OnClickListener() { @Override public void onClick(View view) { ProductParsedResult productResult = (ProductParsedResult) getResult(); openGoogleShopper(productResult.getNormalizedProductID()); } }); }
Example #13
Source File: SupplementalInfoRetriever.java From barcodescanner-lib-aar with MIT License | 5 votes |
public static void maybeInvokeRetrieval(TextView textView, ParsedResult result, HistoryManager historyManager, Context context) { try { if (result instanceof URIParsedResult) { SupplementalInfoRetriever uriRetriever = new URIResultInfoRetriever(textView, (URIParsedResult) result, historyManager, context); uriRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); SupplementalInfoRetriever titleRetriever = new TitleRetriever(textView, (URIParsedResult) result, historyManager); titleRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else if (result instanceof ProductParsedResult) { ProductParsedResult productParsedResult = (ProductParsedResult) result; String productID = productParsedResult.getProductID(); SupplementalInfoRetriever productRetriever = new ProductResultInfoRetriever(textView, productID, historyManager, context); productRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else if (result instanceof ISBNParsedResult) { String isbn = ((ISBNParsedResult) result).getISBN(); SupplementalInfoRetriever productInfoRetriever = new ProductResultInfoRetriever(textView, isbn, historyManager, context); productInfoRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); SupplementalInfoRetriever bookInfoRetriever = new BookResultInfoRetriever(textView, isbn, historyManager, context); bookInfoRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } } catch (RejectedExecutionException ree) { // do nothing } }
Example #14
Source File: ProductResultHandler.java From barcodescanner-lib-aar with MIT License | 5 votes |
private static String getProductIDFromResult(ParsedResult rawResult) { if (rawResult instanceof ProductParsedResult) { return ((ProductParsedResult) rawResult).getNormalizedProductID(); } if (rawResult instanceof ExpandedProductParsedResult) { return ((ExpandedProductParsedResult) rawResult).getRawText(); } throw new IllegalArgumentException(rawResult.getClass().toString()); }
Example #15
Source File: SupplementalInfoRetriever.java From Study_Android_Demo with Apache License 2.0 | 5 votes |
public static void maybeInvokeRetrieval(TextView textView, ParsedResult result, HistoryManager historyManager, Context context) { try { if (result instanceof URIParsedResult) { SupplementalInfoRetriever uriRetriever = new URIResultInfoRetriever(textView, (URIParsedResult) result, historyManager, context); uriRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); SupplementalInfoRetriever titleRetriever = new TitleRetriever(textView, (URIParsedResult) result, historyManager); titleRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else if (result instanceof ProductParsedResult) { ProductParsedResult productParsedResult = (ProductParsedResult) result; String productID = productParsedResult.getProductID(); SupplementalInfoRetriever productRetriever = new ProductResultInfoRetriever(textView, productID, historyManager, context); productRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else if (result instanceof ISBNParsedResult) { String isbn = ((ISBNParsedResult) result).getISBN(); SupplementalInfoRetriever productInfoRetriever = new ProductResultInfoRetriever(textView, isbn, historyManager, context); productInfoRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); SupplementalInfoRetriever bookInfoRetriever = new BookResultInfoRetriever(textView, isbn, historyManager, context); bookInfoRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } } catch (RejectedExecutionException ree) { // do nothing } }
Example #16
Source File: ProductResultHandler.java From Study_Android_Demo with Apache License 2.0 | 5 votes |
private static String getProductIDFromResult(ParsedResult rawResult) { if (rawResult instanceof ProductParsedResult) { return ((ProductParsedResult) rawResult).getNormalizedProductID(); } if (rawResult instanceof ExpandedProductParsedResult) { return ((ExpandedProductParsedResult) rawResult).getRawText(); } throw new IllegalArgumentException(rawResult.getClass().toString()); }
Example #17
Source File: SupplementalInfoRetriever.java From weex with Apache License 2.0 | 5 votes |
public static void maybeInvokeRetrieval(TextView textView, ParsedResult result, HistoryManager historyManager, Context context) { try { if (result instanceof URIParsedResult) { SupplementalInfoRetriever uriRetriever = new URIResultInfoRetriever(textView, (URIParsedResult) result, historyManager, context); uriRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); SupplementalInfoRetriever titleRetriever = new TitleRetriever(textView, (URIParsedResult) result, historyManager); titleRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else if (result instanceof ProductParsedResult) { ProductParsedResult productParsedResult = (ProductParsedResult) result; String productID = productParsedResult.getProductID(); SupplementalInfoRetriever productRetriever = new ProductResultInfoRetriever(textView, productID, historyManager, context); productRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else if (result instanceof ISBNParsedResult) { String isbn = ((ISBNParsedResult) result).getISBN(); SupplementalInfoRetriever productInfoRetriever = new ProductResultInfoRetriever(textView, isbn, historyManager, context); productInfoRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); SupplementalInfoRetriever bookInfoRetriever = new BookResultInfoRetriever(textView, isbn, historyManager, context); bookInfoRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } } catch (RejectedExecutionException ree) { // do nothing } }
Example #18
Source File: ProductResultHandler.java From weex with Apache License 2.0 | 5 votes |
private static String getProductIDFromResult(ParsedResult rawResult) { if (rawResult instanceof ProductParsedResult) { return ((ProductParsedResult) rawResult).getNormalizedProductID(); } if (rawResult instanceof ExpandedProductParsedResult) { return ((ExpandedProductParsedResult) rawResult).getRawText(); } throw new IllegalArgumentException(rawResult.getClass().toString()); }
Example #19
Source File: SupplementalInfoRetriever.java From analyzer-of-android-for-Apache-Weex with Apache License 2.0 | 5 votes |
public static void maybeInvokeRetrieval(TextView textView, ParsedResult result, HistoryManager historyManager, Context context) { try { if (result instanceof URIParsedResult) { SupplementalInfoRetriever uriRetriever = new URIResultInfoRetriever(textView, (URIParsedResult) result, historyManager, context); uriRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); SupplementalInfoRetriever titleRetriever = new TitleRetriever(textView, (URIParsedResult) result, historyManager); titleRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else if (result instanceof ProductParsedResult) { ProductParsedResult productParsedResult = (ProductParsedResult) result; String productID = productParsedResult.getProductID(); SupplementalInfoRetriever productRetriever = new ProductResultInfoRetriever(textView, productID, historyManager, context); productRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else if (result instanceof ISBNParsedResult) { String isbn = ((ISBNParsedResult) result).getISBN(); SupplementalInfoRetriever productInfoRetriever = new ProductResultInfoRetriever(textView, isbn, historyManager, context); productInfoRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); SupplementalInfoRetriever bookInfoRetriever = new BookResultInfoRetriever(textView, isbn, historyManager, context); bookInfoRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } } catch (RejectedExecutionException ree) { // do nothing } }
Example #20
Source File: ProductResultHandler.java From analyzer-of-android-for-Apache-Weex with Apache License 2.0 | 5 votes |
private static String getProductIDFromResult(ParsedResult rawResult) { if (rawResult instanceof ProductParsedResult) { return ((ProductParsedResult) rawResult).getNormalizedProductID(); } if (rawResult instanceof ExpandedProductParsedResult) { return ((ExpandedProductParsedResult) rawResult).getRawText(); } throw new IllegalArgumentException(rawResult.getClass().toString()); }
Example #21
Source File: ProductResultHandler.java From ZXing-Standalone-library with Apache License 2.0 | 5 votes |
private static String getProductIDFromResult(ParsedResult rawResult) { if (rawResult instanceof ProductParsedResult) { return ((ProductParsedResult) rawResult).getNormalizedProductID(); } if (rawResult instanceof ExpandedProductParsedResult) { return ((ExpandedProductParsedResult) rawResult).getRawText(); } throw new IllegalArgumentException(rawResult.getClass().toString()); }
Example #22
Source File: ProductResultProcessor.java From BarcodeEye with Apache License 2.0 | 4 votes |
public ProductResultProcessor(Context context, ProductParsedResult parsedResult, Result result, Uri photoUri) { super(context, parsedResult, result, photoUri); }
Example #23
Source File: SupplementalInfoRetriever.java From BarcodeEye with Apache License 2.0 | 4 votes |
public static void maybeInvokeRetrieval(TextView textView, ParsedResult result, Context context) { if (result instanceof URIParsedResult) { SupplementalInfoRetriever uriRetriever = new URIResultInfoRetriever(textView, (URIParsedResult) result, context); uriRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); SupplementalInfoRetriever titleRetriever = new TitleRetriever(textView, (URIParsedResult) result); titleRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else if (result instanceof ProductParsedResult) { ProductParsedResult productParsedResult = (ProductParsedResult) result; String productID = productParsedResult.getProductID(); String normalizedProductID = productParsedResult.getNormalizedProductID(); SupplementalInfoRetriever productRetriever = new ProductResultInfoRetriever(textView, productID, context); productRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); switch (productID.length()) { case 12: SupplementalInfoRetriever upcInfoRetriever = new AmazonInfoRetriever(textView, "UPC", normalizedProductID, context); upcInfoRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); break; case 13: SupplementalInfoRetriever eanInfoRetriever = new AmazonInfoRetriever(textView, "EAN", normalizedProductID, context); eanInfoRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); break; } } else if (result instanceof ISBNParsedResult) { String isbn = ((ISBNParsedResult) result).getISBN(); SupplementalInfoRetriever productInfoRetriever = new ProductResultInfoRetriever(textView, isbn, context); productInfoRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); SupplementalInfoRetriever bookInfoRetriever = new BookResultInfoRetriever(textView, isbn, context); bookInfoRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); SupplementalInfoRetriever amazonInfoRetriever = new AmazonInfoRetriever(textView, "ISBN", isbn, context); amazonInfoRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } }
Example #24
Source File: ProductResultFragment.java From privacy-friendly-qr-scanner with GNU General Public License v3.0 | 3 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); View v = inflater.inflate(R.layout.fragment_result_product, container, false); result = (ProductParsedResult) parsedResult; TextView resultText = v.findViewById(R.id.fragment_result_product_content); resultText.setText(result.getProductID()); return v; }