Search in sources :

Example 91 with SurfaceView

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

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 92 with SurfaceView

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

the class SinkActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mUsbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
    setContentView(R.layout.sink_activity);
    mLogTextView = (TextView) findViewById(R.id.logTextView);
    mLogTextView.setMovementMethod(ScrollingMovementMethod.getInstance());
    mLogger = new TextLogger();
    mFpsTextView = (TextView) findViewById(R.id.fpsTextView);
    mSurfaceView = (SurfaceView) findViewById(R.id.surfaceView);
    mSurfaceView.setOnTouchListener(new View.OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            sendHidTouch(event);
            return true;
        }
    });
    mLogger.log("Waiting for accessory display source to be attached to USB...");
    IntentFilter filter = new IntentFilter();
    filter.addAction(UsbManager.ACTION_USB_DEVICE_ATTACHED);
    filter.addAction(UsbManager.ACTION_USB_DEVICE_DETACHED);
    filter.addAction(ACTION_USB_DEVICE_PERMISSION);
    mReceiver = new DeviceReceiver();
    registerReceiver(mReceiver, filter);
    Intent intent = getIntent();
    if (intent.getAction().equals(UsbManager.ACTION_USB_DEVICE_ATTACHED)) {
        UsbDevice device = intent.<UsbDevice>getParcelableExtra(UsbManager.EXTRA_DEVICE);
        if (device != null) {
            onDeviceAttached(device);
        }
    } else {
        Map<String, UsbDevice> devices = mUsbManager.getDeviceList();
        if (devices != null) {
            for (UsbDevice device : devices.values()) {
                onDeviceAttached(device);
            }
        }
    }
}
Also used : IntentFilter(android.content.IntentFilter) UsbDevice(android.hardware.usb.UsbDevice) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) SurfaceView(android.view.SurfaceView) View(android.view.View) TextView(android.widget.TextView) MotionEvent(android.view.MotionEvent)

Aggregations

SurfaceView (android.view.SurfaceView)92 SurfaceHolder (android.view.SurfaceHolder)45 View (android.view.View)24 SurfaceTexture (android.graphics.SurfaceTexture)15 Surface (android.view.Surface)13 Button (android.widget.Button)12 FrameLayout (android.widget.FrameLayout)12 Intent (android.content.Intent)11 Bitmap (android.graphics.Bitmap)8 TextView (android.widget.TextView)8 FileOutputStream (java.io.FileOutputStream)8 ViewGroup (android.view.ViewGroup)6 MotionEvent (android.view.MotionEvent)5 OnClickListener (android.view.View.OnClickListener)5 ImageView (android.widget.ImageView)5 CameraManager (com.google.zxing.client.android.camera.CameraManager)5 Activity (android.app.Activity)4 PendingIntent (android.app.PendingIntent)4 IntentFilter (android.content.IntentFilter)4 UsbDevice (android.hardware.usb.UsbDevice)4