Java Code Examples for com.google.zxing.client.result.ProductParsedResult#getProductID()

The following examples show how to use com.google.zxing.client.result.ProductParsedResult#getProductID() . 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 ZXing-Standalone-library with Apache License 2.0 5 votes vote down vote up
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 2
Source File: SupplementalInfoRetriever.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 5 votes vote down vote up
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 3
Source File: SupplementalInfoRetriever.java    From weex with Apache License 2.0 5 votes vote down vote up
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: SupplementalInfoRetriever.java    From Study_Android_Demo with Apache License 2.0 5 votes vote down vote up
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 5
Source File: SupplementalInfoRetriever.java    From barcodescanner-lib-aar with MIT License 5 votes vote down vote up
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 6
Source File: SupplementalInfoRetriever.java    From zxingfragmentlib with Apache License 2.0 5 votes vote down vote up
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 7
Source File: SupplementalInfoRetriever.java    From BarcodeEye with Apache License 2.0 4 votes vote down vote up
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);
  }
}