Search in sources :

Example 1 with CameraManager

use of cn.teachcourse.scancode.camera.CameraManager in project BlogSource by TeachCourse.

the class CaptureActivity method onResume.

@Override
protected void onResume() {
    super.onResume();
    if (getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }
    cameraManager = new CameraManager(getApplication());
    viewfinderView.setCameraManager(cameraManager);
    SurfaceHolder surfaceHolder = surfaceView.getHolder();
    if (hasSurface) {
        initCamera(surfaceHolder);
    } else {
        surfaceHolder.addCallback(this);
        surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
    }
    decodeFormats = null;
    characterSet = null;
    playBeep = true;
    AudioManager audioService = (AudioManager) getSystemService(AUDIO_SERVICE);
    if (audioService.getRingerMode() != AudioManager.RINGER_MODE_NORMAL) {
        playBeep = false;
    }
    initBeepSound();
    vibrate = true;
    if (null != cameraManager) {
        if (cameraManager.TheLightIsOnOrOff()) {
            switchUI.setChecked(true);
            scanImg.setImageResource(R.drawable.scan_open_img);
            openOrClose = "1";
        } else {
            switchUI.setChecked(false);
            scanImg.setImageResource(R.drawable.scan_close_img);
            openOrClose = "0";
        }
    }
}
Also used : SurfaceHolder(android.view.SurfaceHolder) AudioManager(android.media.AudioManager) CameraManager(cn.teachcourse.scancode.camera.CameraManager)

Aggregations

AudioManager (android.media.AudioManager)1 SurfaceHolder (android.view.SurfaceHolder)1 CameraManager (cn.teachcourse.scancode.camera.CameraManager)1