public void addSurfaceTextureListener( SurfaceTextureListener listener ) { mListeners.add( listener ); if ( mSurfaceAvailable ) { listener.onSurfaceTextureAvailable( mSurfaceTexture, mWidth, mHeight ); } }
@Override public void onSurfaceTextureAvailable( SurfaceTexture surface, int width, int height ) { mSurfaceTexture = surface; mWidth = width; mHeight = height; mSurfaceAvailable = true; for ( SurfaceTextureListener listener : mListeners ) { listener.onSurfaceTextureAvailable( surface, width, height ); } }
@Override public boolean onSurfaceTextureDestroyed( SurfaceTexture surface ) { for ( SurfaceTextureListener listener : mListeners ) { listener.onSurfaceTextureDestroyed( surface ); } return true; }
@Override public void onSurfaceTextureSizeChanged( SurfaceTexture surface, int width, int height ) { mWidth = width; mHeight = height; for ( SurfaceTextureListener listener : mListeners ) { listener.onSurfaceTextureSizeChanged( surface, width, height ); } }
@Override public void onSurfaceTextureUpdated( SurfaceTexture surface ) { for ( SurfaceTextureListener listener : mListeners ) { listener.onSurfaceTextureUpdated( surface ); } }