• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java OpenCameraInterface类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.zxing.client.android.camera.open.OpenCameraInterface的典型用法代码示例。如果您正苦于以下问题:Java OpenCameraInterface类的具体用法?Java OpenCameraInterface怎么用?Java OpenCameraInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



OpenCameraInterface类属于com.google.zxing.client.android.camera.open包,在下文中一共展示了OpenCameraInterface类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: openDriver

import com.google.zxing.client.android.camera.open.OpenCameraInterface; //导入依赖的package包/类
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();
}
 
开发者ID:AlexMofer,项目名称:ProjectX,代码行数:35,代码来源:ZxingScanView.java


示例2: openDriver

import com.google.zxing.client.android.camera.open.OpenCameraInterface; //导入依赖的package包/类
/**
 * Opens the camera driver and initializes the hardware parameters.
 *
 * @param holder The surface object which the camera will draw preview frames into.
 * @throws IOException Indicates the camera driver failed to open.
 */
public synchronized void openDriver(SurfaceHolder holder) throws IOException {
  Camera theCamera = camera;
  if (theCamera == null) {
    theCamera = OpenCameraInterface.open();
    if (theCamera == null) {
      throw new IOException();
    }
    camera = theCamera;
  }
  theCamera.setPreviewDisplay(holder);

  if (!initialized) {
    initialized = true;
    configManager.initFromCameraParameters(theCamera);
    if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) {
      setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight);
      requestedFramingRectWidth = 0;
      requestedFramingRectHeight = 0;
    }
  }

  Camera.Parameters parameters = theCamera.getParameters();
  String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save these, temporarily
  try {
    configManager.setDesiredCameraParameters(theCamera, false);
  } catch (RuntimeException re) {
    // Driver failed
    Log.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters");
    Log.i(TAG, "Resetting to saved camera params: " + parametersFlattened);
    // Reset:
    if (parametersFlattened != null) {
      parameters = theCamera.getParameters();
      parameters.unflatten(parametersFlattened);
      try {
        theCamera.setParameters(parameters);
        configManager.setDesiredCameraParameters(theCamera, true);
      } catch (RuntimeException re2) {
        // Well, darn. Give up
        Log.w(TAG, "Camera rejected even safe-mode parameters! No configuration");
      }
    }
  }

}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:51,代码来源:CameraManager.java


示例3: openDriver

import com.google.zxing.client.android.camera.open.OpenCameraInterface; //导入依赖的package包/类
/**
 * Opens the camera driver and initializes the hardware parameters.
 *
 * @param holder The surface object which the camera will draw preview frames into.
 * @throws IOException Indicates the camera driver failed to open.
 */
public synchronized void openDriver(SurfaceHolder holder) throws IOException {
  OpenCamera theCamera = camera;
  if (theCamera == null) {
    theCamera = OpenCameraInterface.open(requestedCameraId);
    if (theCamera == null) {
      throw new IOException("Camera.open() failed to return object from driver");
    }
    camera = theCamera;
  }

  if (!initialized) {
    initialized = true;
    configManager.initFromCameraParameters(theCamera);
    if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) {
      setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight);
      requestedFramingRectWidth = 0;
      requestedFramingRectHeight = 0;
    }
  }

  Camera cameraObject = theCamera.getCamera();
  Camera.Parameters parameters = cameraObject.getParameters();
  String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save these, temporarily
  try {
    configManager.setDesiredCameraParameters(theCamera, false);
  } catch (RuntimeException re) {
    // Driver failed
    Log.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters");
    Log.i(TAG, "Resetting to saved camera params: " + parametersFlattened);
    // Reset:
    if (parametersFlattened != null) {
      parameters = cameraObject.getParameters();
      parameters.unflatten(parametersFlattened);
      try {
        cameraObject.setParameters(parameters);
        configManager.setDesiredCameraParameters(theCamera, true);
      } catch (RuntimeException re2) {
        // Well, darn. Give up
        Log.w(TAG, "Camera rejected even safe-mode parameters! No configuration");
      }
    }
  }
  cameraObject.setPreviewDisplay(holder);

}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:52,代码来源:CameraManager.java


示例4: openDriver

import com.google.zxing.client.android.camera.open.OpenCameraInterface; //导入依赖的package包/类
/**
 * Opens the camera driver and initializes the hardware parameters.
 *
 * @param holder The surface object which the camera will draw preview frames into.
 * @throws IOException Indicates the camera driver failed to open.
 */
public synchronized void openDriver(SurfaceHolder holder) throws IOException {
    Camera theCamera = camera;
    if (theCamera == null) {

        theCamera = OpenCameraInterface.open(requestedCameraId);
        if (theCamera == null) {
            throw new IOException();
        }
        camera = theCamera;
    }
    theCamera.setPreviewDisplay(holder);

    if (!initialized) {
        initialized = true;
        configManager.initFromCameraParameters(theCamera);
    }

    Camera.Parameters parameters = theCamera.getParameters();
    String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save these, temporarily
    try {
        configManager.setDesiredCameraParameters(theCamera, false);
    } catch (RuntimeException re) {
        // Driver failed
        Log.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters");
        Log.i(TAG, "Resetting to saved camera params: " + parametersFlattened);
        // Reset:
        if (parametersFlattened != null) {
            parameters = theCamera.getParameters();
            parameters.unflatten(parametersFlattened);
            try {
                theCamera.setParameters(parameters);
                configManager.setDesiredCameraParameters(theCamera, true);
            } catch (RuntimeException re2) {
                // Well, darn. Give up
                Log.w(TAG, "Camera rejected even safe-mode parameters! No configuration");
            }
        }
    }

}
 
开发者ID:snice,项目名称:androidscan,代码行数:47,代码来源:CameraManager.java


示例5: openDriver

import com.google.zxing.client.android.camera.open.OpenCameraInterface; //导入依赖的package包/类
/**
 * Opens the camera driver and initializes the hardware parameters.
 *
 * @param holder The surface object which the camera will draw preview frames into.
 * @throws IOException Indicates the camera driver failed to open.
 */
public synchronized void openDriver(SurfaceHolder holder) throws IOException {
    OpenCamera theCamera = camera;
    if (theCamera == null) {
        theCamera = OpenCameraInterface.open(requestedCameraId);
        if (theCamera == null) {
            throw new IOException("Camera.open() failed to return object from driver");
        }
        camera = theCamera;
    }

    if (!initialized) {
        initialized = true;
        configManager.initFromCameraParameters(theCamera, view.getWidth(), view.getHeight());
        if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) {
            setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight, requestedFramingRectTopOffset);
            requestedFramingRectWidth = 0;
            requestedFramingRectHeight = 0;
        }
    }

    Camera cameraObject = theCamera.getCamera();
    Camera.Parameters parameters = cameraObject.getParameters();
    String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save these, temporarily
    try {
        configManager.setDesiredCameraParameters(theCamera, false, mUseAutoFocus);
    } catch (RuntimeException re) {
        // Driver failed
        LogEx.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters");
        LogEx.i(TAG, "Resetting to saved camera params: " + parametersFlattened);
        // Reset:
        if (parametersFlattened != null) {
            parameters = cameraObject.getParameters();
            parameters.unflatten(parametersFlattened);
            try {
                cameraObject.setParameters(parameters);
                configManager.setDesiredCameraParameters(theCamera, true, mUseAutoFocus);
            } catch (RuntimeException re2) {
                // Well, darn. Give up
                LogEx.w(TAG, "Camera rejected even safe-mode parameters! No configuration");
            }
        }
    }
    cameraObject.setPreviewDisplay(holder);

}
 
开发者ID:CoderChoy,项目名称:BarcodeReaderView,代码行数:52,代码来源:CameraManager.java


示例6: openDriver

import com.google.zxing.client.android.camera.open.OpenCameraInterface; //导入依赖的package包/类
/**
 * Opens the camera driver and initializes the hardware parameters.
 *
 * @param holder
 *            The surface object which the camera will draw preview frames
 *            into.
 * @throws IOException
 *             Indicates the camera driver failed to open.
 */
public synchronized void openDriver(SurfaceHolder holder) throws IOException {
	OpenCamera theCamera = camera;
	if (theCamera == null) {
		theCamera = OpenCameraInterface.open(requestedCameraId);
		if (theCamera == null) {
			throw new IOException("Camera.open() failed to return object from driver");
		}
		camera = theCamera;
	}

	if (!initialized) {
		initialized = true;
		configManager.initFromCameraParameters(theCamera);
		if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) {
			setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight);
			requestedFramingRectWidth = 0;
			requestedFramingRectHeight = 0;
		}
	}

	Camera cameraObject = theCamera.getCamera();
	Camera.Parameters parameters = cameraObject.getParameters();
	String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save
																					// these,
																					// temporarily
	try {
		configManager.setDesiredCameraParameters(theCamera, false);
	} catch (RuntimeException re) {
		// Driver failed
		Log.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters");
		Log.i(TAG, "Resetting to saved camera params: " + parametersFlattened);
		// Reset:
		if (parametersFlattened != null) {
			parameters = cameraObject.getParameters();
			parameters.unflatten(parametersFlattened);
			try {
				cameraObject.setParameters(parameters);
				configManager.setDesiredCameraParameters(theCamera, true);
			} catch (RuntimeException re2) {
				// Well, darn. Give up
				Log.w(TAG, "Camera rejected even safe-mode parameters! No configuration");
			}
		}
	}
	cameraObject.setPreviewDisplay(holder);

}
 
开发者ID:xiong-it,项目名称:PortraitZXing,代码行数:57,代码来源:CameraManager.java


示例7: openDriver

import com.google.zxing.client.android.camera.open.OpenCameraInterface; //导入依赖的package包/类
/**
 * Opens the camera driver and initializes the hardware parameters.
 *
 * @param holder The surface object which the camera will draw preview frames into.
 * @throws IOException Indicates the camera driver failed to open.
 */
public synchronized void openDriver(SurfaceHolder holder) throws IOException {
  Camera theCamera = camera;
  if (theCamera == null) {
 
    if (requestedCameraId >= 0) {
      theCamera = OpenCameraInterface.open(requestedCameraId);
    } else {
      theCamera = OpenCameraInterface.open();
    }
    
    if (theCamera == null) {
      throw new IOException();
    }
    camera = theCamera;
  }
  theCamera.setPreviewDisplay(holder);

  if (!initialized) {
    initialized = true;
    configManager.initFromCameraParameters(theCamera);
    if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) {
      setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight);
      requestedFramingRectWidth = 0;
      requestedFramingRectHeight = 0;
    }
  }

  Camera.Parameters parameters = theCamera.getParameters();
  String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save these, temporarily
  try {
    configManager.setDesiredCameraParameters(theCamera, false);
  } catch (RuntimeException re) {
    // Driver failed
    Log.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters");
    Log.i(TAG, "Resetting to saved camera params: " + parametersFlattened);
    // Reset:
    if (parametersFlattened != null) {
      parameters = theCamera.getParameters();
      parameters.unflatten(parametersFlattened);
      try {
        theCamera.setParameters(parameters);
        configManager.setDesiredCameraParameters(theCamera, true);
      } catch (RuntimeException re2) {
        // Well, darn. Give up
        Log.w(TAG, "Camera rejected even safe-mode parameters! No configuration");
      }
    }
  }

}
 
开发者ID:SudarAbisheck,项目名称:ZXing-Orient,代码行数:57,代码来源:CameraManager.java


示例8: openDriver

import com.google.zxing.client.android.camera.open.OpenCameraInterface; //导入依赖的package包/类
/**
 * Opens the camera driver and initializes the hardware parameters.
 *
 * @param holder
 *            The surface object which the camera will draw preview frames
 *            into.
 * @throws IOException
 *             Indicates the camera driver failed to open.
 * @throws InterruptedException
 *              Thrown when a waiting thread is activated before the condition it was waiting
 *              for has been satisfied.
 */
public synchronized void openDriver(SurfaceHolder holder)
        throws IOException, InterruptedException {
    Camera theCamera = camera;
    if (theCamera == null) {
        theCamera = OpenCameraInterface.open();
        if (theCamera == null) {
            throw new IOException();
        }
        camera = theCamera;
    }
    theCamera.setPreviewDisplay(holder);

    if (!initialized) {
        initialized = true;
        configManager.initFromCameraParameters(theCamera);
        if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) {
            setManualFramingRect(requestedFramingRectWidth,
                    requestedFramingRectHeight);
            requestedFramingRectWidth = 0;
            requestedFramingRectHeight = 0;
        }
    }

    Camera.Parameters parameters = theCamera.getParameters();
    String parametersFlattened = parameters == null ? null : parameters
            .flatten(); // Save these, temporarily
    try {
        configManager.setDesiredCameraParameters(theCamera, false);
    } catch (RuntimeException re) {
        // Driver failed
        Log.w(TAG,
                "Camera rejected parameters. Setting only minimal safe-mode parameters");
        Log.i(TAG, "Resetting to saved camera params: "
                + parametersFlattened);
        // Reset:
        if (parametersFlattened != null) {
            parameters = theCamera.getParameters();
            parameters.unflatten(parametersFlattened);
            try {
                theCamera.setParameters(parameters);
                configManager.setDesiredCameraParameters(theCamera, true);
            } catch (RuntimeException re2) {
                // Well, darn. Give up
                Log.w(TAG,
                        "Camera rejected even safe-mode parameters! No configuration");
            }
        }
    }

}
 
开发者ID:chenkel,项目名称:Lokalisierung-mit-Wearables,代码行数:63,代码来源:CameraManager.java


示例9: openDriver

import com.google.zxing.client.android.camera.open.OpenCameraInterface; //导入依赖的package包/类
/**
 * Opens the camera driver and initializes the hardware parameters.
 *
 * @param holder The surface object which the camera will draw preview frames into.
 * @throws IOException Indicates the camera driver failed to open.
 */
public synchronized void openDriver(SurfaceHolder holder) throws IOException {
    Camera theCamera = camera;
    if (theCamera == null) {

        theCamera = OpenCameraInterface.open(requestedCameraId);
        if (theCamera == null) {
            throw new IOException();
        }
        camera = theCamera;
    }
    theCamera.setPreviewDisplay(holder);

    if (!initialized) {
        initialized = true;
        configManager.initFromCameraParameters(theCamera);
        if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) {
            setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight);
            requestedFramingRectWidth = 0;
            requestedFramingRectHeight = 0;
        }
    }

    Camera.Parameters parameters = theCamera.getParameters();
    String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save these, temporarily
    try {
        configManager.setDesiredCameraParameters(theCamera, false);
    } catch (RuntimeException re) {
        // Driver failed
        Log.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters");
        Log.i(TAG, "Resetting to saved camera params: " + parametersFlattened);
        // Reset:
        if (parametersFlattened != null) {
            parameters = theCamera.getParameters();
            parameters.unflatten(parametersFlattened);
            try {
                theCamera.setParameters(parameters);
                configManager.setDesiredCameraParameters(theCamera, true);
            } catch (RuntimeException re2) {
                // Well, darn. Give up
                Log.w(TAG, "Camera rejected even safe-mode parameters! No configuration");
            }
        }
    }

}
 
开发者ID:yingLanNull,项目名称:ZxingLite,代码行数:52,代码来源:CameraManager.java


示例10: openDriver

import com.google.zxing.client.android.camera.open.OpenCameraInterface; //导入依赖的package包/类
/**
 * Opens the camera driver and initializes the hardware parameters.
 *
 * @param holder The surface object which the camera will draw preview frames
 *               into.
 * @throws IOException          Indicates the camera driver failed to open.
 * @throws InterruptedException
 */
public synchronized void openDriver(SurfaceHolder holder)
        throws IOException, InterruptedException {
    Camera theCamera = camera;
    if (theCamera == null) {
        theCamera = OpenCameraInterface.open();
        if (theCamera == null) {
            throw new IOException();
        }
        camera = theCamera;
    }
    theCamera.setPreviewDisplay(holder);

    if (!initialized) {
        initialized = true;
        configManager.initFromCameraParameters(theCamera);
        if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) {
            setManualFramingRect(requestedFramingRectWidth,
                    requestedFramingRectHeight);
            requestedFramingRectWidth = 0;
            requestedFramingRectHeight = 0;
        }
    }

    Camera.Parameters parameters = theCamera.getParameters();
    String parametersFlattened = parameters == null ? null : parameters
            .flatten(); // Save these, temporarily
    try {
        configManager.setDesiredCameraParameters(theCamera, false);
    } catch (RuntimeException re) {
        // Driver failed
        Log.w(TAG,
                "Camera rejected parameters. Setting only minimal safe-mode parameters");
        Log.i(TAG, "Resetting to saved camera params: "
                + parametersFlattened);
        // Reset:
        if (parametersFlattened != null) {
            parameters = theCamera.getParameters();
            parameters.unflatten(parametersFlattened);
            try {
                theCamera.setParameters(parameters);
                configManager.setDesiredCameraParameters(theCamera, true);
            } catch (RuntimeException re2) {
                // Well, darn. Give up
                Log.w(TAG,
                        "Camera rejected even safe-mode parameters! No configuration");
            }
        }
    }

}
 
开发者ID:raahilshah,项目名称:ProjectKilo,代码行数:59,代码来源:CameraManager.java


示例11: openDriver

import com.google.zxing.client.android.camera.open.OpenCameraInterface; //导入依赖的package包/类
/**
 * Opens the camera driver and initializes the hardware parameters.
 *
 * @param holder The surface object which the camera will draw preview frames into.
 * @throws IOException Indicates the camera driver failed to open.
 */
public synchronized void openDriver(SurfaceHolder holder) throws IOException {
    OpenCamera theCamera = camera;
    if (theCamera == null) {
        theCamera = OpenCameraInterface.open(requestedCameraId);
        if (theCamera == null) {
            throw new IOException("Camera.open() failed to return object from driver");
        }
        camera = theCamera;
    }

    if (!initialized) {
        initialized = true;
        configManager.initFromCameraParameters(theCamera);
        if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) {
            setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight);
            requestedFramingRectWidth = 0;
            requestedFramingRectHeight = 0;
        }
    }

    Camera cameraObject = theCamera.getCamera();
    Camera.Parameters parameters = cameraObject.getParameters();
    String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save these, temporarily
    try {
        configManager.setDesiredCameraParameters(theCamera, false);
    } catch (RuntimeException re) {
        // Driver failed
        Log.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters");
        Log.i(TAG, "Resetting to saved camera params: " + parametersFlattened);
        // Reset:
        if (parametersFlattened != null) {
            parameters = cameraObject.getParameters();
            parameters.unflatten(parametersFlattened);
            try {
                cameraObject.setParameters(parameters);
                configManager.setDesiredCameraParameters(theCamera, true);
            } catch (RuntimeException re2) {
                // Well, darn. Give up
                Log.w(TAG, "Camera rejected even safe-mode parameters! No configuration");
            }
        }
    }
    cameraObject.setPreviewDisplay(holder);

}
 
开发者ID:AlexMofer,项目名称:ProjectX,代码行数:52,代码来源:CameraManager.java


示例12: initView

import com.google.zxing.client.android.camera.open.OpenCameraInterface; //导入依赖的package包/类
private void initView(AttributeSet attrs) {
    int mode = AmbientLightManager.MODE_AUTO;
    int feedback = ScanFeedbackManager.MODE_AUTO;
    String fileName;
    int rawId = NO_ID;
    int scanWidth = ViewGroup.LayoutParams.MATCH_PARENT;
    int scanHeight = ViewGroup.LayoutParams.MATCH_PARENT;
    int cameraId = OpenCameraInterface.NO_REQUESTED_CAMERA;
    int milliseconds = ScanFeedbackManager.DEFAUT_MILLISECONDS;
    int barcodeType = BarcodeType.DEFAULT;
    String characterSet;
    TypedArray custom = getContext().obtainStyledAttributes(attrs, R.styleable.ZxingScanView);
    mode = custom.getInt(R.styleable.ZxingScanView_zsvAmbientLight, mode);
    feedback = custom.getInt(R.styleable.ZxingScanView_zsvFeedback, feedback);
    fileName = custom.getString(R.styleable.ZxingScanView_zsvAudioAssetsFileName);
    rawId = custom.getResourceId(R.styleable.ZxingScanView_zsvAudioRaw, rawId);
    milliseconds = custom.getInteger(R.styleable.ZxingScanView_zsvVibrateMilliseconds,
            milliseconds);
    scanWidth = custom.getLayoutDimension(R.styleable.ZxingScanView_zsvScanWidth, scanWidth);
    scanHeight = custom.getLayoutDimension(R.styleable.ZxingScanView_zsvScanHeight, scanHeight);
    cameraId = custom.getInteger(R.styleable.ZxingScanView_zsvCameraId, cameraId);
    barcodeType = custom.getInt(R.styleable.ZxingScanView_zsvBarcode, barcodeType);
    characterSet = custom.getString(R.styleable.ZxingScanView_zsvCharacterSet);
    custom.recycle();
    setScanWidth(scanWidth);
    setScanHeight(scanHeight);
    setCameraId(cameraId);
    setScanBarcodeType(barcodeType);
    setScanCharacterSet(characterSet);
    setFocusable(true);
    setFocusableInTouchMode(true);
    setKeepScreenOn(true);
    if (isInEditMode())
        return;
    mAmbientLightManager = new AmbientLightManager(getContext(),
            new AmbientLightCallBack(), mode);
    mScanFeedbackManager = new ScanFeedbackManager(getContext());
    setFeedbackMode(feedback);
    setFeedbackAudioAssetsFileName(fileName);
    setFeedbackAudioRawId(rawId);
    setFeedbackVibrateMilliseconds(milliseconds);
    getHolder().addCallback(new CameraCallBack());
}
 
开发者ID:AlexMofer,项目名称:ProjectX,代码行数:44,代码来源:ZxingScanView.java


示例13: openDriver

import com.google.zxing.client.android.camera.open.OpenCameraInterface; //导入依赖的package包/类
/**
 * Opens the camera driver and initializes the hardware parameters.
 *
 * @param holder
 *            The surface object which the camera will draw preview frames
 *            into.
 * @throws IOException
 *             Indicates the camera driver failed to open.
 * @throws InterruptedException
 */
public synchronized void openDriver(SurfaceHolder holder)
        throws IOException, InterruptedException {
    Camera theCamera = camera;
    if (theCamera == null) {
        theCamera = OpenCameraInterface.open();
        if (theCamera == null) {
            throw new IOException();
        }
        camera = theCamera;
    }
    theCamera.setPreviewDisplay(holder);

    if (!initialized) {
        initialized = true;
        configManager.initFromCameraParameters(theCamera);
        if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) {
            setManualFramingRect(requestedFramingRectWidth,
                    requestedFramingRectHeight);
            requestedFramingRectWidth = 0;
            requestedFramingRectHeight = 0;
        }
    }

    Camera.Parameters parameters = theCamera.getParameters();
    String parametersFlattened = parameters == null ? null : parameters
            .flatten(); // Save these, temporarily
    try {
        configManager.setDesiredCameraParameters(theCamera, false);
    } catch (RuntimeException re) {
        // Driver failed
        Log.w(TAG,
                "Camera rejected parameters. Setting only minimal safe-mode parameters");
        Log.i(TAG, "Resetting to saved camera params: "
                + parametersFlattened);
        // Reset:
        if (parametersFlattened != null) {
            parameters = theCamera.getParameters();
            parameters.unflatten(parametersFlattened);
            try {
                theCamera.setParameters(parameters);
                configManager.setDesiredCameraParameters(theCamera, true);
            } catch (RuntimeException re2) {
                // Well, darn. Give up
                Log.w(TAG,
                        "Camera rejected even safe-mode parameters! No configuration");
            }
        }
    }

}
 
开发者ID:corneliudascalu,项目名称:google-glass-share-barcode-bluetooth,代码行数:61,代码来源:CameraManager.java


示例14: openDriver

import com.google.zxing.client.android.camera.open.OpenCameraInterface; //导入依赖的package包/类
/**
 * Opens the camera driver and initializes the hardware parameters.
 *
 * @param holder The surface object which the camera will draw preview frames
 *               into.
 * @throws java.io.IOException Indicates the camera driver failed to open.
 */
public synchronized void openDriver(SurfaceHolder holder)
        throws IOException, InterruptedException {
    Camera theCamera = camera;
    if (theCamera == null) {
        theCamera = OpenCameraInterface.open();
        if (theCamera == null) {
            throw new IOException();
        }
        camera = theCamera;
    }
    theCamera.setPreviewDisplay(holder);

    if (!initialized) {
        initialized = true;
        configManager.initFromCameraParameters(theCamera);
        if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) {
            setManualFramingRect(requestedFramingRectWidth,
                    requestedFramingRectHeight);
            requestedFramingRectWidth = 0;
            requestedFramingRectHeight = 0;
        }
    }

    Camera.Parameters parameters = theCamera.getParameters();
    String parametersFlattened = parameters == null ? null : parameters
            .flatten(); // Save these, temporarily
    try {
        configManager.setDesiredCameraParameters(theCamera, false);
    } catch (RuntimeException re) {
        // Driver failed
        Log.w(TAG,
                "Camera rejected parameters. Setting only minimal safe-mode parameters");
        Log.i(TAG, "Resetting to saved camera params: "
                + parametersFlattened);
        // Reset:
        if (parametersFlattened != null) {
            parameters = theCamera.getParameters();
            parameters.unflatten(parametersFlattened);
            try {
                theCamera.setParameters(parameters);
                configManager.setDesiredCameraParameters(theCamera, true);
            } catch (RuntimeException re2) {
                // Well, darn. Give up
                Log.w(TAG,
                        "Camera rejected even safe-mode parameters! No configuration");
            }
        }
    }

}
 
开发者ID:pt2121,项目名称:NYC-Glass-Challenge-Oct2014,代码行数:58,代码来源:CameraManager.java


示例15: openDriver

import com.google.zxing.client.android.camera.open.OpenCameraInterface; //导入依赖的package包/类
/**
 * Opens the camera driver and initializes the hardware parameters.
 *
 * @param holder The surface object which the camera will draw preview frames into.
 * @throws IOException Indicates the camera driver failed to open.
 */
public synchronized void openDriver(SurfaceHolder holder) throws IOException {
    Camera theCamera = camera;
    if (theCamera == null) {

        theCamera = OpenCameraInterface.open(requestedCameraId);
        if (theCamera == null) {
            throw new IOException();
        }
        camera = theCamera;
    }
    theCamera.setPreviewDisplay(holder);

    if (!initialized) {
        initialized = true;
        configManager.initFromCameraParameters(theCamera);
        if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) {
            setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight);
            requestedFramingRectWidth = 0;
            requestedFramingRectHeight = 0;
        }
    }

    Camera.Parameters parameters = theCamera.getParameters();
    String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save these, temporarily
    try {
        configManager.setDesiredCameraParameters(theCamera, false);
    } catch (RuntimeException re) {
        // Driver failed
        Log.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters");
        Log.i(TAG, "Resetting to saved camera params: " + parametersFlattened);
        // Reset:
        if (parametersFlattened != null) {
            parameters = theCamera.getParameters();
            parameters.unflatten(parametersFlattened);
            try {
                theCamera.setParameters(parameters);
                configManager.setDesiredCameraParameters(theCamera, true);
            } catch (RuntimeException re2) {
                // Well, darn. Give up
                Log.w(TAG, "Camera rejected even safe-mode parameters! No configuration");
            }
        }
    }
}
 
开发者ID:oVirt,项目名称:moVirt,代码行数:51,代码来源:CameraManager.java


示例16: openDriver

import com.google.zxing.client.android.camera.open.OpenCameraInterface; //导入依赖的package包/类
/**
 * Opens the camera driver and initializes the hardware parameters.
 *
 * @param holder The surface object which the camera will draw preview frames into.
 * @throws IOException Indicates the camera driver failed to open.
 */
public synchronized void openDriver(SurfaceHolder holder) throws IOException {
  Camera theCamera = camera;
  if (theCamera == null) {

    if (requestedCameraId >= 0) {
      theCamera = OpenCameraInterface.open(requestedCameraId);
    } else {
      theCamera = OpenCameraInterface.open();
    }
    
    if (theCamera == null) {
      throw new IOException();
    }
    camera = theCamera;
  }
  theCamera.setPreviewDisplay(holder);

  if (!initialized) {
    initialized = true;
    configManager.initFromCameraParameters(theCamera);
    if (requestedFramingRectWidth > 0 && requestedFramingRectHeight > 0) {
      setManualFramingRect(requestedFramingRectWidth, requestedFramingRectHeight);
      requestedFramingRectWidth = 0;
      requestedFramingRectHeight = 0;
    }
  }

  Camera.Parameters parameters = theCamera.getParameters();
  String parametersFlattened = parameters == null ? null : parameters.flatten(); // Save these, temporarily
  try {
    configManager.setDesiredCameraParameters(theCamera, false);
  } catch (RuntimeException re) {
    // Driver failed
    Log.w(TAG, "Camera rejected parameters. Setting only minimal safe-mode parameters");
    Log.i(TAG, "Resetting to saved camera params: " + parametersFlattened);
    // Reset:
    if (parametersFlattened != null) {
      parameters = theCamera.getParameters();
      parameters.unflatten(parametersFlattened);
      try {
        theCamera.setParameters(parameters);
        configManager.setDesiredCameraParameters(theCamera, true);
      } catch (RuntimeException re2) {
        // Well, darn. Give up
        Log.w(TAG, "Camera rejected even safe-mode parameters! No configuration");
      }
    }
  }

}
 
开发者ID:mitoyarzun,项目名称:zxingfragmentlib,代码行数:57,代码来源:CameraManager.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ResultHandlerFactory类代码示例发布时间:2022-05-21
下一篇:
Java BitcoinURI类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap