use of android.view.SurfaceHolder in project platform_frameworks_base by android.
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);
}
use of android.view.SurfaceHolder in project platform_frameworks_base by android.
the class SurfaceHolderTarget method onBindToView.
@Override
public void onBindToView(View view) {
if (view instanceof SurfaceView) {
SurfaceHolder holder = ((SurfaceView) view).getHolder();
if (holder == null) {
throw new RuntimeException("Could not get SurfaceHolder from SurfaceView " + view + "!");
}
setSurfaceHolder(holder);
} else {
throw new IllegalArgumentException("View must be a SurfaceView!");
}
}
use of android.view.SurfaceHolder in project libgdx by libgdx.
the class GLSurfaceViewAPI18 method init.
private void init() {
// Install a SurfaceHolder.Callback so we get notified when the
// underlying surface is created and destroyed
SurfaceHolder holder = getHolder();
holder.addCallback(this);
int sdkVersion = android.os.Build.VERSION.SDK_INT;
// setFormat is done by SurfaceView in SDK 2.3 and newer.
if (sdkVersion <= 8) {
// SDK 2.2 or older
holder.setFormat(PixelFormat.RGB_565);
}
// setType is not needed for SDK 2.0 or newer. Uncomment this
// statement if back-porting this code to older SDKs.
// holder.setType(SurfaceHolder.SURFACE_TYPE_GPU);
}
use of android.view.SurfaceHolder in project AndroidSDK-RecipeBook by gabu.
the class Recipe066 method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// フルスクリーン表示にします
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
// タイトルバーを非表示にします
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
// プレビューのためSurfaceHolderに
// SURFACE_TYPE_PUSH_BUFFERSをセット
mCameraView = (SurfaceView) findViewById(R.id.camera_view);
SurfaceHolder holder = mCameraView.getHolder();
holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}
use of android.view.SurfaceHolder in project android-zxing by PearceXu.
the class CaptureActivity method onPause.
@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();
}
Aggregations