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


Java CameraManager类代码示例

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


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

示例1: CaptureActivityHandler

import com.google.zxing.camera.CameraManager; //导入依赖的package包/类
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();
}
 
开发者ID:kkyflying,项目名称:CodeScaner,代码行数:17,代码来源:CaptureActivityHandler.java

示例2: CaptureActivityHandler

import com.google.zxing.camera.CameraManager; //导入依赖的package包/类
public CaptureActivityHandler(DefaultCaptureActivity activity,
                              Collection<BarcodeFormat> decodeFormats,
                              Map<DecodeHintType, ?> baseHints, String characterSet,
                              CameraManager cameraManager) {
    this.activity = activity;
    decodeThread = new DecodeThread(activity, decodeFormats, baseHints,
            characterSet, null);
    decodeThread.start();
    state = State.SUCCESS;

    // Start ourselves capturing previews and decoding.
    // 开始拍摄预览和解码
    this.cameraManager = cameraManager;
    cameraManager.startPreview();
    restartPreviewAndDecode();
}
 
开发者ID:maxwell-nc,项目名称:ExhibitionCenter,代码行数:17,代码来源:CaptureActivityHandler.java

示例3: onResume

import com.google.zxing.camera.CameraManager; //导入依赖的package包/类
@Override
protected void onResume() {
    super.onResume();

    // CameraManager必须在这里初始化,而不是在onCreate()中。
    // 这是必须的,因为当我们第一次进入时需要显示帮助页,我们并不想打开Camera,测量屏幕大小
    // 当扫描框的尺寸不正确时会出现bug
    cameraManager = new CameraManager(getApplication());

    handler = null;

    SurfaceHolder surfaceHolder = surfaceView.getHolder();
    if (hasSurface) {
        // activity在paused时但不会stopped,因此surface仍旧存在;
        // surfaceCreated()不会调用,因此在这里初始化camera
        initCamera(surfaceHolder);
    } else {
        // 重置callback,等待surfaceCreated()来初始化camera
        surfaceHolder.addCallback(this);
    }

    decodeFormats = null;
    characterSet = null;
}
 
开发者ID:maxwell-nc,项目名称:ExhibitionCenter,代码行数:25,代码来源:DefaultCaptureActivity.java

示例4: onCreate

import com.google.zxing.camera.CameraManager; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_capture);
    isOpen = false;
    prompt1 = (TextView) findViewById(R.id.prompt1);
    prompt2 = (TextView) findViewById(R.id.prompt2);
    photo = (Button) findViewById(R.id.photo);
    flash = (Button) findViewById(R.id.flash);
    myqrcode = (Button) findViewById(R.id.myqrcode);
    photo.setOnClickListener(this);
    flash.setOnClickListener(this);
    myqrcode.setOnClickListener(this);
    resetTextView();
    CameraManager.init(getApplication());
    initControl();

    hasSurface = false;
    inactivityTimer = new InactivityTimer(this);
}
 
开发者ID:gexingfeiyang,项目名称:TestForMyCapture,代码行数:23,代码来源:CaptureActivity.java

示例5: start

import com.google.zxing.camera.CameraManager; //导入依赖的package包/类
void start(CameraManager cameraManager) {
  this.cameraManager = cameraManager;
  SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
  if (FrontLightMode.readPref(sharedPrefs) == FrontLightMode.AUTO) {
    SensorManager sensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
    lightSensor = sensorManager.getDefaultSensor(Sensor.TYPE_LIGHT);
    if (lightSensor != null) {
      sensorManager.registerListener(this, lightSensor, SensorManager.SENSOR_DELAY_NORMAL);
    }
  }
}
 
开发者ID:kkyflying,项目名称:CodeScaner,代码行数:12,代码来源:AmbientLightManager.java

示例6: CaptureActivityHandler

import com.google.zxing.camera.CameraManager; //导入依赖的package包/类
public CaptureActivityHandler(CaptureActivity activity, CameraManager cameraManager, int decodeMode) {
	this.activity = activity;
	decodeThread = new DecodeThread(activity, decodeMode);
	decodeThread.start();
	state = State.SUCCESS;

	// Start ourselves capturing previews and decoding.
	this.cameraManager = cameraManager;
	cameraManager.startPreview();
	restartPreviewAndDecode();
}
 
开发者ID:wp521,项目名称:MyFire,代码行数:12,代码来源:CaptureActivityHandler.java

示例7: onResume

import com.google.zxing.camera.CameraManager; //导入依赖的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.
	cameraManager = new CameraManager(getApplication());

	handler = null;

	if (isHasSurface) {
		// The activity was paused but not stopped, so the surface still
		// exists. Therefore
		// surfaceCreated() won't be called, so init the camera here.
		initCamera(scanPreview.getHolder());
	} else {
		// Install the callback and wait for surfaceCreated() to init the
		// camera.
		scanPreview.getHolder().addCallback(this);
	}

	inactivityTimer.onResume();
}
 
开发者ID:wp521,项目名称:MyFire,代码行数:29,代码来源:CaptureActivity.java

示例8: onPause

import com.google.zxing.camera.CameraManager; //导入依赖的package包/类
@Override
protected void onPause()
{
    super.onPause();
    if (handler != null)
    {
        handler.quitSynchronously();
        handler = null;
    }
    CameraManager.get().closeDriver();
}
 
开发者ID:gexingfeiyang,项目名称:TestForMyCapture,代码行数:12,代码来源:CaptureActivity.java

示例9: CaptureActivityHandler

import com.google.zxing.camera.CameraManager; //导入依赖的package包/类
public CaptureActivityHandler(CaptureActivity activity, Vector<BarcodeFormat> decodeFormats,
        String characterSet) {
    this.activity = activity;
    decodeThread = new DecodeThread(activity, decodeFormats, characterSet,
            new ViewfinderResultPointCallback(activity.getViewfinderView()));
    decodeThread.start();
    state = State.SUCCESS;
    // Start ourselves capturing previews and decoding.
    CameraManager.get().startPreview();
    restartPreviewAndDecode();
}
 
开发者ID:gexingfeiyang,项目名称:TestForMyCapture,代码行数:12,代码来源:CaptureActivityHandler.java

示例10: quitSynchronously

import com.google.zxing.camera.CameraManager; //导入依赖的package包/类
public void quitSynchronously() {
    state = State.DONE;
    CameraManager.get().stopPreview();
    Message quit = Message.obtain(decodeThread.getHandler(), R.id.quit);
    quit.sendToTarget();
    try {
        decodeThread.join();
    } catch (InterruptedException e) {
        // continue
    }

    // Be absolutely sure we don't send any queued up messages
    removeMessages(R.id.decode_succeeded);
    removeMessages(R.id.decode_failed);
}
 
开发者ID:gexingfeiyang,项目名称:TestForMyCapture,代码行数:16,代码来源:CaptureActivityHandler.java

示例11: restartPreviewAndDecode

import com.google.zxing.camera.CameraManager; //导入依赖的package包/类
private void restartPreviewAndDecode() {
    if (state == State.SUCCESS) {
        state = State.PREVIEW;
        CameraManager.get().requestPreviewFrame(decodeThread.getHandler(), R.id.decode);
        CameraManager.get().requestAutoFocus(this, R.id.auto_focus);
        activity.drawViewfinder();
    }
}
 
开发者ID:gexingfeiyang,项目名称:TestForMyCapture,代码行数:9,代码来源:CaptureActivityHandler.java

示例12: onCreate

import com.google.zxing.camera.CameraManager; //导入依赖的package包/类
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.qr_code_scan);

    CameraManager.init(getApplication());
    initControl();

    hasSurface = false;
    inactivityTimer = new InactivityTimer(this);
}
 
开发者ID:shengge,项目名称:eoe-android-app,代码行数:14,代码来源:CaptureActivity.java

示例13: onPause

import com.google.zxing.camera.CameraManager; //导入依赖的package包/类
@Override
protected void onPause() {
    super.onPause();
    if (handler != null) {
        handler.quitSynchronously();
        handler = null;
    }
    CameraManager.get().closeDriver();
}
 
开发者ID:shengge,项目名称:eoe-android-app,代码行数:10,代码来源:CaptureActivity.java

示例14: getCameraManager

import com.google.zxing.camera.CameraManager; //导入依赖的package包/类
CameraManager getCameraManager() {
    return cameraManager;
}
 
开发者ID:kkyflying,项目名称:CodeScaner,代码行数:4,代码来源:CaptureActivity.java

示例15: onResume

import com.google.zxing.camera.CameraManager; //导入依赖的package包/类
@Override
protected void onResume() {
    super.onResume();

    // historyManager must be initialized here to update the history preference

    // 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.
    cameraManager = new CameraManager(getApplication());

    viewfinderView = (ViewfinderView) findViewById(R.id.viewfinder_view);
    viewfinderView.setCameraManager(cameraManager);

    handler = null;

    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);

    beepManager.updatePrefs();
    ambientLightManager.start(cameraManager);

    inactivityTimer.onResume();

    decodeFormats = EnumSet.noneOf(BarcodeFormat.class);
    decodeFormats.addAll(DecodeFormatManager.QR_CODE_FORMATS);
    decodeFormats.addAll(DecodeFormatManager.ONE_D_FORMATS);
    characterSet = null;

    SurfaceView surfaceView = (SurfaceView) findViewById(R.id.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 {
        // Install the callback and wait for surfaceCreated() to init the camera.
        surfaceHolder.addCallback(this);
    }
}
 
开发者ID:kkyflying,项目名称:CodeScaner,代码行数:44,代码来源:CaptureActivity.java


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