mirror of
https://github.com/zxing/zxing.git
synced 2024-11-10 04:54:04 -08:00
Fixed the cameraId changing on powerbutton press
This commit is contained in:
parent
2a07421ada
commit
cec4b529a2
|
@ -176,16 +176,6 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
|||
|
||||
resetStatusView();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
beepManager.updatePrefs();
|
||||
ambientLightManager.start(cameraManager);
|
||||
|
@ -261,6 +251,17 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
|||
characterSet = intent.getStringExtra(Intents.Scan.CHARACTER_SET);
|
||||
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
private int getCurrentOrientation() {
|
||||
|
|
Loading…
Reference in a new issue