Java Code Examples for com.google.zxing.client.android.camera.CameraManager#startPreview()

The following examples show how to use com.google.zxing.client.android.camera.CameraManager#startPreview() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CaptureActivityHandler.java    From ZXing-Standalone-library with Apache License 2.0 6 votes vote down vote up
CaptureActivityHandler(CaptureActivity activity,
                       Collection<BarcodeFormat> decodeFormats,
                       Map<DecodeHintType,?> baseHints,
                       String characterSet,
                       CameraManager cameraManager) {
  this.activity = activity;
  decodeThread = new DecodeThread(activity, decodeFormats, baseHints, characterSet,
      new ViewfinderResultPointCallback(activity.getViewfinderView()));
  decodeThread.start();
  state = State.SUCCESS;

  // Start ourselves capturing previews and decoding.
  this.cameraManager = cameraManager;
  cameraManager.startPreview();
  restartPreviewAndDecode();
}
 
Example 2
Source File: CaptureActivityHandler.java    From ZXing-Orient with Apache License 2.0 6 votes vote down vote up
CaptureActivityHandler(CaptureActivity activity,
                       Collection<BarcodeFormat> decodeFormats,
                       Map<DecodeHintType,?> baseHints,
                       String characterSet,
                       CameraManager cameraManager) {
  this.activity = activity;
  decodeThread = new DecodeThread(activity, decodeFormats, baseHints, characterSet,
      new ViewfinderResultPointCallback(activity.getViewfinderView()));
  decodeThread.start();
  state = State.SUCCESS;

  // Start ourselves capturing previews and decoding.
  this.cameraManager = cameraManager;
  cameraManager.startPreview();
  restartPreviewAndDecode();
}
 
Example 3
Source File: CaptureActivityHandler.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 6 votes vote down vote up
CaptureActivityHandler(CaptureActivity activity,
                       Collection<BarcodeFormat> decodeFormats,
                       Map<DecodeHintType,?> baseHints,
                       String characterSet,
                       CameraManager cameraManager) {
  this.activity = activity;
  decodeThread = new DecodeThread(activity, decodeFormats, baseHints, characterSet,
      new ViewfinderResultPointCallback(activity.getViewfinderView()));
  decodeThread.start();
  state = State.SUCCESS;

  // Start ourselves capturing previews and decoding.
  this.cameraManager = cameraManager;
  cameraManager.startPreview();
  restartPreviewAndDecode();
}
 
Example 4
Source File: CaptureActivityHandler.java    From weex with Apache License 2.0 6 votes vote down vote up
CaptureActivityHandler(CaptureActivity activity,
                       Collection<BarcodeFormat> decodeFormats,
                       Map<DecodeHintType,?> baseHints,
                       String characterSet,
                       CameraManager cameraManager) {
  this.activity = activity;
  decodeThread = new DecodeThread(activity, decodeFormats, baseHints, characterSet,
      new ViewfinderResultPointCallback(activity.getViewfinderView()));
  decodeThread.start();
  state = State.SUCCESS;

  // Start ourselves capturing previews and decoding.
  this.cameraManager = cameraManager;
  cameraManager.startPreview();
  restartPreviewAndDecode();
}
 
Example 5
Source File: CaptureActivityHandler.java    From Study_Android_Demo with Apache License 2.0 6 votes vote down vote up
CaptureActivityHandler(CaptureActivity activity,
                       Collection<BarcodeFormat> decodeFormats,
                       Map<DecodeHintType,?> baseHints,
                       String characterSet,
                       CameraManager cameraManager) {
  this.activity = activity;
  decodeThread = new DecodeThread(activity, decodeFormats, baseHints, characterSet,
      new ViewfinderResultPointCallback(activity.getViewfinderView()));
  decodeThread.start();
  state = State.SUCCESS;

  // Start ourselves capturing previews and decoding.
  this.cameraManager = cameraManager;
  cameraManager.startPreview();
  restartPreviewAndDecode();
}
 
Example 6
Source File: CaptureActivityHandler.java    From barcodescanner-lib-aar with MIT License 6 votes vote down vote up
CaptureActivityHandler(CaptureActivity activity,
                       Collection<BarcodeFormat> decodeFormats,
                       Map<DecodeHintType,?> baseHints,
                       String characterSet,
                       CameraManager cameraManager) {
  this.activity = activity;
  decodeThread = new DecodeThread(activity, decodeFormats, baseHints, characterSet,
      new ViewfinderResultPointCallback(activity.getViewfinderView()));
  decodeThread.start();
  state = State.SUCCESS;

  // Start ourselves capturing previews and decoding.
  this.cameraManager = cameraManager;
  cameraManager.startPreview();
  restartPreviewAndDecode();
}
 
Example 7
Source File: CaptureActivityHandler.java    From reacteu-app with MIT License 6 votes vote down vote up
CaptureActivityHandler(CaptureActivity activity,
                        Collection<BarcodeFormat> decodeFormats,
                        String characterSet,
                        CameraManager cameraManager) {
fakeR = new FakeR(activity);
   this.activity = activity;
   decodeThread = new DecodeThread(activity, decodeFormats, characterSet,
       new ViewfinderResultPointCallback(activity.getViewfinderView()));
   decodeThread.start();
   state = State.SUCCESS;

   // Start ourselves capturing previews and decoding.
   this.cameraManager = cameraManager;
   cameraManager.startPreview();
   restartPreviewAndDecode();
 }
 
Example 8
Source File: CaptureActivityHandler.java    From BarcodeEye with Apache License 2.0 6 votes vote down vote up
CaptureActivityHandler(CaptureActivity activity,
        Collection<BarcodeFormat> decodeFormats,
        Map<DecodeHintType, ?> baseHints, String characterSet,
        CameraManager cameraManager) {
    this.activity = activity;
    decodeThread = new DecodeThread(activity, decodeFormats, baseHints,
            characterSet, new ViewfinderResultPointCallback(
                    activity.getViewfinderView()));
    decodeThread.start();
    state = State.SUCCESS;

    // Start ourselves capturing previews and decoding.
    this.cameraManager = cameraManager;
    cameraManager.startPreview();
    restartPreviewAndDecode();
}
 
Example 9
Source File: CaptureActivityHandler.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
CaptureActivityHandler(AppInvCaptureActivity activity,
                       Collection<BarcodeFormat> decodeFormats,
                       String characterSet,
                       CameraManager cameraManager) {
  this.activity = activity;
  decodeThread = new DecodeThread(activity, decodeFormats, characterSet,
      new ViewfinderResultPointCallback(activity.getViewfinderView()));
  decodeThread.start();
  state = State.SUCCESS;

  // Start ourselves capturing previews and decoding.
  this.cameraManager = cameraManager;
  cameraManager.startPreview();
  restartPreviewAndDecode();
}
 
Example 10
Source File: ZxingScanView.java    From ProjectX with Apache License 2.0 5 votes vote down vote up
private void openDriver(SurfaceHolder surfaceHolder) {
    notifyListenerPrepareOpen();
    if (surfaceHolder == null)
        return;// 已经销毁
    if (isOpen())
        return;// 摄像头已经打开
    if (Compat.checkSelfPermission(getContext(), Manifest.permission.CAMERA)
            == PackageManager.PERMISSION_DENIED) {
        mErrorCode = ERROR_CODE_1;
        notifyListenerError();
        return;
    }
    mCameraManager = new CameraManager(getContext());
    if (mCameraId != OpenCameraInterface.NO_REQUESTED_CAMERA)
        mCameraManager.setManualCameraId(mCameraId);
    final int width = mScanWidth == ViewGroup.LayoutParams.MATCH_PARENT ? getWidth() :
            (mScanWidth > getWidth() ? getWidth() : mScanWidth);
    final int height = mScanHeight == ViewGroup.LayoutParams.MATCH_PARENT ? getHeight() :
            (mScanHeight > getHeight() ? getHeight() : mScanHeight);
    mCameraManager.setManualFramingRect(width, height);
    try {
        mCameraManager.openDriver(surfaceHolder);
        mCameraManager.startPreview();
        mScanHandler = new ScanHandler(resultListener, mBarcodeType, mBaseHints,
                mCharacterSet, mCameraManager,
                resultPointCallback);
    } catch (Exception e) {
        mErrorCode = ERROR_CODE_0;
        notifyListenerError();
        return;
    }
    mAmbientLightManager.resume();
    notifyListenerOpened();
}
 
Example 11
Source File: CaptureActivityHandler.java    From android-apps with MIT License 5 votes vote down vote up
CaptureActivityHandler(CaptureActivity activity,
                       Collection<BarcodeFormat> decodeFormats,
                       String characterSet,
                       CameraManager cameraManager) {
  this.activity = activity;
  decodeThread = new DecodeThread(activity, decodeFormats, characterSet,
      new ViewfinderResultPointCallback(activity.getViewfinderView()));
  decodeThread.start();
  state = State.SUCCESS;

  // Start ourselves capturing previews and decoding.
  this.cameraManager = cameraManager;
  cameraManager.startPreview();
  restartPreviewAndDecode();
}
 
Example 12
Source File: BarCodeScannerHandler.java    From zxingfragmentlib with Apache License 2.0 5 votes vote down vote up
BarCodeScannerHandler(BarCodeScannerFragment fragment,
                      Collection<BarcodeFormat> decodeFormats,
                      Map<DecodeHintType,?> baseHints,
                      String characterSet,
                      CameraManager cameraManager) {
    this.fragment = fragment;
    decodeThread = new DecodeThread(fragment, decodeFormats, baseHints, characterSet,
            new ViewfinderResultPointCallback(fragment.getViewfinderView()));
    decodeThread.start();
    state = State.SUCCESS;

    this.cameraManager = cameraManager;
    cameraManager.startPreview();
    restartPreviewAndDecode();
}