com.google.zxing.BarcodeFormat# UPC_E 源码实例Demo

下面列出了com.google.zxing.BarcodeFormat# UPC_E 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。


@Override
public ProductParsedResult parse(Result result) {
  BarcodeFormat format = result.getBarcodeFormat();
  if (!(format == BarcodeFormat.UPC_A || format == BarcodeFormat.UPC_E ||
        format == BarcodeFormat.EAN_8 || format == BarcodeFormat.EAN_13)) {
    return null;
  }
  String rawText = getMassagedText(result);
  if (!isStringOfDigits(rawText, rawText.length())) {
    return null;
  }
  // Not actually checking the checksum again here    

  String normalizedProductID;
  // Expand UPC-E for purposes of searching
  if (format == BarcodeFormat.UPC_E && rawText.length() == 8) {
    normalizedProductID = UPCEReader.convertUPCEtoUPCA(rawText);
  } else {
    normalizedProductID = rawText;
  }

  return new ProductParsedResult(rawText, normalizedProductID);
}
 

@Override
public ProductParsedResult parse(Result result) {
  BarcodeFormat format = result.getBarcodeFormat();
  if (!(format == BarcodeFormat.UPC_A || format == BarcodeFormat.UPC_E ||
        format == BarcodeFormat.EAN_8 || format == BarcodeFormat.EAN_13)) {
    return null;
  }
  String rawText = getMassagedText(result);
  if (!isStringOfDigits(rawText, rawText.length())) {
    return null;
  }
  // Not actually checking the checksum again here    

  String normalizedProductID;
  // Expand UPC-E for purposes of searching
  if (format == BarcodeFormat.UPC_E && rawText.length() == 8) {
    normalizedProductID = UPCEReader.convertUPCEtoUPCA(rawText);
  } else {
    normalizedProductID = rawText;
  }

  return new ProductParsedResult(rawText, normalizedProductID);
}
 
源代码3 项目: weex   文件: ProductResultParser.java

@Override
public ProductParsedResult parse(Result result) {
  BarcodeFormat format = result.getBarcodeFormat();
  if (!(format == BarcodeFormat.UPC_A || format == BarcodeFormat.UPC_E ||
        format == BarcodeFormat.EAN_8 || format == BarcodeFormat.EAN_13)) {
    return null;
  }
  String rawText = getMassagedText(result);
  if (!isStringOfDigits(rawText, rawText.length())) {
    return null;
  }
  // Not actually checking the checksum again here    

  String normalizedProductID;
  // Expand UPC-E for purposes of searching
  if (format == BarcodeFormat.UPC_E && rawText.length() == 8) {
    normalizedProductID = UPCEReader.convertUPCEtoUPCA(rawText);
  } else {
    normalizedProductID = rawText;
  }

  return new ProductParsedResult(rawText, normalizedProductID);
}
 
源代码4 项目: RipplePower   文件: ProductResultParser.java

@Override
public ProductParsedResult parse(Result result) {
	BarcodeFormat format = result.getBarcodeFormat();
	if (!(format == BarcodeFormat.UPC_A || format == BarcodeFormat.UPC_E || format == BarcodeFormat.EAN_8
			|| format == BarcodeFormat.EAN_13)) {
		return null;
	}
	String rawText = getMassagedText(result);
	if (!isStringOfDigits(rawText, rawText.length())) {
		return null;
	}
	// Not actually checking the checksum again here

	String normalizedProductID;
	// Expand UPC-E for purposes of searching
	if (format == BarcodeFormat.UPC_E && rawText.length() == 8) {
		normalizedProductID = UPCEReader.convertUPCEtoUPCA(rawText);
	} else {
		normalizedProductID = rawText;
	}

	return new ProductParsedResult(rawText, normalizedProductID);
}
 

@Override
public ProductParsedResult parse(Result result) {
  BarcodeFormat format = result.getBarcodeFormat();
  if (!(format == BarcodeFormat.UPC_A || format == BarcodeFormat.UPC_E ||
        format == BarcodeFormat.EAN_8 || format == BarcodeFormat.EAN_13)) {
    return null;
  }
  String rawText = getMassagedText(result);
  if (!isStringOfDigits(rawText, rawText.length())) {
    return null;
  }
  // Not actually checking the checksum again here    

  String normalizedProductID;
  // Expand UPC-E for purposes of searching
  if (format == BarcodeFormat.UPC_E && rawText.length() == 8) {
    normalizedProductID = UPCEReader.convertUPCEtoUPCA(rawText);
  } else {
    normalizedProductID = rawText;
  }

  return new ProductParsedResult(rawText, normalizedProductID);
}
 

@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType, ?> hints) throws WriterException {
  if (format != BarcodeFormat.UPC_E) {
    throw new IllegalArgumentException("Can only encode UPC_E, but got " + format);
  }

  return super.encode(contents, format, width, height, hints);
}
 
源代码7 项目: QrCodeScanner   文件: UPCEWriter.java

@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType, ?> hints) throws WriterException {
  if (format != BarcodeFormat.UPC_E) {
    throw new IllegalArgumentException("Can only encode UPC_E, but got " + format);
  }

  return super.encode(contents, format, width, height, hints);
}
 

@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType, ?> hints) throws WriterException {
  if (format != BarcodeFormat.UPC_E) {
    throw new IllegalArgumentException("Can only encode UPC_E, but got " + format);
  }

  return super.encode(contents, format, width, height, hints);
}
 
源代码9 项目: weex   文件: UPCEWriter.java

@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType, ?> hints) throws WriterException {
  if (format != BarcodeFormat.UPC_E) {
    throw new IllegalArgumentException("Can only encode UPC_E, but got " + format);
  }

  return super.encode(contents, format, width, height, hints);
}
 
源代码10 项目: barcodescanner-lib-aar   文件: UPCEWriter.java

@Override
public BitMatrix encode(String contents,
                        BarcodeFormat format,
                        int width,
                        int height,
                        Map<EncodeHintType, ?> hints) throws WriterException {
  if (format != BarcodeFormat.UPC_E) {
    throw new IllegalArgumentException("Can only encode UPC_E, but got " + format);
  }

  return super.encode(contents, format, width, height, hints);
}
 
源代码11 项目: reacteu-app   文件: UPCEReader.java

@Override
BarcodeFormat getBarcodeFormat() {
  return BarcodeFormat.UPC_E;
}
 
源代码12 项目: MiBandDecompiled   文件: UPCEReader.java

BarcodeFormat a()
{
    return BarcodeFormat.UPC_E;
}
 
源代码13 项目: ScreenCapture   文件: UPCEReader.java

@Override
BarcodeFormat getBarcodeFormat() {
  return BarcodeFormat.UPC_E;
}
 
源代码14 项目: RipplePower   文件: UPCEReader.java

@Override
BarcodeFormat getBarcodeFormat() {
	return BarcodeFormat.UPC_E;
}
 
源代码15 项目: Tesseract-OCR-Scanner   文件: UPCEReader.java

@Override
BarcodeFormat getBarcodeFormat() {
  return BarcodeFormat.UPC_E;
}
 

/**
 * Parse barcodes as BarcodeFormat constants.
 *
 * Supports all iOS codes except [code39mod43, itf14]
 *
 * Additionally supports [codabar, maxicode, rss14, rssexpanded, upca, upceanextension]
 */
private BarcodeFormat parseBarCodeString(String c) {
    if ("aztec".equals(c)) {
        return BarcodeFormat.AZTEC;
    } else if ("ean13".equals(c)) {
        return BarcodeFormat.EAN_13;
    } else if ("ean8".equals(c)) {
        return BarcodeFormat.EAN_8;
    } else if ("qr".equals(c)) {
        return BarcodeFormat.QR_CODE;
    } else if ("pdf417".equals(c)) {
        return BarcodeFormat.PDF_417;
    } else if ("upce".equals(c)) {
        return BarcodeFormat.UPC_E;
    } else if ("datamatrix".equals(c)) {
        return BarcodeFormat.DATA_MATRIX;
    } else if ("code39".equals(c)) {
        return BarcodeFormat.CODE_39;
    } else if ("code93".equals(c)) {
        return BarcodeFormat.CODE_93;
    } else if ("interleaved2of5".equals(c)) {
        return BarcodeFormat.ITF;
    } else if ("codabar".equals(c)) {
        return BarcodeFormat.CODABAR;
    } else if ("code128".equals(c)) {
        return BarcodeFormat.CODE_128;
    } else if ("maxicode".equals(c)) {
        return BarcodeFormat.MAXICODE;
    } else if ("rss14".equals(c)) {
        return BarcodeFormat.RSS_14;
    } else if ("rssexpanded".equals(c)) {
        return BarcodeFormat.RSS_EXPANDED;
    } else if ("upca".equals(c)) {
        return BarcodeFormat.UPC_A;
    } else if ("upceanextension".equals(c)) {
        return BarcodeFormat.UPC_EAN_EXTENSION;
    } else {
        android.util.Log.v("RCTCamera", "Unsupported code.. [" + c + "]");
        return null;
    }
}
 
源代码17 项目: QrCodeScanner   文件: UPCEReader.java

@Override
BarcodeFormat getBarcodeFormat() {
  return BarcodeFormat.UPC_E;
}
 
源代码18 项目: ZXing-Orient   文件: UPCEReader.java

@Override
BarcodeFormat getBarcodeFormat() {
  return BarcodeFormat.UPC_E;
}
 

@Override
BarcodeFormat getBarcodeFormat() {
  return BarcodeFormat.UPC_E;
}
 
源代码20 项目: weex   文件: UPCEReader.java

@Override
BarcodeFormat getBarcodeFormat() {
  return BarcodeFormat.UPC_E;
}