com.google.zxing.client.result.ISBNParsedResult Java Examples

The following examples show how to use com.google.zxing.client.result.ISBNParsedResult. 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: ISBNResultHandler.java    From ZXing-Standalone-library with Apache License 2.0 6 votes vote down vote up
@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;
  }
}
 
Example #2
Source File: ISBNResultHandler.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 6 votes vote down vote up
@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;
  }
}
 
Example #3
Source File: ISBNResultHandler.java    From weex with Apache License 2.0 6 votes vote down vote up
@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;
  }
}
 
Example #4
Source File: ISBNResultHandler.java    From Study_Android_Demo with Apache License 2.0 6 votes vote down vote up
@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;
  }
}
 
Example #5
Source File: ISBNResultHandler.java    From zxingfragmentlib with Apache License 2.0 6 votes vote down vote up
@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;
  }
}
 
Example #6
Source File: ISBNResultHandler.java    From barcodescanner-lib-aar with MIT License 6 votes vote down vote up
@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;
  }
}
 
Example #7
Source File: ISBNResultHandler.java    From reacteu-app with MIT License 6 votes vote down vote up
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());
     }
   });
 }
 
Example #8
Source File: ISBNResultHandler.java    From reacteu-app with MIT License 6 votes vote down vote up
@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;
  }
}
 
Example #9
Source File: SupplementalInfoRetriever.java    From reacteu-app with MIT License 6 votes vote down vote up
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 #10
Source File: ISBNResultHandler.java    From android-apps with MIT License 6 votes vote down vote up
@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;
  }
}
 
Example #11
Source File: SupplementalInfoRetriever.java    From android-apps with MIT License 6 votes vote down vote up
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 #12
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 #13
Source File: ResultProcessorFactory.java    From BarcodeEye with Apache License 2.0 5 votes vote down vote up
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 #14
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 #15
Source File: ISBNResultHandler.java    From android-quick-response-code with Apache License 2.0 5 votes vote down vote up
@Override
public CharSequence getDisplayContents() {
    ISBNParsedResult result = (ISBNParsedResult) getResult();
    StringBuilder contents = new StringBuilder(100);
    ParsedResult.maybeAppend(result.getISBN(), contents);
    contents.trimToSize();
    return contents.toString();
}
 
Example #16
Source File: ISBNResultHandler.java    From barterli_android with Apache License 2.0 5 votes vote down vote up
@Override
public CharSequence getDisplayContents() {
    ISBNParsedResult result = (ISBNParsedResult) getResult();
    StringBuilder contents = new StringBuilder(100);
    ParsedResult.maybeAppend(result.getISBN(), contents);
    contents.trimToSize();
    return contents.toString();
}
 
Example #17
Source File: ISBNResultHandler.java    From android-apps with MIT License 5 votes vote down vote up
public ISBNResultHandler(Activity activity, ParsedResult result, Result rawResult) {
  super(activity, result, rawResult);
  showGoogleShopperButton(new View.OnClickListener() {
    
    public void onClick(View view) {
      ISBNParsedResult isbnResult = (ISBNParsedResult) getResult();
      openGoogleShopper(isbnResult.getISBN());
    }
  });
}
 
Example #18
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 #19
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 #20
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 #21
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 #22
Source File: IsbnResultProcessor.java    From BarcodeEye with Apache License 2.0 4 votes vote down vote up
public IsbnResultProcessor(Context context, ISBNParsedResult 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 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);
  }
}