Search in sources :

Example 1 with SurfaceView

use of android.view.SurfaceView in project android_frameworks_base by ParanoidAndroid.

the class EGLImpl method eglCreateWindowSurface.

public EGLSurface eglCreateWindowSurface(EGLDisplay display, EGLConfig config, Object native_window, int[] attrib_list) {
    Surface sur = null;
    if (native_window instanceof SurfaceView) {
        SurfaceView surfaceView = (SurfaceView) native_window;
        sur = surfaceView.getHolder().getSurface();
    } else if (native_window instanceof SurfaceHolder) {
        SurfaceHolder holder = (SurfaceHolder) native_window;
        sur = holder.getSurface();
    } else if (native_window instanceof Surface) {
        sur = (Surface) native_window;
    }
    int eglSurfaceId;
    if (sur != null) {
        eglSurfaceId = _eglCreateWindowSurface(display, config, sur, attrib_list);
    } else if (native_window instanceof SurfaceTexture) {
        eglSurfaceId = _eglCreateWindowSurfaceTexture(display, config, native_window, attrib_list);
    } else {
        throw new java.lang.UnsupportedOperationException("eglCreateWindowSurface() can only be called with an instance of " + "Surface, SurfaceView, SurfaceHolder or SurfaceTexture at the moment.");
    }
    if (eglSurfaceId == 0) {
        return EGL10.EGL_NO_SURFACE;
    }
    return new EGLSurfaceImpl(eglSurfaceId);
}
Also used : SurfaceHolder(android.view.SurfaceHolder) SurfaceTexture(android.graphics.SurfaceTexture) SurfaceView(android.view.SurfaceView) Surface(android.view.Surface)

Example 2 with SurfaceView

use of android.view.SurfaceView in project android_frameworks_base by ParanoidAndroid.

the class EGL14 method eglCreateWindowSurface.

public static EGLSurface eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, Object win, int[] attrib_list, int offset) {
    Surface sur = null;
    if (win instanceof SurfaceView) {
        SurfaceView surfaceView = (SurfaceView) win;
        sur = surfaceView.getHolder().getSurface();
    } else if (win instanceof SurfaceHolder) {
        SurfaceHolder holder = (SurfaceHolder) win;
        sur = holder.getSurface();
    } else if (win instanceof Surface) {
        sur = (Surface) win;
    }
    EGLSurface surface;
    if (sur != null) {
        surface = _eglCreateWindowSurface(dpy, config, sur, attrib_list, offset);
    } else if (win instanceof SurfaceTexture) {
        surface = _eglCreateWindowSurfaceTexture(dpy, config, win, attrib_list, offset);
    } else {
        throw new java.lang.UnsupportedOperationException("eglCreateWindowSurface() can only be called with an instance of " + "Surface, SurfaceView, SurfaceTexture or SurfaceHolder at the moment, " + "this will be fixed later.");
    }
    return surface;
}
Also used : SurfaceHolder(android.view.SurfaceHolder) SurfaceTexture(android.graphics.SurfaceTexture) SurfaceView(android.view.SurfaceView) Surface(android.view.Surface)

Example 3 with SurfaceView

use of android.view.SurfaceView in project android_frameworks_base by ResurrectionRemix.

the class EGLImpl method eglCreateWindowSurface.

public EGLSurface eglCreateWindowSurface(EGLDisplay display, EGLConfig config, Object native_window, int[] attrib_list) {
    Surface sur = null;
    if (native_window instanceof SurfaceView) {
        SurfaceView surfaceView = (SurfaceView) native_window;
        sur = surfaceView.getHolder().getSurface();
    } else if (native_window instanceof SurfaceHolder) {
        SurfaceHolder holder = (SurfaceHolder) native_window;
        sur = holder.getSurface();
    } else if (native_window instanceof Surface) {
        sur = (Surface) native_window;
    }
    long eglSurfaceId;
    if (sur != null) {
        eglSurfaceId = _eglCreateWindowSurface(display, config, sur, attrib_list);
    } else if (native_window instanceof SurfaceTexture) {
        eglSurfaceId = _eglCreateWindowSurfaceTexture(display, config, native_window, attrib_list);
    } else {
        throw new java.lang.UnsupportedOperationException("eglCreateWindowSurface() can only be called with an instance of " + "Surface, SurfaceView, SurfaceHolder or SurfaceTexture at the moment.");
    }
    if (eglSurfaceId == 0) {
        return EGL10.EGL_NO_SURFACE;
    }
    return new EGLSurfaceImpl(eglSurfaceId);
}
Also used : SurfaceHolder(android.view.SurfaceHolder) SurfaceTexture(android.graphics.SurfaceTexture) SurfaceView(android.view.SurfaceView) Surface(android.view.Surface)

Example 4 with SurfaceView

use of android.view.SurfaceView in project android_frameworks_base by ResurrectionRemix.

the class TvView method resetSurfaceView.

private void resetSurfaceView() {
    if (mSurfaceView != null) {
        mSurfaceView.getHolder().removeCallback(mSurfaceHolderCallback);
        removeView(mSurfaceView);
    }
    mSurface = null;
    mSurfaceView = new SurfaceView(getContext(), mAttrs, mDefStyleAttr) {

        @Override
        protected void updateWindow(boolean force, boolean redrawNeeded) {
            super.updateWindow(force, redrawNeeded);
            relayoutSessionOverlayView();
        }
    };
    // The surface view's content should be treated as secure all the time.
    mSurfaceView.setSecure(true);
    mSurfaceView.getHolder().addCallback(mSurfaceHolderCallback);
    if (mWindowZOrder == ZORDER_MEDIA_OVERLAY) {
        mSurfaceView.setZOrderMediaOverlay(true);
    } else if (mWindowZOrder == ZORDER_ON_TOP) {
        mSurfaceView.setZOrderOnTop(true);
    }
    addView(mSurfaceView);
}
Also used : SurfaceView(android.view.SurfaceView)

Example 5 with SurfaceView

use of android.view.SurfaceView in project android_frameworks_base by ResurrectionRemix.

the class DisplaySinkService method setSurfaceView.

public void setSurfaceView(final SurfaceView surfaceView) {
    if (mSurfaceView != surfaceView) {
        final SurfaceView oldSurfaceView = mSurfaceView;
        mSurfaceView = surfaceView;
        if (oldSurfaceView != null) {
            oldSurfaceView.post(new Runnable() {

                @Override
                public void run() {
                    final SurfaceHolder holder = oldSurfaceView.getHolder();
                    holder.removeCallback(DisplaySinkService.this);
                    updateSurfaceFromUi(null);
                }
            });
        }
        if (surfaceView != null) {
            surfaceView.post(new Runnable() {

                @Override
                public void run() {
                    final SurfaceHolder holder = surfaceView.getHolder();
                    holder.addCallback(DisplaySinkService.this);
                    updateSurfaceFromUi(holder);
                }
            });
        }
    }
}
Also used : SurfaceHolder(android.view.SurfaceHolder) SurfaceView(android.view.SurfaceView)

Aggregations

SurfaceView (android.view.SurfaceView)137 SurfaceHolder (android.view.SurfaceHolder)65 View (android.view.View)35 SurfaceTexture (android.graphics.SurfaceTexture)18 Intent (android.content.Intent)16 FrameLayout (android.widget.FrameLayout)15 Surface (android.view.Surface)14 Button (android.widget.Button)13 TextView (android.widget.TextView)11 SharedPreferences (android.content.SharedPreferences)10 Bitmap (android.graphics.Bitmap)9 ImageView (android.widget.ImageView)9 IOException (java.io.IOException)9 ViewGroup (android.view.ViewGroup)8 LinearLayout (android.widget.LinearLayout)8 FileOutputStream (java.io.FileOutputStream)8 AudioManager (android.media.AudioManager)7 OnClickListener (android.view.View.OnClickListener)7 CameraManager (com.google.zxing.client.android.camera.CameraManager)7 IntentFilter (android.content.IntentFilter)6