Java Code Examples for android.view.SurfaceHolder.removeCallback()

The following are Jave code examples for showing how to use removeCallback() of the android.view.SurfaceHolder class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: keepass2android   File: CaptureActivity.java   Source Code and License Vote up 6 votes
@Override
protected void onPause() {
  if (handler != null) {
    handler.quitSynchronously();
    handler = null;
  }
  inactivityTimer.onPause();
  ambientLightManager.stop();
  cameraManager.closeDriver();
  if (!hasSurface) {
    SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view);
    SurfaceHolder surfaceHolder = surfaceView.getHolder();
    surfaceHolder.removeCallback(this);
  }
  super.onPause();
}
 
Example 2
Project: CodeScaner   File: CaptureActivity.java   Source Code and License Vote up 6 votes
@Override
protected void onPause() {
    if (handler != null) {
        handler.quitSynchronously();
        handler = null;
    }
    inactivityTimer.onPause();
    ambientLightManager.stop();
    beepManager.close();
    cameraManager.closeDriver();
    //historyManager = null; // Keep for onActivityResult
    if (!hasSurface) {
        SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view);
        SurfaceHolder surfaceHolder = surfaceView.getHolder();
        surfaceHolder.removeCallback(this);
    }
    super.onPause();
}
 
Example 3
Project: weex-3d-map   File: CaptureActivity.java   Source Code and License Vote up 6 votes
@Override
protected void onPause() {
	if (handler != null) {
		handler.quitSynchronously();
		handler = null;
	}
	inactivityTimer.onPause();
	ambientLightManager.stop();
	beepManager.close();
	cameraManager.closeDriver();
	// historyManager = null; // Keep for onActivityResult
	if (!hasSurface) {
		SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view);
		SurfaceHolder surfaceHolder = surfaceView.getHolder();
		surfaceHolder.removeCallback(this);
	}
	super.onPause();
}
 
Example 4
Project: QrCode   File: QrCodeView.java   Source Code and License Vote up 6 votes
public void onPause() {
    if (handler != null) {
        handler.quitSynchronously();
        handler = null;
    }
    if (inactivityTimer != null) {
        inactivityTimer.onPause();
    }
    if (ambientLightManager != null) {
        ambientLightManager.stop();
    }
    if (beepManager != null) {
        beepManager.close();
    }
    if (cameraManager != null) {
        cameraManager.closeDriver();
    }
    if (!hasSurface) {
        mSurfaceView = new SurfaceView(mActivity, null);
        SurfaceHolder surfaceHolder = mSurfaceView.getHolder();
        surfaceHolder.removeCallback(this);
    }
}
 
Example 5
Project: ZXingAndroidExt   File: QrCodeScannerActivity.java   Source Code and License Vote up 6 votes
@Override
protected void onPause() {
    if (handler != null) {
        handler.quitSynchronously();
        handler = null;
    }
    inactivityTimer.onPause();
    ambientLightManager.stop();
    beepManager.close();
    cameraManager.closeDriver();
    //historyManager = null; // Keep for onActivityResult
    if (!hasSurface) {
        SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view);
        SurfaceHolder surfaceHolder = surfaceView.getHolder();
        surfaceHolder.removeCallback(this);
    }
    super.onPause();
}
 
Example 6
Project: android-mrz-reader   File: CaptureActivity.java   Source Code and License Vote up 6 votes
@Override
protected void onPause() {
    if (handler != null) {
        handler.quitSynchronously();
    }

    // Stop using the camera, to avoid conflicting with other camera-based apps
    cameraManager.closeDriver();

    if (!hasSurface) {
        SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view);
        SurfaceHolder surfaceHolder = surfaceView.getHolder();
        surfaceHolder.removeCallback(this);
    }
    super.onPause();
}
 
Example 7
Project: tvConnect_android   File: CaptureActivity.java   Source Code and License Vote up 6 votes
@Override
protected void onPause() {
    if (handler != null) {
        handler.quitSynchronously();
        handler = null;
    }
    inactivityTimer.onPause();
    ambientLightManager.stop();
    beepManager.close();
    cameraManager.closeDriver();
    if (!hasSurface) {
        SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view);
        SurfaceHolder surfaceHolder = surfaceView.getHolder();
        surfaceHolder.removeCallback(this);
    }
    super.onPause();
}
 
Example 8
Project: tvConnect_android   File: CaptureActivity.java   Source Code and License Vote up 6 votes
@Override
protected void onPause() {
    if (handler != null) {
        handler.quitSynchronously();
        handler = null;
    }
    inactivityTimer.onPause();
    ambientLightManager.stop();
    beepManager.close();
    cameraManager.closeDriver();
    if (!hasSurface) {
        SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view);
        SurfaceHolder surfaceHolder = surfaceView.getHolder();
        surfaceHolder.removeCallback(this);
    }
    super.onPause();
}
 
Example 9
Project: LeCatApp   File: CaptureActivity.java   Source Code and License Vote up 6 votes
/**
 * 暂停活动监控器,关闭摄像头
 */
@Override
protected void onPause() {
    if (mHandler != null) {
        mHandler.quitSynchronously();
        mHandler = null;
    }
    // 暂停活动监控器
    inactivityTimer.onPause();
    // 关闭摄像头
    cameraManager.closeDriver();
    if (!hasSurface) {
        SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view);
        SurfaceHolder surfaceHolder = surfaceView.getHolder();
        surfaceHolder.removeCallback(this);
    }
    super.onPause();
}
 
Example 10
Project: ZxingForAndroid   File: CameraPreview.java   Source Code and License Vote up 5 votes
/**
 * Pause scanning and the camera preview. Typically this should be called from the Activity's
 * onPause() method.
 *
 * Call from UI thread only.
 */
public void pause() {
    // This must be safe to call multiple times.
    Util.validateMainThread();
    Log.d(TAG, "pause()");

    openedOrientation = -1;
    if (cameraInstance != null) {
        cameraInstance.close();
        cameraInstance = null;
        previewActive = false;
    } else {
        stateHandler.sendEmptyMessage(R.id.zxing_camera_closed);
    }
    if (currentSurfaceSize == null && surfaceView != null) {
        SurfaceHolder surfaceHolder = surfaceView.getHolder();
        surfaceHolder.removeCallback(surfaceCallback);
    }
    if(currentSurfaceSize == null && textureView != null && Build.VERSION.SDK_INT >= 14) {
        textureView.setSurfaceTextureListener(null);
    }

    this.containerSize = null;
    this.previewSize = null;
    this.previewFramingRect = null;
    rotationListener.stop();

    fireState.previewStopped();
}
 
Example 11
Project: Ec2m   File: CamaraActivity.java   Source Code and License Vote up 5 votes
public void surfaceDestroyed(SurfaceHolder holder) {
    System.out.println("surfaceDestroyed");
    if (!isopen_camara)
        return;
    if (mCamera != null) {
        holder.removeCallback(this);
        mCamera.setPreviewCallback(null);
        mCamera.stopPreview();
        mCamera.lock();
        mCamera.release();
        mCamera = null;
    }
}
 
Example 12
Project: appinventor-extensions   File: AppInvCaptureActivity.java   Source Code and License Vote up 5 votes
@Override
protected void onPause() {
  if (handler != null) {
    handler.quitSynchronously();
    handler = null;
  }
  cameraManager.closeDriver();
  if (!hasSurface) {
    surfaceView = new SurfaceView(this);
    SurfaceHolder surfaceHolder = surfaceView.getHolder();
    surfaceHolder.removeCallback(this);
  }
  super.onPause();
}
 
Example 13
Project: RLibrary   File: UIScanView.java   Source Code and License Vote up 5 votes
@Override
public void onViewUnload() {
    super.onViewUnload();
    inactivityTimer.shutdown();
    mViewfinderView.recycleLineDrawable();

    if (!hasSurface) {
        SurfaceHolder surfaceHolder = mSurfaceView.getHolder();
        surfaceHolder.removeCallback(this);
    }
}
 
Example 14
Project: LiveWallpaper   File: LiveWallpaperView.java   Source Code and License Vote up 4 votes
@Override
public void surfaceCreated(SurfaceHolder holder) {
    holder.removeCallback(this);
    drawSurfaceView(holder);
}