Java Code Examples for com.google.zxing.client.result.ParsedResult#getType()

The following examples show how to use com.google.zxing.client.result.ParsedResult#getType() . 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: ResultHandlerFactory.java    From letv with Apache License 2.0 5 votes vote down vote up
public static ResultHandler makeResultHandler(SweepActivity activity, Result rawResult) {
    ParsedResult result = parseResult(rawResult);
    if (result.getType() == ParsedResultType.URI) {
        return new URIResultHandler(activity, result);
    }
    return new TextResultHandler(activity, result, rawResult);
}
 
Example 2
Source File: ResultHandlerFactory.java    From ZXing-Standalone-library with Apache License 2.0 5 votes vote down vote up
public static ResultHandler makeResultHandler(CaptureActivity activity, Result rawResult) {
  ParsedResult result = parseResult(rawResult);
  switch (result.getType()) {
    case ADDRESSBOOK:
      return new AddressBookResultHandler(activity, result);
    case EMAIL_ADDRESS:
      return new EmailAddressResultHandler(activity, result);
    case PRODUCT:
      return new ProductResultHandler(activity, result, rawResult);
    case URI:
      return new URIResultHandler(activity, result);
    case WIFI:
      return new WifiResultHandler(activity, result);
    case GEO:
      return new GeoResultHandler(activity, result);
    case TEL:
      return new TelResultHandler(activity, result);
    case SMS:
      return new SMSResultHandler(activity, result);
    case CALENDAR:
      return new CalendarResultHandler(activity, result);
    case ISBN:
      return new ISBNResultHandler(activity, result, rawResult);
    default:
      return new TextResultHandler(activity, result, rawResult);
  }
}
 
Example 3
Source File: ResultHandlerFactory.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 5 votes vote down vote up
public static ResultHandler makeResultHandler(CaptureActivity activity, Result rawResult) {
  ParsedResult result = parseResult(rawResult);
  switch (result.getType()) {
    case ADDRESSBOOK:
      return new AddressBookResultHandler(activity, result);
    case EMAIL_ADDRESS:
      return new EmailAddressResultHandler(activity, result);
    case PRODUCT:
      return new ProductResultHandler(activity, result, rawResult);
    case URI:
      return new URIResultHandler(activity, result);
    case WIFI:
      return new WifiResultHandler(activity, result);
    case GEO:
      return new GeoResultHandler(activity, result);
    case TEL:
      return new TelResultHandler(activity, result);
    case SMS:
      return new SMSResultHandler(activity, result);
    case CALENDAR:
      return new CalendarResultHandler(activity, result);
    case ISBN:
      return new ISBNResultHandler(activity, result, rawResult);
    default:
      return new TextResultHandler(activity, result, rawResult);
  }
}
 
Example 4
Source File: ResultHandlerFactory.java    From weex with Apache License 2.0 5 votes vote down vote up
public static ResultHandler makeResultHandler(CaptureActivity activity, Result rawResult) {
  ParsedResult result = parseResult(rawResult);
  switch (result.getType()) {
    case ADDRESSBOOK:
      return new AddressBookResultHandler(activity, result);
    case EMAIL_ADDRESS:
      return new EmailAddressResultHandler(activity, result);
    case PRODUCT:
      return new ProductResultHandler(activity, result, rawResult);
    case URI:
      return new URIResultHandler(activity, result);
    case WIFI:
      return new WifiResultHandler(activity, result);
    case GEO:
      return new GeoResultHandler(activity, result);
    case TEL:
      return new TelResultHandler(activity, result);
    case SMS:
      return new SMSResultHandler(activity, result);
    case CALENDAR:
      return new CalendarResultHandler(activity, result);
    case ISBN:
      return new ISBNResultHandler(activity, result, rawResult);
    default:
      return new TextResultHandler(activity, result, rawResult);
  }
}
 
Example 5
Source File: ResultHandlerFactory.java    From Study_Android_Demo with Apache License 2.0 5 votes vote down vote up
public static ResultHandler makeResultHandler(CaptureActivity activity, Result rawResult) {
  ParsedResult result = parseResult(rawResult);
  switch (result.getType()) {
    case ADDRESSBOOK:
      return new AddressBookResultHandler(activity, result);
    case EMAIL_ADDRESS:
      return new EmailAddressResultHandler(activity, result);
    case PRODUCT:
      return new ProductResultHandler(activity, result, rawResult);
    case URI:
      return new URIResultHandler(activity, result);
    case WIFI:
      return new WifiResultHandler(activity, result);
    case GEO:
      return new GeoResultHandler(activity, result);
    case TEL:
      return new TelResultHandler(activity, result);
    case SMS:
      return new SMSResultHandler(activity, result);
    case CALENDAR:
      return new CalendarResultHandler(activity, result);
    case ISBN:
      return new ISBNResultHandler(activity, result, rawResult);
    default:
      return new TextResultHandler(activity, result, rawResult);
  }
}
 
Example 6
Source File: ResultHandlerFactory.java    From barcodescanner-lib-aar with MIT License 5 votes vote down vote up
public static ResultHandler makeResultHandler(CaptureActivity activity, Result rawResult) {
  ParsedResult result = parseResult(rawResult);
  switch (result.getType()) {
    case ADDRESSBOOK:
      return new AddressBookResultHandler(activity, result);
    case EMAIL_ADDRESS:
      return new EmailAddressResultHandler(activity, result);
    case PRODUCT:
      return new ProductResultHandler(activity, result, rawResult);
    case URI:
      return new URIResultHandler(activity, result);
    case WIFI:
      return new WifiResultHandler(activity, result);
    case GEO:
      return new GeoResultHandler(activity, result);
    case TEL:
      return new TelResultHandler(activity, result);
    case SMS:
      return new SMSResultHandler(activity, result);
    case CALENDAR:
      return new CalendarResultHandler(activity, result);
    case ISBN:
      return new ISBNResultHandler(activity, result, rawResult);
    default:
      return new TextResultHandler(activity, result, rawResult);
  }
}
 
Example 7
Source File: ResultHandlerFactory.java    From reacteu-app with MIT License 5 votes vote down vote up
public static ResultHandler makeResultHandler(CaptureActivity activity, Result rawResult) {
  ParsedResult result = parseResult(rawResult);
  switch (result.getType()) {
    case ADDRESSBOOK:
      return new AddressBookResultHandler(activity, result);
    case EMAIL_ADDRESS:
      return new EmailAddressResultHandler(activity, result);
    case PRODUCT:
      return new ProductResultHandler(activity, result, rawResult);
    case URI:
      return new URIResultHandler(activity, result);
    case WIFI:
      return new WifiResultHandler(activity, result);
    case GEO:
      return new GeoResultHandler(activity, result);
    case TEL:
      return new TelResultHandler(activity, result);
    case SMS:
      return new SMSResultHandler(activity, result);
    case CALENDAR:
      return new CalendarResultHandler(activity, result);
    case ISBN:
      return new ISBNResultHandler(activity, result, rawResult);
    default:
      return new TextResultHandler(activity, result, rawResult);
  }
}
 
Example 8
Source File: ResultHandlerFactory.java    From android-apps with MIT License 5 votes vote down vote up
public static ResultHandler makeResultHandler(CaptureActivity activity, Result rawResult) {
  ParsedResult result = parseResult(rawResult);
  switch (result.getType()) {
    case ADDRESSBOOK:
      return new AddressBookResultHandler(activity, result);
    case EMAIL_ADDRESS:
      return new EmailAddressResultHandler(activity, result);
    case PRODUCT:
      return new ProductResultHandler(activity, result, rawResult);
    case URI:
      return new URIResultHandler(activity, result);
    case WIFI:
      return new WifiResultHandler(activity, result);
    case GEO:
      return new GeoResultHandler(activity, result);
    case TEL:
      return new TelResultHandler(activity, result);
    case SMS:
      return new SMSResultHandler(activity, result);
    case CALENDAR:
      return new CalendarResultHandler(activity, result);
    case ISBN:
      return new ISBNResultHandler(activity, result, rawResult);
    default:
      return new TextResultHandler(activity, result, rawResult);
  }
}
 
Example 9
Source File: ResultHandlerFactory.java    From barterli_android with Apache License 2.0 5 votes vote down vote up
public static ResultHandler makeResultHandler(Activity activity, Result rawResult) {
    ParsedResult result = parseResult(rawResult);
    switch (result.getType()) {
    case ADDRESSBOOK:
        return new AddressBookResultHandler(activity, result);
    case EMAIL_ADDRESS:
        return new EmailAddressResultHandler(activity, result);
    case PRODUCT:
        return new ProductResultHandler(activity, result, rawResult);
    case URI:
        return new URIResultHandler(activity, result);
    case WIFI:
        return new WifiResultHandler(activity, result);
    case TEXT:
        return new TextResultHandler(activity, result, rawResult);
    case GEO:
        return new GeoResultHandler(activity, result);
    case TEL:
        return new TelResultHandler(activity, result);
    case SMS:
        return new SMSResultHandler(activity, result);
    case CALENDAR:
        return new CalendarResultHandler(activity, result);
    case ISBN:
        return new ISBNResultHandler(activity, result, rawResult);
    }
    return new TextResultHandler(activity, result, rawResult);
}
 
Example 10
Source File: ResultHandlerFactory.java    From android-quick-response-code with Apache License 2.0 5 votes vote down vote up
public static ResultHandler makeResultHandler(Activity activity, Result rawResult) {
    ParsedResult result = parseResult(rawResult);
    switch (result.getType()) {
    case ADDRESSBOOK:
        return new AddressBookResultHandler(activity, result);
    case EMAIL_ADDRESS:
        return new EmailAddressResultHandler(activity, result);
    case PRODUCT:
        return new ProductResultHandler(activity, result, rawResult);
    case URI:
        return new URIResultHandler(activity, result);
    case WIFI:
        return new WifiResultHandler(activity, result);
    case TEXT:
        return new TextResultHandler(activity, result, rawResult);
    case GEO:
        return new GeoResultHandler(activity, result);
    case TEL:
        return new TelResultHandler(activity, result);
    case SMS:
        return new SMSResultHandler(activity, result);
    case CALENDAR:
        return new CalendarResultHandler(activity, result);
    case ISBN:
        return new ISBNResultHandler(activity, result, rawResult);
    case VIN:
        // TODO: Justin
        break;
    default:
        break;
    }
    return new TextResultHandler(activity, result, rawResult);
}
 
Example 11
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 12
Source File: ResultActivity.java    From privacy-friendly-qr-scanner with GNU General Public License v3.0 4 votes vote down vote up
private void loadFragment(@NonNull ParsedResult parsedResult) {
    FragmentTransaction ft = getSupportFragmentManager().beginTransaction();

    ResultFragment resultFragment;

    switch (parsedResult.getType()) {
        case ADDRESSBOOK:
            resultFragment = new ContactResultFragment();
            break;
        case EMAIL_ADDRESS:
            resultFragment = new EmailResultFragment();
            break;
        case PRODUCT:
            resultFragment = new ProductResultFragment();
            break;
        case URI:
            resultFragment = new URLResultFragment();
            break;
        case GEO:
            resultFragment = new GeoResultFragment();
            break;
        case TEL:
            resultFragment = new TelResultFragment();
            break;
        case SMS:
            resultFragment = new SMSResultFragment();
            break;
        case WIFI:
            resultFragment = new WifiResultFragment();
            break;
        case ISBN:
            // TODO: add isbn fragment
        case VIN:
            // TODO: add vin fragment
        case CALENDAR:
            // TODO: add calendar fragment
        case TEXT:
        default:
            resultFragment = new TextResultFragment();
            break;
    }

    currentResultFragment = resultFragment;

    resultFragment.putQRCode(parsedResult);

    ft.replace(R.id.activity_result_frame_layout, resultFragment);
    ft.commit();
}