本文整理汇总了Java中net.sourceforge.zbar.Symbol类的典型用法代码示例。如果您正苦于以下问题:Java Symbol类的具体用法?Java Symbol怎么用?Java Symbol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Symbol类属于net.sourceforge.zbar包,在下文中一共展示了Symbol类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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();
}
}
}
示例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);
}
示例4: createPreviewCallback
import net.sourceforge.zbar.Symbol; //导入依赖的package包/类
private PreviewCallback createPreviewCallback() {
PreviewCallback previewCallback = new Camera.PreviewCallback() {
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, "NV21");
barcode.setData(data);
barcode = barcode.convert("Y800");
int result = mScanner.scanImage(barcode);
if (result != 0) {
mPreviewing = false;
releaseCamera();
SymbolSet syms = mScanner.getResults();
for (Symbol sym : syms) {
Flow.with(ScanQRConfigActivity.this).scanned(sym);
break;
}
}
}
};
return previewCallback;
}
示例5: 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;
}
}
}
示例6: 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 >= 1 && !barcodeScanned) {
SymbolSet syms = scanner.getResults();
for (Symbol sym : syms) {
Log.i("", sym.getData() + "Type: " + sym.getType());
if (sym.getType() != Symbol.QRCODE)
return;
if (processData(sym.getData())) {
barcodeScanned = true;
}
}
}
}
示例7: setupScanner
import net.sourceforge.zbar.Symbol; //导入依赖的package包/类
public void setupScanner() {
mScanner = new ImageScanner();
mScanner.setConfig(0, Config.X_DENSITY, 3);
mScanner.setConfig(0, Config.Y_DENSITY, 3);
mScanner.setConfig(Symbol.NONE, Config.ENABLE, 0);
for (BarcodeFormat format : BarcodeFormat.ALL_FORMATS) {
mScanner.setConfig(format.getId(), Config.ENABLE, 1);
}
}
示例8: 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;
}
示例9: setupScanner
import net.sourceforge.zbar.Symbol; //导入依赖的package包/类
public void setupScanner() {
scanner = new ImageScanner();
scanner.setConfig(Symbol.NONE, Config.X_DENSITY, 3);
scanner.setConfig(Symbol.NONE, Config.Y_DENSITY, 3);
scanner.setConfig(Symbol.NONE, Config.ENABLE, 0);
for (BarcodeFormat format : getFormats()) {
scanner.setConfig(format.getId(), Config.ENABLE, 1);
}
}
示例10: setupScanner
import net.sourceforge.zbar.Symbol; //导入依赖的package包/类
public void setupScanner() {
mScanner = new ImageScanner();
mScanner.setConfig(0, Config.X_DENSITY, 3);
mScanner.setConfig(0, Config.Y_DENSITY, 3);
mScanner.setConfig(Symbol.NONE, Config.ENABLE, 0);
for(BarcodeFormat format : getFormats()) {
mScanner.setConfig(format.getId(), Config.ENABLE, 1);
}
}
示例11: setupScanner
import net.sourceforge.zbar.Symbol; //导入依赖的package包/类
public void setupScanner() {
mScanner = new ImageScanner();
mScanner.setConfig(0, Config.X_DENSITY, 3);
mScanner.setConfig(0, Config.Y_DENSITY, 3);
int[] symbols = getIntent().getIntArrayExtra(SCAN_MODES);
if (symbols != null) {
mScanner.setConfig(Symbol.NONE, Config.ENABLE, 0);
for (int symbol : symbols) {
mScanner.setConfig(symbol, Config.ENABLE, 1);
}
}
}
示例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 = 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;
}
}
}
}
示例13: 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) {
//Toast t = Toast.makeText(getApplicationContext(), sym.getData(), Toast.LENGTH_LONG);
//t.show();
try {
Intent intent = new Intent(getApplicationContext(),StopActivity.class);
intent.putExtra("StopID", Integer.parseInt(sym.getData().replace("CSVTour://", "")));
startActivity(intent);
} catch (NumberFormatException e) {
// TODO Auto-generated catch block
Toast t = Toast.makeText(getApplicationContext(),"Invalid QR Code",Toast.LENGTH_LONG);
t.show();
e.printStackTrace();
}
//scanText.setText("barcode result " + sym.getData());
//barcodeScanned = true;
}
}
}
示例14: 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) {
SymbolSet syms = scanner.getResults();
for (Symbol sym : syms) {
if(sym.getData().equals(StaticString.TAG_BARCODE_ENTER)){
Log.d("Result", "Masuk");
previewing = false;
mCamera.setPreviewCallback(null);
mCamera.stopPreview();
releaseCamera();
new BarcodeSendData().execute(StaticString.TAG_BARCODE_ENTER);
}else if(sym.getData().equals(StaticString.TAG_BARCODE_EXIT)){
Log.d("Result", "Keluar");
previewing = false;
mCamera.setPreviewCallback(null);
mCamera.stopPreview();
releaseCamera();
new BarcodeSendData().execute(StaticString.TAG_BARCODE_EXIT);
}else{
Toast.makeText(BarcodeOpenDoorActivity.this, R.string.string_barcode_invalid, Toast.LENGTH_SHORT).show();
Log.d("Result", "Invalid");
}
}
}
}
示例15: handleNavigateTo
import net.sourceforge.zbar.Symbol; //导入依赖的package包/类
void handleNavigateTo() {
Intent intent = getIntent();
String navigateTo = intent.getStringExtra("navigateTo");
if (navigateTo != null) {
if (navigateTo.equals("merchantDirectory")) {
doMerchantDirectory();
} else if (navigateTo.equals("scanReceiving")) {
Intent intent2 = new Intent(MainActivity.this, ZBarScannerActivity.class);
intent2.putExtra(ZBarConstants.SCAN_MODES, new int[] { Symbol.QRCODE } );
startActivityForResult(intent2, ZBAR_SCANNER_REQUEST);
}
}
}