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


Java Symbol类代码示例

本文整理汇总了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;
}
 
开发者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: 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;
}
 
开发者ID:pif,项目名称:glass-warehouse-automation,代码行数:27,代码来源:ScanQRConfigActivity.java

示例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;
        }
    }
}
 
开发者ID:jzplusplus,项目名称:GlassWifiConnect,代码行数:23,代码来源:MainActivity.java

示例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;
        	}
        }
    }
}
 
开发者ID:richard1122,项目名称:QR-auth-android,代码行数:22,代码来源:CameraTestActivity.java

示例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);
    }
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:11,代码来源:ZBarView.java

示例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;
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:15,代码来源:ZBarView.java

示例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);
  }
}
 
开发者ID:Orchextra,项目名称:orchextra-android-sdk,代码行数:12,代码来源:OxZBarScannerView.java

示例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);
    }
}
 
开发者ID:BlochsTech,项目名称:BitcoinCardTerminal,代码行数:11,代码来源:ZBarScannerView.java

示例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);
        }
    }
}
 
开发者ID:Shaderboy,项目名称:V-Scan,代码行数:14,代码来源:ZBarScannerActivity.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 = 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

示例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;
              }
          }
      }
 
开发者ID:jcstrandburg,项目名称:virtour,代码行数:34,代码来源:QRReaderActivitiy.java

示例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");
			}
		}
	}
}
 
开发者ID:dimasdanz,项目名称:KendaliPintuAndroid,代码行数:33,代码来源:BarcodeOpenDoorActivity.java

示例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);	
		}
	}
}
 
开发者ID:10xEngineer,项目名称:My-Wallet-Android,代码行数:14,代码来源:MainActivity.java


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