Java 类com.google.zxing.client.result.ParsedResult 实例源码

项目:keepass2android    文件:AddressBookResultHandler.java   
public AddressBookResultHandler(Activity activity, ParsedResult result) {
  super(activity, result);
  AddressBookParsedResult addressResult = (AddressBookParsedResult) result;
  String[] addresses = addressResult.getAddresses();
  boolean hasAddress = addresses != null && addresses.length > 0 && addresses[0] != null && !addresses[0].isEmpty();
  String[] phoneNumbers = addressResult.getPhoneNumbers();
  boolean hasPhoneNumber = phoneNumbers != null && phoneNumbers.length > 0;
  String[] emails = addressResult.getEmails();
  boolean hasEmailAddress = emails != null && emails.length > 0;

  fields = new boolean[MAX_BUTTON_COUNT];
  fields[0] = true; // Add contact is always available
  fields[1] = hasAddress;
  fields[2] = hasPhoneNumber;
  fields[3] = hasEmailAddress;

  buttonCount = 0;
  for (int x = 0; x < MAX_BUTTON_COUNT; x++) {
    if (fields[x]) {
      buttonCount++;
    }
  }
}
项目:keepass2android    文件:ResultHandler.java   
final String fillInCustomSearchURL(String text) {
  if (customProductSearch == null) {
    return text; // ?
  }
  try {
    text = URLEncoder.encode(text, "UTF-8");
  } catch (UnsupportedEncodingException e) {
    // can't happen; UTF-8 is always supported. Continue, I guess, without encoding      
  }
  String url = customProductSearch.replace("%s", text);
  if (rawResult != null) {
    url = url.replace("%f", rawResult.getBarcodeFormat().toString());
    if (url.contains("%t")) {
      ParsedResult parsedResultAgain = ResultParser.parseResult(rawResult);
      url = url.replace("%t", parsedResultAgain.getType().toString());
    }
  }
  return url;
}
项目:weex-3d-map    文件:AddressBookResultHandler.java   
public AddressBookResultHandler(Activity activity, ParsedResult result) {
  super(activity, result);
  AddressBookParsedResult addressResult = (AddressBookParsedResult) result;
  String[] addresses = addressResult.getAddresses();
  boolean hasAddress = addresses != null && addresses.length > 0 && addresses[0] != null && !addresses[0].isEmpty();
  String[] phoneNumbers = addressResult.getPhoneNumbers();
  boolean hasPhoneNumber = phoneNumbers != null && phoneNumbers.length > 0;
  String[] emails = addressResult.getEmails();
  boolean hasEmailAddress = emails != null && emails.length > 0;

  fields = new boolean[MAX_BUTTON_COUNT];
  fields[0] = true; // Add contact is always available
  fields[1] = hasAddress;
  fields[2] = hasPhoneNumber;
  fields[3] = hasEmailAddress;

  buttonCount = 0;
  for (int x = 0; x < MAX_BUTTON_COUNT; x++) {
    if (fields[x]) {
      buttonCount++;
    }
  }
}
项目:weex-3d-map    文件:ResultHandler.java   
final String fillInCustomSearchURL(String text) {
  if (customProductSearch == null) {
    return text; // ?
  }
  try {
    text = URLEncoder.encode(text, "UTF-8");
  } catch (UnsupportedEncodingException e) {
    // can't happen; UTF-8 is always supported. Continue, I guess, without encoding      
  }
  String url = customProductSearch;
  if (rawResult != null) {
    // Replace %f but only if it doesn't seem to be a hex escape sequence. This remains
    // problematic but avoids the more surprising problem of breaking escapes
    url = url.replaceFirst("%f(?![0-9a-f])", rawResult.getBarcodeFormat().toString());
    if (url.contains("%t")) {
      ParsedResult parsedResultAgain = ResultParser.parseResult(rawResult);
      url = url.replace("%t", parsedResultAgain.getType().toString());
    }
  }
  // Replace %s last as it might contain itself %f or %t
  return url.replace("%s", text);
}
项目:ZXingAndroidExt    文件:AddressBookResultHandler.java   
public AddressBookResultHandler(Activity activity, ParsedResult result) {
    super(activity, result);
    AddressBookParsedResult addressResult = (AddressBookParsedResult) result;
    String[] addresses = addressResult.getAddresses();
    String[] phoneNumbers = addressResult.getPhoneNumbers();
    String[] emails = addressResult.getEmails();

    fields = new boolean[MAX_BUTTON_COUNT];
    fields[0] = true; // Add contact is always available
    fields[1] = addresses != null && addresses.length > 0 && addresses[0] != null && !addresses[0].isEmpty();
    fields[2] = phoneNumbers != null && phoneNumbers.length > 0;
    fields[3] = emails != null && emails.length > 0;

    buttonCount = 0;
    for (int x = 0; x < MAX_BUTTON_COUNT; x++) {
        if (fields[x]) {
            buttonCount++;
        }
    }
}
项目:ZXingAndroidExt    文件:ResultHandler.java   
final String fillInCustomSearchURL(String text) {
    if (customProductSearch == null) {
        return text; // ?
    }
    try {
        text = URLEncoder.encode(text, "UTF-8");
    } catch (UnsupportedEncodingException e) {
        // can't happen; UTF-8 is always supported. Continue, I guess, without encoding
    }
    String url = customProductSearch;
    if (rawResult != null) {
        // Replace %f but only if it doesn't seem to be a hex escape sequence. This remains
        // problematic but avoids the more surprising problem of breaking escapes
        url = url.replaceFirst("%f(?![0-9a-f])", rawResult.getBarcodeFormat().toString());
        if (url.contains("%t")) {
            ParsedResult parsedResultAgain = ResultParser.parseResult(rawResult);
            url = url.replace("%t", parsedResultAgain.getType().toString());
        }
    }
    // Replace %s last as it might contain itself %f or %t
    return url.replace("%s", text);
}
项目:tvConnect_android    文件:AddressBookResultHandler.java   
public AddressBookResultHandler(Activity activity, ParsedResult result) {
    super(activity, result);
    AddressBookParsedResult addressResult = (AddressBookParsedResult) result;
    String[] addresses = addressResult.getAddresses();
    boolean hasAddress = addresses != null && addresses.length > 0
            && addresses[0] != null && !addresses[0].isEmpty();
    String[] phoneNumbers = addressResult.getPhoneNumbers();
    boolean hasPhoneNumber = phoneNumbers != null
            && phoneNumbers.length > 0;
    String[] emails = addressResult.getEmails();
    boolean hasEmailAddress = emails != null && emails.length > 0;

    fields = new boolean[MAX_BUTTON_COUNT];
    fields[0] = true; // Add contact is always available
    fields[1] = hasAddress;
    fields[2] = hasPhoneNumber;
    fields[3] = hasEmailAddress;

    buttonCount = 0;
    for (int x = 0; x < MAX_BUTTON_COUNT; x++) {
        if (fields[x]) {
            buttonCount++;
        }
    }
}
项目:tvConnect_android    文件:ResultHandler.java   
final String fillInCustomSearchURL(String text) {
  if (customProductSearch == null) {
    return text; // ?
  }
  try {
    text = URLEncoder.encode(text, "UTF-8");
  } catch (UnsupportedEncodingException e) {
    // can't happen; UTF-8 is always supported. Continue, I guess, without encoding      
  }
  String url = customProductSearch;
  if (rawResult != null) {
    // Replace %f but only if it doesn't seem to be a hex escape sequence. This remains
    // problematic but avoids the more surprising problem of breaking escapes
    url = url.replaceFirst("%f(?![0-9a-f])", rawResult.getBarcodeFormat().toString());
    if (url.contains("%t")) {
      ParsedResult parsedResultAgain = ResultParser.parseResult(rawResult);
      url = url.replace("%t", parsedResultAgain.getType().toString());
    }
  }
  // Replace %s last as it might contain itself %f or %t
  return url.replace("%s", text);
}
项目:tvConnect_android    文件:ResultHandler.java   
final String fillInCustomSearchURL(String text) {
  if (customProductSearch == null) {
    return text; // ?
  }
  try {
    text = URLEncoder.encode(text, "UTF-8");
  } catch (UnsupportedEncodingException e) {
    // can't happen; UTF-8 is always supported. Continue, I guess, without encoding      
  }
  String url = customProductSearch;
  if (rawResult != null) {
    // Replace %f but only if it doesn't seem to be a hex escape sequence. This remains
    // problematic but avoids the more surprising problem of breaking escapes
    url = url.replaceFirst("%f(?![0-9a-f])", rawResult.getBarcodeFormat().toString());
    if (url.contains("%t")) {
      ParsedResult parsedResultAgain = ResultParser.parseResult(rawResult);
      url = url.replace("%t", parsedResultAgain.getType().toString());
    }
  }
  // Replace %s last as it might contain itself %f or %t
  return url.replace("%s", text);
}
项目:tvConnect_android    文件:AddressBookResultHandler.java   
public AddressBookResultHandler(Activity activity, ParsedResult result) {
    super(activity, result);
    AddressBookParsedResult addressResult = (AddressBookParsedResult) result;
    String[] addresses = addressResult.getAddresses();
    boolean hasAddress = addresses != null && addresses.length > 0
            && addresses[0] != null && !addresses[0].isEmpty();
    String[] phoneNumbers = addressResult.getPhoneNumbers();
    boolean hasPhoneNumber = phoneNumbers != null
            && phoneNumbers.length > 0;
    String[] emails = addressResult.getEmails();
    boolean hasEmailAddress = emails != null && emails.length > 0;

    fields = new boolean[MAX_BUTTON_COUNT];
    fields[0] = true; // Add contact is always available
    fields[1] = hasAddress;
    fields[2] = hasPhoneNumber;
    fields[3] = hasEmailAddress;

    buttonCount = 0;
    for (int x = 0; x < MAX_BUTTON_COUNT; x++) {
        if (fields[x]) {
            buttonCount++;
        }
    }
}
项目:keepass2android    文件:QRCodeEncoder.java   
private void encodeFromStreamExtra(Intent intent) throws WriterException {
  format = BarcodeFormat.QR_CODE;
  Bundle bundle = intent.getExtras();
  if (bundle == null) {
    throw new WriterException("No extras");
  }
  Uri uri = bundle.getParcelable(Intent.EXTRA_STREAM);
  if (uri == null) {
    throw new WriterException("No EXTRA_STREAM");
  }
  byte[] vcard;
  String vcardString;
  try {
    InputStream stream = activity.getContentResolver().openInputStream(uri);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    byte[] buffer = new byte[2048];
    int bytesRead;
    while ((bytesRead = stream.read(buffer)) > 0) {
      baos.write(buffer, 0, bytesRead);
    }
    vcard = baos.toByteArray();
    vcardString = new String(vcard, 0, vcard.length, "UTF-8");
  } catch (IOException ioe) {
    throw new WriterException(ioe);
  }
  Log.d(TAG, "Encoding share intent content:");
  Log.d(TAG, vcardString);
  Result result = new Result(vcardString, vcard, null, BarcodeFormat.QR_CODE);
  ParsedResult parsedResult = ResultParser.parseResult(result);
  if (!(parsedResult instanceof AddressBookParsedResult)) {
    throw new WriterException("Result was not an address");
  }
  encodeQRCodeContents((AddressBookParsedResult) parsedResult);
  if (contents == null || contents.isEmpty()) {
    throw new WriterException("No content to encode");
  }
}
项目:keepass2android    文件:ProductResultHandler.java   
private static String getProductIDFromResult(ParsedResult rawResult) {
  if (rawResult instanceof ProductParsedResult) {
    return ((ProductParsedResult) rawResult).getNormalizedProductID();
  }
  if (rawResult instanceof ExpandedProductParsedResult) {
    return ((ExpandedProductParsedResult) rawResult).getRawText();
  }
  throw new IllegalArgumentException(rawResult.getClass().toString());
}
项目:keepass2android    文件:WifiResultHandler.java   
@Override
public CharSequence getDisplayContents() {
  WifiParsedResult wifiResult = (WifiParsedResult) getResult();
  StringBuilder contents = new StringBuilder(50);
  String wifiLabel = parent.getString(R.string.wifi_ssid_label);
  ParsedResult.maybeAppend(wifiLabel + '\n' + wifiResult.getSsid(), contents);
  String typeLabel = parent.getString(R.string.wifi_type_label);
  ParsedResult.maybeAppend(typeLabel + '\n' + wifiResult.getNetworkEncryption(), contents);
  return contents.toString();
}
项目:keepass2android    文件:SMSResultHandler.java   
@Override
public CharSequence getDisplayContents() {
  SMSParsedResult smsResult = (SMSParsedResult) getResult();
  String[] rawNumbers = smsResult.getNumbers();
  String[] formattedNumbers = new String[rawNumbers.length];
  for (int i = 0; i < rawNumbers.length; i++) {
    formattedNumbers[i] = PhoneNumberUtils.formatNumber(rawNumbers[i]);
  }
  StringBuilder contents = new StringBuilder(50);
  ParsedResult.maybeAppend(formattedNumbers, contents);
  ParsedResult.maybeAppend(smsResult.getSubject(), contents);
  ParsedResult.maybeAppend(smsResult.getBody(), contents);
  return contents.toString();
}
项目:weex-3d-map    文件:ProductResultHandler.java   
private static String getProductIDFromResult(ParsedResult rawResult) {
  if (rawResult instanceof ProductParsedResult) {
    return ((ProductParsedResult) rawResult).getNormalizedProductID();
  }
  if (rawResult instanceof ExpandedProductParsedResult) {
    return ((ExpandedProductParsedResult) rawResult).getRawText();
  }
  throw new IllegalArgumentException(rawResult.getClass().toString());
}
项目:weex-3d-map    文件:ResultHandlerFactory.java   
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);
  }
}
项目:tvConnect_android    文件:SMSResultHandler.java   
@Override
public CharSequence getDisplayContents() {
    SMSParsedResult smsResult = (SMSParsedResult) getResult();
    String[] rawNumbers = smsResult.getNumbers();
    String[] formattedNumbers = new String[rawNumbers.length];
    for (int i = 0; i < rawNumbers.length; i++) {
        formattedNumbers[i] = PhoneNumberUtils.formatNumber(rawNumbers[i]);
    }
    StringBuilder contents = new StringBuilder(50);
    ParsedResult.maybeAppend(formattedNumbers, contents);
    ParsedResult.maybeAppend(smsResult.getSubject(), contents);
    ParsedResult.maybeAppend(smsResult.getBody(), contents);
    return contents.toString();
}
项目:weex-3d-map    文件:SMSResultHandler.java   
@Override
public CharSequence getDisplayContents() {
  SMSParsedResult smsResult = (SMSParsedResult) getResult();
  String[] rawNumbers = smsResult.getNumbers();
  String[] formattedNumbers = new String[rawNumbers.length];
  for (int i = 0; i < rawNumbers.length; i++) {
    formattedNumbers[i] = PhoneNumberUtils.formatNumber(rawNumbers[i]);
  }
  StringBuilder contents = new StringBuilder(50);
  ParsedResult.maybeAppend(formattedNumbers, contents);
  ParsedResult.maybeAppend(smsResult.getSubject(), contents);
  ParsedResult.maybeAppend(smsResult.getBody(), contents);
  return contents.toString();
}
项目:letv    文件:ResultHandlerFactory.java   
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);
}
项目:ZXingAndroidExt    文件:ProductResultHandler.java   
private static String getProductIDFromResult(ParsedResult rawResult) {
    if (rawResult instanceof ProductParsedResult) {
        return ((ProductParsedResult) rawResult).getNormalizedProductID();
    }
    if (rawResult instanceof ExpandedProductParsedResult) {
        return ((ExpandedProductParsedResult) rawResult).getRawText();
    }
    throw new IllegalArgumentException(rawResult.getClass().toString());
}
项目:ZXingAndroidExt    文件:ResultHandlerFactory.java   
public static ResultHandler makeResultHandler(QrCodeScannerActivity 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);
    }
}
项目:ZXingAndroidExt    文件:SupplementalInfoRetriever.java   
public static void maybeInvokeRetrieval(TextView textView,
                                        ParsedResult result,
                                        Context context) {
    try {
        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();
            SupplementalInfoRetriever productRetriever =
                    new ProductResultInfoRetriever(textView, productID, context);
            productRetriever.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
        } 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);
        }
    } catch (RejectedExecutionException ree) {
        // do nothing
    }
}
项目:ZXingAndroidExt    文件:CalendarResultHandler.java   
@Override
public CharSequence getDisplayContents() {

    CalendarParsedResult calResult = (CalendarParsedResult) getResult();
    StringBuilder result = new StringBuilder(100);

    ParsedResult.maybeAppend(calResult.getSummary(), result);

    long start = calResult.getStartTimestamp();
    ParsedResult.maybeAppend(format(calResult.isStartAllDay(), start), result);

    long end = calResult.getEndTimestamp();
    if (end >= 0L) {
        if (calResult.isEndAllDay() && start != end) {
            // Show only year/month/day
            // if it's all-day and this is the end date, it's exclusive, so show the user
            // that it ends on the day before to make more intuitive sense.
            // But don't do it if the event already (incorrectly?) specifies the same start/end
            end -= 24 * 60 * 60 * 1000;
        }
        ParsedResult.maybeAppend(format(calResult.isEndAllDay(), end), result);
    }

    ParsedResult.maybeAppend(calResult.getLocation(), result);
    ParsedResult.maybeAppend(calResult.getOrganizer(), result);
    ParsedResult.maybeAppend(calResult.getAttendees(), result);
    ParsedResult.maybeAppend(calResult.getDescription(), result);
    return result.toString();
}
项目:ZXingAndroidExt    文件:SMSResultHandler.java   
@Override
public CharSequence getDisplayContents() {
    SMSParsedResult smsResult = (SMSParsedResult) getResult();
    String[] rawNumbers = smsResult.getNumbers();
    String[] formattedNumbers = new String[rawNumbers.length];
    for (int i = 0; i < rawNumbers.length; i++) {
        formattedNumbers[i] = PhoneNumberUtils.formatNumber(rawNumbers[i]);
    }
    StringBuilder contents = new StringBuilder(50);
    ParsedResult.maybeAppend(formattedNumbers, contents);
    ParsedResult.maybeAppend(smsResult.getSubject(), contents);
    ParsedResult.maybeAppend(smsResult.getBody(), contents);
    return contents.toString();
}
项目:tvConnect_android    文件:ProductResultHandler.java   
private static String getProductIDFromResult(ParsedResult rawResult) {
  if (rawResult instanceof ProductParsedResult) {
    return ((ProductParsedResult) rawResult).getNormalizedProductID();
  }
  if (rawResult instanceof ExpandedProductParsedResult) {
    return ((ExpandedProductParsedResult) rawResult).getRawText();
  }
  throw new IllegalArgumentException(rawResult.getClass().toString());
}
项目:tvConnect_android    文件:ResultHandlerFactory.java   
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);
  }
}
项目:appinventor-extensions    文件:ResultHandler.java   
ResultHandler(Activity activity, ParsedResult result, Result rawResult) {
  this.result = result;
  this.activity = activity;
  this.rawResult = rawResult;
  this.customProductSearch = parseCustomSearchURL();

  // Make sure the Shopper button is hidden by default. Without this, scanning a product followed
  // by a QR Code would leave the button on screen among the QR Code actions.
}
项目:tvConnect_android    文件:SMSResultHandler.java   
@Override
public CharSequence getDisplayContents() {
    SMSParsedResult smsResult = (SMSParsedResult) getResult();
    String[] rawNumbers = smsResult.getNumbers();
    String[] formattedNumbers = new String[rawNumbers.length];
    for (int i = 0; i < rawNumbers.length; i++) {
        formattedNumbers[i] = PhoneNumberUtils.formatNumber(rawNumbers[i]);
    }
    StringBuilder contents = new StringBuilder(50);
    ParsedResult.maybeAppend(formattedNumbers, contents);
    ParsedResult.maybeAppend(smsResult.getSubject(), contents);
    ParsedResult.maybeAppend(smsResult.getBody(), contents);
    return contents.toString();
}
项目:tvConnect_android    文件:ProductResultHandler.java   
private static String getProductIDFromResult(ParsedResult rawResult) {
  if (rawResult instanceof ProductParsedResult) {
    return ((ProductParsedResult) rawResult).getNormalizedProductID();
  }
  if (rawResult instanceof ExpandedProductParsedResult) {
    return ((ExpandedProductParsedResult) rawResult).getRawText();
  }
  throw new IllegalArgumentException(rawResult.getClass().toString());
}
项目:tvConnect_android    文件:ResultHandlerFactory.java   
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);
  }
}
项目:keepass2android    文件:URIResultHandler.java   
public URIResultHandler(Activity activity, ParsedResult result) {
  super(activity, result);
}
项目:appinventor-extensions    文件:TextResultHandler.java   
public TextResultHandler(Activity activity, ParsedResult result, Result rawResult) {
  super(activity, result, rawResult);
}
项目:keepass2android    文件:TextResultHandler.java   
public TextResultHandler(Activity activity, ParsedResult result, Result rawResult) {
  super(activity, result, rawResult);
}
项目:keepass2android    文件:AddressBookResultHandler.java   
@Override
public CharSequence getDisplayContents() {
  AddressBookParsedResult result = (AddressBookParsedResult) getResult();
  StringBuilder contents = new StringBuilder(100);
  ParsedResult.maybeAppend(result.getNames(), contents);
  int namesLength = contents.length();

  String pronunciation = result.getPronunciation();
  if (pronunciation != null && !pronunciation.isEmpty()) {
    contents.append("\n(");
    contents.append(pronunciation);
    contents.append(')');
  }

  ParsedResult.maybeAppend(result.getTitle(), contents);
  ParsedResult.maybeAppend(result.getOrg(), contents);
  ParsedResult.maybeAppend(result.getAddresses(), contents);
  String[] numbers = result.getPhoneNumbers();
  if (numbers != null) {
    for (String number : numbers) {
      if (number != null) {
        ParsedResult.maybeAppend(PhoneNumberUtils.formatNumber(number), contents);
      }
    }
  }
  ParsedResult.maybeAppend(result.getEmails(), contents);
  ParsedResult.maybeAppend(result.getURLs(), contents);

  String birthday = result.getBirthday();
  if (birthday != null && !birthday.isEmpty()) {
    Date date = parseDate(birthday);
    if (date != null) {
      ParsedResult.maybeAppend(DateFormat.getDateInstance(DateFormat.MEDIUM).format(date.getTime()), contents);
    }
  }
  ParsedResult.maybeAppend(result.getNote(), contents);

  if (namesLength > 0) {
    // Bold the full name to make it stand out a bit.
    Spannable styled = new SpannableString(contents.toString());
    styled.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), 0, namesLength, 0);
    return styled;
  } else {
    return contents.toString();
  }
}
项目:keepass2android    文件:ProductResultHandler.java   
public ProductResultHandler(Activity activity, ParsedResult result, Result rawResult) {
  super(activity, result, rawResult);
}
项目:keepass2android    文件:ResultHandlerFactory.java   
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);
  }
}
项目:keepass2android    文件:ResultHandlerFactory.java   
private static ParsedResult parseResult(Result rawResult) {
  return ResultParser.parseResult(rawResult);
}
项目:keepass2android    文件:TelResultHandler.java   
public TelResultHandler(Activity activity, ParsedResult result) {
  super(activity, result);
}
项目:keepass2android    文件:WifiResultHandler.java   
public WifiResultHandler(CaptureActivity activity, ParsedResult result) {
  super(activity, result);
  parent = activity;
}
项目:keepass2android    文件:EmailAddressResultHandler.java   
public EmailAddressResultHandler(Activity activity, ParsedResult result) {
  super(activity, result);
}