liang530/ScanCode

ScanManager调用scanManager.onPause()

Closed this issue · 0 comments

public void onPause() {

//停止动画,
scanLine.clearAnimation();
if (handler != null) {
handler.quitSynchronously();
handler = null;
}
inactivityTimer.onPause();
beepManager.close();
cameraManager.closeDriver();
if (!isHasSurface) {
scanPreview.getHolder().removeCallback(this);
}
}

public void 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.
// 开启动画
scanLine.startAnimation(animation);
inactivityTimer = new InactivityTimer(activity);
beepManager = new BeepManager(activity);
cameraManager = new CameraManager(activity.getApplicationContext());
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();
}