Log.d(TAG, "Found barcode (" + (end - start) + " ms):\n" + rawResult.toString()); Message message = Message.obtain(activity.getHandler(), R.id.decode_succeeded, rawResult); Bundle bundle = new Bundle();
Log.d(TAG, "Found barcode (" + (end - start) + " ms):\n" + rawResult.toString()); Message message = Message.obtain(fragment.getHandler(), R.id.decode_succeeded, rawResult); Bundle bundle = new Bundle();
Log.d(TAG, "Found barcode (" + (end - start) + " ms):\n" + rawResult.toString()); Message message = Message.obtain(activity.getHandler(), R.id.decode_succeeded, rawResult); Bundle bundle = new Bundle();
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK && requestCode == CODE_GALLERY_REQUEST) { String picPath = SelectAlbumUtils.getPicPath(this, data); Result result = DecodeBitmap.scanningImage(picPath); if (result == null) { Toast.makeText(this, getString(R.string.pic_no_qrcode), Toast.LENGTH_SHORT).show(); } else { beepManager.playBeepSoundAndVibrate(); String scanResult = DecodeBitmap.parseReuslt(result.toString()); scanDeviceSuccess(scanResult, new Bundle()); } } } }
/** * 图片解析 */ protected ShadowSocksDetailsEntity parseImg(String imgURL) throws IOException, NotFoundException { String str = StringUtils.removeFirst(imgURL, "data:image/png;base64,"); Map<DecodeHintType, Object> hints = new LinkedHashMap<>(); // 解码设置编码方式为:utf-8, hints.put(DecodeHintType.CHARACTER_SET, StandardCharsets.UTF_8.name()); //优化精度 hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE); //复杂模式,开启PURE_BARCODE模式 hints.put(DecodeHintType.PURE_BARCODE, Boolean.TRUE); try (ByteArrayInputStream bis = new ByteArrayInputStream(Base64.decodeBase64(str))) { BufferedImage image = ImageIO.read(bis); Binarizer binarizer = new HybridBinarizer(new BufferedImageLuminanceSource(image)); BinaryBitmap binaryBitmap = new BinaryBitmap(binarizer); Result res = new MultiFormatReader().decode(binaryBitmap, hints); return parseLink(res.toString()); } }
/** * A valid barcode has been found, so give an indication of success and show * the results. * * @param rawResult The contents of the barcode. * @param bundle The extras */ public void handleDecode(Result rawResult, Bundle bundle) { inactivityTimer.onActivity(); beepManager.playBeepSoundAndVibrate(); // if (captureType == 0) { // Intent resultIntent = new Intent(); // bundle.putInt("width", mCropRect.width()); // bundle.putInt("height", mCropRect.height()); // bundle.putString("result", rawResult.getText()); // resultIntent.putExtras(bundle); // this.setResult(RESULT_OK, resultIntent); // CaptureActivity.this.finish(); // } else { scanDeviceSuccess(rawResult.toString(), bundle); // } }
/** * 图片解析 */ protected ShadowSocksDetailsEntity parseURL(String imgURL) throws IOException, NotFoundException { Connection.Response resultImageResponse = getConnection(imgURL).execute(); Map<DecodeHintType, Object> hints = new LinkedHashMap<>(); // 解码设置编码方式为:utf-8, hints.put(DecodeHintType.CHARACTER_SET, StandardCharsets.UTF_8.name()); //优化精度 hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE); //复杂模式,开启PURE_BARCODE模式 hints.put(DecodeHintType.PURE_BARCODE, Boolean.TRUE); try (BufferedInputStream bytes = resultImageResponse.bodyStream()) { BufferedImage image = ImageIO.read(bytes); Binarizer binarizer = new HybridBinarizer(new BufferedImageLuminanceSource(image)); BinaryBitmap binaryBitmap = new BinaryBitmap(binarizer); Result res = new MultiFormatReader().decode(binaryBitmap, hints); return parseLink(res.toString()); } }
Log.d(TAG, "Found barcode (" + (end - start) + " ms):\n" + rawResult.toString()); Message message = Message.obtain(activity.getHandler(), R.id.decode_succeeded, rawResult); Bundle bundle = new Bundle();
Log.d(TAG, "Found barcode (" + (end - start) + " ms):\n" + rawResult.toString()); Message message = Message.obtain(activity.getHandler(), R.id.decode_succeeded, rawResult); Bundle bundle = new Bundle();
Log.d(TAG, "Found barcode (" + (end - start) + " ms):\n" + rawResult.toString()); Message message =null; Bundle bundle = new Bundle();
Log.d(TAG, "Found barcode (" + (end - start) + " ms):\n" + rawResult.toString()); Message message =null; Bundle bundle = new Bundle();
Log.d(TAG, "Found barcode (" + (end - start) + " ms):\n" + rawResult.toString()); Message message = Message.obtain(activity.getHandler(), R.id.decode_succeeded, rawResult); Bundle bundle = new Bundle();
Log.d(TAG, "Found barcode (" + (end - start) + " ms):\n" + rawResult.toString()); Message message = Message.obtain(activity.getHandler(), R.id.decode_succeeded, rawResult); Bundle bundle = new Bundle();
Log.d(TAG, "Found barcode (" + (end - start) + " ms):\n" + rawResult.toString()); Message message = Message.obtain(activity.getHandler(), R.id.decode_succeeded, rawResult); Bundle bundle = new Bundle();
Log.d(TAG, "Found barcode (" + (end - start) + " ms):\n" + rawResult.toString()); Message message = Message.obtain(activity.getHandler(), Constants.MESSAGE_QRCODE_DECODE_SUCCEEDED, rawResult); Bundle bundle = new Bundle();