com.google.zxing.view.ViewfinderView Java Examples

The following examples show how to use com.google.zxing.view.ViewfinderView. 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: CaptureActivity.java    From QrCodeLib with MIT License 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_scanner);
    CameraManager.init(getApplication());
    viewfinderView = (ViewfinderView) findViewById(R.id.viewfinder_content);
    back = (ImageButton) findViewById(R.id.btn_back);
    back.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            finish();
        }
    });

    btnFlash = (ImageButton) findViewById(R.id.btn_flash);
    btnFlash.setOnClickListener(flashListener);

    btnAlbum = (Button) findViewById(R.id.btn_album);
    btnAlbum.setOnClickListener(albumOnClick);

    hasSurface = false;
    inactivityTimer = new InactivityTimer(this);

}
 
Example #2
Source File: CaptureActivity.java    From vmqApk with MIT License 5 votes vote down vote up
/**
     * Called when the activity is first created.
     */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_scanner);
        //ViewUtil.addTopView(getApplicationContext(), this, R.string.scan_card);
        CameraManager.init(getApplication());
        viewfinderView = (ViewfinderView) findViewById(R.id.viewfinder_content);
        back = (ImageButton) findViewById(R.id.btn_back);
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

        btnFlash = (ImageButton) findViewById(R.id.btn_flash);
        btnFlash.setOnClickListener(flashListener);

        btnAlbum = (Button) findViewById(R.id.btn_album);
        btnAlbum.setOnClickListener(albumOnClick);

//		cancelScanButton = (Button) this.findViewById(R.id.btn_cancel_scan);
        hasSurface = false;
        inactivityTimer = new InactivityTimer(this);

    }
 
Example #3
Source File: CaptureActivity.java    From QrCodeDemo4 with MIT License 5 votes vote down vote up
/**
     * Called when the activity is first created.
     */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_scanner);
        //ViewUtil.addTopView(getApplicationContext(), this, R.string.scan_card);
        CameraManager.init(getApplication());
        viewfinderView = (ViewfinderView) findViewById(R.id.viewfinder_content);
        back = (ImageButton) findViewById(R.id.btn_back);
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

        btnFlash = (ImageButton) findViewById(R.id.btn_flash);
        btnFlash.setOnClickListener(flashListener);

        btnAlbum = (Button) findViewById(R.id.btn_album);
        btnAlbum.setOnClickListener(albumOnClick);

//		cancelScanButton = (Button) this.findViewById(R.id.btn_cancel_scan);
        hasSurface = false;
        inactivityTimer = new InactivityTimer(this);

    }
 
Example #4
Source File: CaptureActivity.java    From QrCodeLib with MIT License 4 votes vote down vote up
public ViewfinderView getViewfinderView() {
    return viewfinderView;
}
 
Example #5
Source File: CaptureActivity.java    From vmqApk with MIT License 4 votes vote down vote up
public ViewfinderView getViewfinderView() {
    return viewfinderView;
}
 
Example #6
Source File: CaptureActivity.java    From QrCodeDemo4 with MIT License 4 votes vote down vote up
public ViewfinderView getViewfinderView() {
    return viewfinderView;
}
 
Example #7
Source File: QrCodeScanActivity.java    From AndroidHttpCapture with MIT License 4 votes vote down vote up
@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());
    viewfinderView = (ViewfinderView) findViewById(R.id.viewfinder_view);
    viewfinderView.setCameraManager(cameraManager);

    handler = null;

    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    viewfinderView.setVisibility(View.VISIBLE);

    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);
    }

    decodeFormats = null;
    characterSet = null;

    playBeep = true;
    AudioManager audioService = (AudioManager) getSystemService(AUDIO_SERVICE);
    if (audioService.getRingerMode() != AudioManager.RINGER_MODE_NORMAL) {
        playBeep = false;
    }
    initBeepSound();
    vibrate = true;

    inactivityTimer.onResume();
}
 
Example #8
Source File: QrCodeScanActivity.java    From AndroidHttpCapture with MIT License 4 votes vote down vote up
public ViewfinderView getViewfinderView() {
    return viewfinderView;
}