use of com.google.zxing.client.result.URIParsedResult in project zxingfragmentlib by mitoyarzun.
the class URIResultHandler method areContentsSecure.
@Override
public boolean areContentsSecure() {
URIParsedResult uriResult = (URIParsedResult) getResult();
String uri = uriResult.getURI().toLowerCase(Locale.ENGLISH);
for (String secure : SECURE_PROTOCOLS) {
if (uri.startsWith(secure)) {
return true;
}
}
return false;
}
use of com.google.zxing.client.result.URIParsedResult 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);
}
}
use of com.google.zxing.client.result.URIParsedResult in project weex-example by KalicyZhou.
the class URIResultHandler method areContentsSecure.
@Override
public boolean areContentsSecure() {
URIParsedResult uriResult = (URIParsedResult) getResult();
String uri = uriResult.getURI().toLowerCase(Locale.ENGLISH);
for (String secure : SECURE_PROTOCOLS) {
if (uri.startsWith(secure)) {
return true;
}
}
return false;
}
use of com.google.zxing.client.result.URIParsedResult in project weex-example by KalicyZhou.
the class URIResultHandler method handleButtonPress.
@Override
public void handleButtonPress(int index) {
URIParsedResult uriResult = (URIParsedResult) getResult();
String uri = uriResult.getURI();
switch(index) {
case 0:
openURL(uri);
break;
case 1:
shareByEmail(uri);
break;
case 2:
shareBySMS(uri);
break;
case 3:
searchBookContents(uri);
break;
}
}
use of com.google.zxing.client.result.URIParsedResult in project zxing by zxing.
the class CaptureActivity method handleResult.
private void handleResult(Result result) {
ParsedResult parsed = ResultParser.parseResult(result);
Intent intent;
if (parsed.getType() == ParsedResultType.URI) {
intent = new Intent(Intent.ACTION_VIEW, Uri.parse(((URIParsedResult) parsed).getURI()));
} else {
intent = new Intent(Intent.ACTION_WEB_SEARCH);
intent.putExtra("query", ((TextParsedResult) parsed).getText());
}
startActivity(intent);
}
Aggregations