Search in sources :

Example 1 with ISBNParsedResult

use of com.google.zxing.client.result.ISBNParsedResult in project zxingfragmentlib by mitoyarzun.

the class SupplementalInfoRetriever method maybeInvokeRetrieval.

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);
    }
}
Also used : ProductParsedResult(com.google.zxing.client.result.ProductParsedResult) SpannableString(android.text.SpannableString) URIParsedResult(com.google.zxing.client.result.URIParsedResult) ISBNParsedResult(com.google.zxing.client.result.ISBNParsedResult)

Example 2 with ISBNParsedResult

use of com.google.zxing.client.result.ISBNParsedResult in project zxing by zxing.

the class SupplementalInfoRetriever method maybeInvokeRetrieval.

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
    }
}
Also used : ProductParsedResult(com.google.zxing.client.result.ProductParsedResult) SpannableString(android.text.SpannableString) URIParsedResult(com.google.zxing.client.result.URIParsedResult) RejectedExecutionException(java.util.concurrent.RejectedExecutionException) ISBNParsedResult(com.google.zxing.client.result.ISBNParsedResult)

Example 3 with ISBNParsedResult

use of com.google.zxing.client.result.ISBNParsedResult in project BarcodeEye by BarcodeEye.

the class SupplementalInfoRetriever method maybeInvokeRetrieval.

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);
    }
}
Also used : ProductParsedResult(com.google.zxing.client.result.ProductParsedResult) SpannableString(android.text.SpannableString) URIParsedResult(com.google.zxing.client.result.URIParsedResult) ISBNParsedResult(com.google.zxing.client.result.ISBNParsedResult)

Example 4 with ISBNParsedResult

use of com.google.zxing.client.result.ISBNParsedResult in project weex-example by KalicyZhou.

the class SupplementalInfoRetriever method maybeInvokeRetrieval.

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
    }
}
Also used : ProductParsedResult(com.google.zxing.client.result.ProductParsedResult) SpannableString(android.text.SpannableString) URIParsedResult(com.google.zxing.client.result.URIParsedResult) RejectedExecutionException(java.util.concurrent.RejectedExecutionException) ISBNParsedResult(com.google.zxing.client.result.ISBNParsedResult)

Aggregations

SpannableString (android.text.SpannableString)4 ISBNParsedResult (com.google.zxing.client.result.ISBNParsedResult)4 ProductParsedResult (com.google.zxing.client.result.ProductParsedResult)4 URIParsedResult (com.google.zxing.client.result.URIParsedResult)4 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)2