本文整理汇总了Java中cn.hugo.android.scanner.view.ViewfinderView.setCameraManager方法的典型用法代码示例。如果您正苦于以下问题:Java ViewfinderView.setCameraManager方法的具体用法?Java ViewfinderView.setCameraManager怎么用?Java ViewfinderView.setCameraManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.hugo.android.scanner.view.ViewfinderView
的用法示例。
在下文中一共展示了ViewfinderView.setCameraManager方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onResume
import cn.hugo.android.scanner.view.ViewfinderView; //导入方法依赖的package包/类
@Override
protected void onResume() {
super.onResume();
// CameraManager must be initialized here, not in onCreate(). This is
// necessary because we don't
// want to open the camera driver and measure the screen size if we're
// going to show the help on
// first launch. That led to bugs where the scanning rectangle was the
// wrong size and partially
// off screen.
// 相机初始化的动作需要开启相机并测量屏幕大小,这些操作
// 不建议放到onCreate中,因为如果在onCreate中加上首次启动展示帮助信息的代码的 话,
// 会导致扫描窗口的尺寸计算有误的bug
cameraManager = new CameraManager(getApplication());
viewfinderView = (ViewfinderView) findViewById(R.id.capture_viewfinder_view);
viewfinderView.setCameraManager(cameraManager);
handler = null;
lastResult = null;
// 摄像头预览功能必须借助SurfaceView,因此也需要在一开始对其进行初始化
// 如果需要了解SurfaceView的原理
// 参考:http://blog.csdn.net/luoshengyang/article/details/8661317
SurfaceView surfaceView = (SurfaceView) findViewById(R.id.capture_preview_view); // 预览
SurfaceHolder surfaceHolder = surfaceView.getHolder();
if (hasSurface) {
// The activity was paused but not stopped, so the surface still
// exists. Therefore
// surfaceCreated() won't be called, so init the camera here.
initCamera(surfaceHolder);
} else {
// 防止sdk8的设备初始化预览异常
surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
// Install the callback and wait for surfaceCreated() to init the
// camera.
surfaceHolder.addCallback(this);
}
// 加载声音配置,其实在BeemManager的构造器中也会调用该方法,即在onCreate的时候会调用一次
beepManager.updatePrefs();
// 启动闪光灯调节器
ambientLightManager.start(cameraManager);
// 恢复活动监控器
inactivityTimer.onResume();
source = IntentSource.NONE;
decodeFormats = null;
characterSet = null;
}
示例2: onResume
import cn.hugo.android.scanner.view.ViewfinderView; //导入方法依赖的package包/类
@Override
protected void onResume() {
super.onResume();
// CameraManager must be initialized here, not in onCreate(). This is
// necessary because we don't
// want to open the camera driver and measure the screen size if we're
// going to show the help on
// first launch. That led to bugs where the scanning rectangle was the
// wrong size and partially
// off screen.
// 相机初始化的动作需要开启相机并测量屏幕大小,这些操作
// 不建议放到onCreate中,因为如果在onCreate中加上首次启动展示帮助信息的代码的 话,
// 会导致扫描窗口的尺寸计算有误的bug
cameraManager = new CameraManager(getApplication());
viewfinderView = (ViewfinderView) findViewById(R.id.capture_viewfinder_view);
viewfinderView.setCameraManager(cameraManager);
handler = null;
lastResult = null;
// 摄像头预览功能必须借助SurfaceView,因此也需要在一开始对其进行初始化
// 如果需要了解SurfaceView的原理
// 参考:http://blog.csdn.net/luoshengyang/article/details/8661317
SurfaceView surfaceView = (SurfaceView) findViewById(R.id.capture_preview_view); // 预览
SurfaceHolder surfaceHolder = surfaceView.getHolder();
if (hasSurface) {
// The activity was paused but not stopped, so the surface still
// exists. Therefore
// surfaceCreated() won't be called, so init the camera here.
initCamera(surfaceHolder);
}
else {
// 防止sdk8的设备初始化预览异常
surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
// Install the callback and wait for surfaceCreated() to init the
// camera.
surfaceHolder.addCallback(this);
}
// 加载声音配置,其实在BeemManager的构造器中也会调用该方法,即在onCreate的时候会调用一次
beepManager.updatePrefs();
// 启动闪光灯调节器
ambientLightManager.start(cameraManager);
// 恢复活动监控器
inactivityTimer.onResume();
source = IntentSource.NONE;
decodeFormats = null;
characterSet = null;
}