当前位置: 首页>>代码示例>>Java>>正文


Java Symbol.getData方法代码示例

本文整理汇总了Java中net.sourceforge.zbar.Symbol.getData方法的典型用法代码示例。如果您正苦于以下问题:Java Symbol.getData方法的具体用法?Java Symbol.getData怎么用?Java Symbol.getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.sourceforge.zbar.Symbol的用法示例。


在下文中一共展示了Symbol.getData方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: decodeWithZbar

import net.sourceforge.zbar.Symbol; //导入方法依赖的package包/类
public String decodeWithZbar(byte[] data, int width, int height, Rect crop) {
    changeZBarDecodeDataMode();

    Image barcode = new Image(width, height, "Y800");
    barcode.setData(data);
    if (null != crop) {
        barcode.setCrop(crop.left, crop.top, crop.width(), crop.height());
    }

    int result = mImageScanner.scanImage(barcode);
    String resultStr = null;

    if (result != 0) {
        SymbolSet syms = mImageScanner.getResults();
        for (Symbol sym : syms) {
            resultStr = sym.getData();
        }
    }

    return resultStr;
}
 
开发者ID:snice,项目名称:androidscan,代码行数:22,代码来源:DecodeUtils.java

示例2: onPreviewFrame

import net.sourceforge.zbar.Symbol; //导入方法依赖的package包/类
public void onPreviewFrame(byte[] data, Camera camera) {
    Camera.Parameters parameters = camera.getParameters();
    Size size = parameters.getPreviewSize();

    Image barcode = new Image(size.width, size.height, "Y800");
    barcode.setData(data);

    int result = scanner.scanImage(barcode);

    if (result != 0) {
        previewing = false;
        mCamera.setPreviewCallback(null);
        mCamera.stopPreview();

        SymbolSet syms = scanner.getResults();
        for (Symbol sym : syms) {
            String info = sym.getData();
            Intent returnIntent = new Intent();
            returnIntent.putExtra("result", info);
            setResult(RESULT_OK, returnIntent);
            finish();
        }
    }
}
 
开发者ID:andretf,项目名称:batatas-android,代码行数:25,代码来源:QRBarcodeReadActivity.java

示例3: onPreviewFrame

import net.sourceforge.zbar.Symbol; //导入方法依赖的package包/类
public void onPreviewFrame(byte[] data, Camera camera) {
//            Log.d("CameraTestActivity", "onPreviewFrame data length = " + (data != null ? data.length : 0));
            codeImage.setData(data);
            int result = scanner.scanImage(codeImage);
            if (result != 0) {
                SymbolSet syms = scanner.getResults();
                for (Symbol sym : syms) {
                    lastScannedCode = sym.getData();
                    if (lastScannedCode != null) {
                        scanText.setText(getString(R.string.scan_result_label) + lastScannedCode);
                        barcodeScanned = true;
                    }
                }
            }
            camera.addCallbackBuffer(data);
        }
 
开发者ID:iBog,项目名称:QRCodeTest,代码行数:17,代码来源:MainActivity.java

示例4: onPreviewFrame

import net.sourceforge.zbar.Symbol; //导入方法依赖的package包/类
public void onPreviewFrame(byte[] data, Camera camera) {
    Camera.Parameters parameters = camera.getParameters();
    Size size = parameters.getPreviewSize();

    Image barcode = new Image(size.width, size.height, "Y800");
    barcode.setData(data);

    int result = scanner.scanImage(barcode);
    
    if (result != 0) {
        previewing = false;
        mCamera.setPreviewCallback(null);
        mCamera.stopPreview();
        
        SymbolSet syms = scanner.getResults();
        for (Symbol sym : syms) {
        	String text = sym.getData();
            parseWifiInfo(text);
            break;
        }
    }
}
 
开发者ID:jzplusplus,项目名称:GlassWifiConnect,代码行数:23,代码来源:MainActivity.java

示例5: processData

import net.sourceforge.zbar.Symbol; //导入方法依赖的package包/类
private String processData(Image barcode) {
    String result = null;
    if (mScanner.scanImage(barcode) != 0) {
        SymbolSet syms = mScanner.getResults();
        for (Symbol sym : syms) {
            String symData = sym.getData();
            if (!TextUtils.isEmpty(symData)) {
                result = symData;
                break;
            }
        }
    }
    return result;
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:15,代码来源:ZBarView.java

示例6: onPreviewFrame

import net.sourceforge.zbar.Symbol; //导入方法依赖的package包/类
public void onPreviewFrame(byte[] data, Camera camera) {
    Camera.Parameters parameters = camera.getParameters();
    Camera.Size size = parameters.getPreviewSize();

    Image barcode = new Image(size.width, size.height, "Y800");
    barcode.setData(data);

    int result = mScanner.scanImage(barcode);

    if (result != 0) {
        mCamera.cancelAutoFocus();
        mCamera.setPreviewCallback(null);
        mCamera.stopPreview();
        mPreviewing = false;
        SymbolSet syms = mScanner.getResults();
        for (Symbol sym : syms) {
            String symData = sym.getData();
            if (!TextUtils.isEmpty(symData)) {
                Intent dataIntent = new Intent();
                dataIntent.putExtra(SCAN_RESULT, symData);
                dataIntent.putExtra(SCAN_RESULT_TYPE, sym.getType());
                setResult(Activity.RESULT_OK, dataIntent);
                finish();
                break;
            }
        }
    }
}
 
开发者ID:Shaderboy,项目名称:V-Scan,代码行数:29,代码来源:ZBarScannerActivity.java

示例7: onPreviewFrame

import net.sourceforge.zbar.Symbol; //导入方法依赖的package包/类
public void onPreviewFrame(byte[] data, Camera camera) {
	Camera.Parameters parameters = camera.getParameters();
	Camera.Size size = parameters.getPreviewSize();

	Image barcode = new Image(size.width, size.height, "Y800");
	barcode.setData(data);

	int result = mScanner.scanImage(barcode);

	if (result != 0) {
		mCamera.cancelAutoFocus();
		mCamera.setPreviewCallback(null);
		mCamera.stopPreview();
		mPreviewing = false;
		SymbolSet syms = mScanner.getResults();
		for (Symbol sym : syms) {
			String symData = sym.getData();
			if (!TextUtils.isEmpty(symData)) {
				Intent dataIntent = new Intent();
				dataIntent.putExtra(SCAN_RESULT, symData);
				dataIntent.putExtra(SCAN_RESULT_TYPE, sym.getType());
				setResult(Activity.RESULT_OK, dataIntent);
				finish();
				break;
			}
		}
	}
}
 
开发者ID:10xEngineer,项目名称:My-Wallet-Android,代码行数:29,代码来源:ZBarScannerActivity.java

示例8: onPreviewFrame

import net.sourceforge.zbar.Symbol; //导入方法依赖的package包/类
public void onPreviewFrame(byte[] data, Camera camera) {
    Camera.Parameters parameters = camera.getParameters();
    Camera.Size size = parameters.getPreviewSize();

    Image barcode = new Image(size.width, size.height, "Y800");
    barcode.setData(data);

    int result = mScanner.scanImage(barcode);

    if (result != 0) {
        mCamera.cancelAutoFocus();
        mCamera.setPreviewCallback(null);
        mCamera.stopPreview();
        mPreviewing = false;
        SymbolSet syms = mScanner.getResults();
        for (Symbol sym : syms) {
            String symData = sym.getData();
            if (!TextUtils.isEmpty(symData)) {
                Intent dataIntent = new Intent();
                dataIntent.putExtra(SCAN_RESULT, symData);
                dataIntent.putExtra(SCAN_RESULT_TYPE, sym.getType());
                setResult(Activity.RESULT_FIRST_USER, dataIntent);
                finish();
                break;
            }
        }
    }
}
 
开发者ID:SGirousse,项目名称:FAVShop,代码行数:29,代码来源:ZBarScannerActivity.java

示例9: runDecode

import net.sourceforge.zbar.Symbol; //导入方法依赖的package包/类
public static String runDecode(android.media.Image image/*TaskWorkerProgressHandler handler, TaskWorkerImageProvider provider*/)
    {
//        handler.setDecodeStateStarted();
//        byte[] byteArray = provider.getFrameBuffer();

        LuminanceSource source = new PlaneLuminanceSource(
                image.getPlanes()[0],
                image.getWidth(),
                image.getHeight()
        );
//        HybridBinarizer binarizer = new HybridBinarizer(source);
//        BinaryBitmap binaryBitmap = new BinaryBitmap(binarizer);
//        MultiFormatReader multiFormatReader = new MultiFormatReader();
//        ArrayList<BarcodeFormat> possibleFormats= new ArrayList<>();
//        possibleFormats.add(BarcodeFormat.CODE_128);
//        Map<DecodeHintType, ArrayList> hints = new HashMap<>();
//        hints.put(DecodeHintType.POSSIBLE_FORMATS, possibleFormats);
//        multiFormatReader.setHints(hints);
//        Result contents;
//        try
//        {
//            contents = multiFormatReader.decode(binaryBitmap);
//            Log.d("BarCodeTaskWorker", contents.getText());
//            return contents.getText();
////            handler.setDecodeStateCompleted();
//        }
//        catch (NotFoundException e)
//        {
////            e.printStackTrace();
////            handler.setDecodeStateFailed();
//
//        }
        Image barcode = new Image(image.getWidth(), image.getHeight(), "Y800");
        barcode.setData(source.getMatrix());

        ImageScanner scanner = new ImageScanner();
        scanner.setConfig(0, Config.X_DENSITY, 3);
        scanner.setConfig(0, Config.Y_DENSITY, 3);

        int result = scanner.scanImage(barcode);

        if (result != 0) {

            SymbolSet syms = scanner.getResults();
            for (Symbol sym : syms) {
                return sym.getData();
            }
        }
        return null;
    }
 
开发者ID:katiesandford,项目名称:parkscan,代码行数:51,代码来源:BarCodeTaskWorker.java

示例10: onPreviewFrame

import net.sourceforge.zbar.Symbol; //导入方法依赖的package包/类
@Override
public void onPreviewFrame(byte[] data, Camera camera) {
    Camera.Parameters parameters = camera.getParameters();
    Camera.Size size = parameters.getPreviewSize();
    int width = size.width;
    int height = size.height;

    if(DisplayUtils.getScreenOrientation(getContext()) == Configuration.ORIENTATION_PORTRAIT) {
        byte[] rotatedData = new byte[data.length];
        for (int y = 0; y < height; y++) {
            for (int x = 0; x < width; x++)
                rotatedData[x * height + height - y - 1] = data[x + y * width];
        }
        int tmp = width;
        width = height;
        height = tmp;
        data = rotatedData;
    }

    Image barcode = new Image(width, height, "Y800");
    barcode.setData(data);

    int result = mScanner.scanImage(barcode);

    if (result != 0) {
        stopCamera();
        if(mResultHandler != null) {
            SymbolSet syms = mScanner.getResults();
            Result rawResult = new Result();
            for (Symbol sym : syms) {
                String symData = sym.getData();
                if (!TextUtils.isEmpty(symData)) {
                    rawResult.setContents(symData);
                    rawResult.setBarcodeFormat(BarcodeFormat.getFormatById(sym.getType()));
                    break;
                }
            }
            mResultHandler.handleResult(rawResult);
        }
    } else {
        camera.setOneShotPreviewCallback(this);
    }
}
 
开发者ID:BlochsTech,项目名称:BitcoinCardTerminal,代码行数:44,代码来源:ZBarScannerView.java

示例11: onPreviewFrame

import net.sourceforge.zbar.Symbol; //导入方法依赖的package包/类
@Override
public void onPreviewFrame(byte[] data, Camera camera) {
	Camera.Parameters parameters = camera.getParameters();
	Camera.Size size = parameters.getPreviewSize();
	int width = size.width;
	int height = size.height;

	if(DisplayUtils.getScreenOrientation(getContext()) == Configuration.ORIENTATION_PORTRAIT) {
		byte[] rotatedData = new byte[data.length];
		for (int y = 0; y < height; y++) {
			for (int x = 0; x < width; x++)
				rotatedData[x * height + height - y - 1] = data[x + y * width];
		}
		int tmp = width;
		width = height;
		height = tmp;
		data = rotatedData;
	}

	Image barcode = new Image(width, height, "Y800");
	barcode.setData(data);

	int result = mScanner.scanImage(barcode);

	if (result != 0) {
		stopCamera();
		if(mResultHandler != null) {
			SymbolSet syms = mScanner.getResults();
			Result rawResult = new Result();
			for (Symbol sym : syms) {
				String symData = sym.getData();
				if (!TextUtils.isEmpty(symData)) {
					rawResult.setContents(symData);
					rawResult.setBarcodeFormat(BarcodeFormat.getFormatById(sym.getType()));
					break;
				}
			}
			mResultHandler.handleResult(rawResult);
		}
	} else {
		camera.setOneShotPreviewCallback(this);
	}
}
 
开发者ID:MasterKale,项目名称:barcodescanner-for-dialogs,代码行数:44,代码来源:ZBarScannerView.java

示例12: onPreviewFrame

import net.sourceforge.zbar.Symbol; //导入方法依赖的package包/类
public void onPreviewFrame(byte[] data, Camera camera) {
    Camera.Parameters parameters = camera.getParameters();
    Camera.Size size = parameters.getPreviewSize();

    Image barcode = new Image(size.width, size.height, "Y800");
    barcode.setData(data);

    int result = scanner.scanImage(barcode);

    if (result != 0) {
        previewing = false;
        mCamera.setPreviewCallback(null);
        mCamera.stopPreview();

        SymbolSet syms = scanner.getResults();
        for (Symbol sym : syms) {
            //scanText.setText("barcode result " + sym.getData());

            barcodeScanned = true;

            // start sharing activity
            Intent intent = new Intent(getApplicationContext(), ShareActivity.class);
            String message = sym.getData();
            Log.d("MATCH", ""+message.matches(pattern));
            if (message.matches(pattern)) {
                Toast.makeText(getApplicationContext(), "Location Scanned: "+message,Toast.LENGTH_SHORT).show();
                intent.putExtra(EXTRA_MESSAGE,message);
                startActivity(intent);
            } else {
                Toast.makeText(getApplicationContext(), "No coordinates found in code: "+message,Toast.LENGTH_SHORT).show();

                //mPreview.setCamera(mCamera);
                mCamera.setPreviewCallback(previewCb);
                mCamera.startPreview();
                previewing=true;
                mCamera.autoFocus(autoFocusCB);
            }





        }
    }
}
 
开发者ID:heinrichloewen,项目名称:qr2locate,代码行数:46,代码来源:QrActivity.java


注:本文中的net.sourceforge.zbar.Symbol.getData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。