Example usage for android.view SurfaceHolder getSurface

List of usage examples for android.view SurfaceHolder getSurface

Introduction

In this page you can find the example usage for android.view SurfaceHolder getSurface.

Prototype

public Surface getSurface();

Source Link

Document

Direct access to the surface object.

Usage

From source file:com.almalence.opencam.ApplicationScreen.java

@Override
public void surfaceChanged(final SurfaceHolder holder, final int format, final int width, final int height) {
    if (!cameraPermissionGranted || !storagePermissionGranted)
        return;/*from   ww  w. j a v a 2 s .c  o  m*/

    Log.e("ApplicationScreen", "SURFACE CHANGED");
    mCameraSurface = holder.getSurface();

    if (isCameraConfiguring) {
        ApplicationScreen.getPluginManager().sendMessage(ApplicationInterface.MSG_SURFACE_CONFIGURED, 0);
        isCameraConfiguring = false;
    } else {
        new CountDownTimer(50, 50) {
            public void onTick(long millisUntilFinished) {
                // Not used
            }

            public void onFinish() {
                if (!ApplicationScreen.instance.mPausing && surfaceCreated
                        && (!CameraController.isCameraCreated())) {
                    ApplicationScreen.instance.findViewById(R.id.mainLayout2).setVisibility(View.VISIBLE);
                    if (!CameraController.isRemoteCamera()) {
                        if (!CameraController.isUseCamera2()) {
                            CameraController.setupCamera(holder, true);
                        } else
                            messageHandler.sendEmptyMessage(ApplicationInterface.MSG_SURFACE_READY);
                    } else {
                        // Sony camera
                    }
                }
            }
        }.start();
    }
}