public ZXDecoder() { reader = new MultiFormatReader(); hints.put(DecodeHintType.POSSIBLE_FORMATS, EnumSet.allOf(BarcodeFormat.class)); hints.put(DecodeHintType.CHARACTER_SET, "utf-8"); hints.put(DecodeHintType.TRY_HARDER, true); reader.setHints(hints); }
public DecoderBitmap(Context context) { multiFormatReader = new MultiFormatReader(); Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>(2); Vector<BarcodeFormat> decodeFormats = new Vector<BarcodeFormat>(); if (decodeFormats == null || decodeFormats.isEmpty()) { decodeFormats = new Vector<BarcodeFormat>(); decodeFormats.addAll(DecodeFormatManager.getBarCodeFormats()); decodeFormats.addAll(DecodeFormatManager.getQrCodeFormats()); decodeFormats.addAll(EnumSet.of(BarcodeFormat.AZTEC)); decodeFormats.addAll(EnumSet.of(BarcodeFormat.PDF_417)); } hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats); hints.put(DecodeHintType.CHARACTER_SET, "UTF8"); multiFormatReader.setHints(hints); }
public BitmapDecoder(Context context) { multiFormatReader = new MultiFormatReader(); // 解码的参数 Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>(2); // 可以解析的编码类型 Vector<BarcodeFormat> decodeFormats = new Vector<BarcodeFormat>(); if (decodeFormats == null || decodeFormats.isEmpty()) { decodeFormats = new Vector<BarcodeFormat>(); // 这里设置可扫描的类型,我这里选择了都支持 decodeFormats.addAll(DecodeFormatManager.ONE_D_FORMATS); decodeFormats.addAll(DecodeFormatManager.QR_CODE_FORMATS); decodeFormats.addAll(DecodeFormatManager.DATA_MATRIX_FORMATS); } hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats); // 设置继续的字符编码格式为UTF8 hints.put(DecodeHintType.CHARACTER_SET, "UTF8"); // 设置解析配置参数 multiFormatReader.setHints(hints); }
DecodeHandler(CaptureActivity activity, Hashtable<DecodeHintType, Object> hints) { multiFormatReader = new MultiFormatReader(); multiFormatReader.setHints(hints); this.activity = activity; }
DecodeHandler(BarCodeScannerFragment fragment, Map<DecodeHintType, Object> hints) { multiFormatReader = new MultiFormatReader(); multiFormatReader.setHints(hints); this.fragment = fragment; }
DecodeHandler(BarCodeFragment activity, Map<DecodeHintType, Object> hints) { multiFormatReader = new MultiFormatReader(); multiFormatReader.setHints(hints); this.activity = activity; }