Search in sources :

Example 1 with CardPresenter

use of com.github.barcodeeye.scan.api.CardPresenter in project BarcodeEye by BarcodeEye.

the class ProductResultProcessor method getCardResults.

@Override
public List<CardPresenter> getCardResults() {
    List<CardPresenter> cardPresenters = new ArrayList<CardPresenter>();
    ParsedResult parsedResult = getParsedResult();
    String codeValue = parsedResult.getDisplayResult();
    for (String key : PRODUCT_SEARCH_ENDPOINTS.keySet()) {
        CardPresenter cardPresenter = new CardPresenter();
        cardPresenter.setText("Lookup on " + key).setFooter(codeValue);
        String url = PRODUCT_SEARCH_ENDPOINTS.get(key);
        url = url.replace("{CODE}", codeValue);
        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setData(Uri.parse(url));
        cardPresenter.setPendingIntent(createPendingIntent(getContext(), intent));
        if (getPhotoUri() != null) {
            cardPresenter.addImage(getPhotoUri());
        }
        cardPresenters.add(cardPresenter);
    }
    return cardPresenters;
}
Also used : ArrayList(java.util.ArrayList) CardPresenter(com.github.barcodeeye.scan.api.CardPresenter) ParsedResult(com.google.zxing.client.result.ParsedResult) ProductParsedResult(com.google.zxing.client.result.ProductParsedResult) Intent(android.content.Intent)

Example 2 with CardPresenter

use of com.github.barcodeeye.scan.api.CardPresenter in project BarcodeEye by BarcodeEye.

the class TextResultProcessor method getCardResults.

@Override
public List<CardPresenter> getCardResults() {
    List<CardPresenter> cardPresenters = new ArrayList<CardPresenter>();
    ParsedResult parsedResult = getParsedResult();
    String codeValue = parsedResult.getDisplayResult();
    CardPresenter cardPresenter = new CardPresenter();
    cardPresenter.setText("Search Web").setFooter(codeValue);
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(Uri.parse(String.format(SEARCH_URL, codeValue)));
    cardPresenter.setPendingIntent(createPendingIntent(getContext(), intent));
    cardPresenters.add(cardPresenter);
    return cardPresenters;
}
Also used : ArrayList(java.util.ArrayList) CardPresenter(com.github.barcodeeye.scan.api.CardPresenter) ParsedResult(com.google.zxing.client.result.ParsedResult) Intent(android.content.Intent)

Example 3 with CardPresenter

use of com.github.barcodeeye.scan.api.CardPresenter in project BarcodeEye by BarcodeEye.

the class UriResultProcessor method getCardResults.

@Override
public List<CardPresenter> getCardResults() {
    List<CardPresenter> cardResults = new ArrayList<CardPresenter>();
    URIParsedResult parsedResult = getParsedResult();
    CardPresenter cardPresenter = new CardPresenter().setText("Open in Browser").setFooter(parsedResult.getDisplayResult());
    if (getPhotoUri() != null) {
        cardPresenter.addImage(getPhotoUri());
    }
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(Uri.parse(parsedResult.getURI()));
    cardPresenter.setPendingIntent(createPendingIntent(getContext(), intent));
    cardResults.add(cardPresenter);
    return cardResults;
}
Also used : ArrayList(java.util.ArrayList) CardPresenter(com.github.barcodeeye.scan.api.CardPresenter) Intent(android.content.Intent) URIParsedResult(com.google.zxing.client.result.URIParsedResult)

Example 4 with CardPresenter

use of com.github.barcodeeye.scan.api.CardPresenter in project BarcodeEye by BarcodeEye.

the class IsbnResultProcessor method getCardResults.

@Override
public List<CardPresenter> getCardResults() {
    List<CardPresenter> cardPresenters = new ArrayList<CardPresenter>();
    ParsedResult parsedResult = getParsedResult();
    String codeValue = parsedResult.getDisplayResult();
    for (String key : PRODUCT_SEARCH_ENDPOINTS.keySet()) {
        CardPresenter cardPresenter = new CardPresenter();
        cardPresenter.setText("Lookup on " + key).setFooter(codeValue);
        String url = PRODUCT_SEARCH_ENDPOINTS.get(key);
        url = url.replace("{CODE}", codeValue);
        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setData(Uri.parse(url));
        cardPresenter.setPendingIntent(createPendingIntent(getContext(), intent));
        if (getPhotoUri() != null) {
            cardPresenter.addImage(getPhotoUri());
        }
        cardPresenters.add(cardPresenter);
    }
    return cardPresenters;
}
Also used : ArrayList(java.util.ArrayList) CardPresenter(com.github.barcodeeye.scan.api.CardPresenter) ParsedResult(com.google.zxing.client.result.ParsedResult) ISBNParsedResult(com.google.zxing.client.result.ISBNParsedResult) Intent(android.content.Intent)

Aggregations

Intent (android.content.Intent)4 CardPresenter (com.github.barcodeeye.scan.api.CardPresenter)4 ArrayList (java.util.ArrayList)4 ParsedResult (com.google.zxing.client.result.ParsedResult)3 ISBNParsedResult (com.google.zxing.client.result.ISBNParsedResult)1 ProductParsedResult (com.google.zxing.client.result.ProductParsedResult)1 URIParsedResult (com.google.zxing.client.result.URIParsedResult)1