Java Code Examples for androidx.camera.core.Preview#SurfaceProvider

The following examples show how to use androidx.camera.core.Preview#SurfaceProvider . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TextureViewImplementation.java    From mollyim-android with GNU General Public License v3.0 6 votes vote down vote up
@NonNull
@Override
public Preview.SurfaceProvider getSurfaceProvider() {
    return (surfaceRequest) -> {
        mResolution = surfaceRequest.getResolution();
        initInternal();
        if (mSurfaceRequest != null) {
            mSurfaceRequest.willNotProvideSurface();
        }

        mSurfaceRequest = surfaceRequest;
        surfaceRequest.addRequestCancellationListener(
                ContextCompat.getMainExecutor(mTextureView.getContext()), () -> {
                    if (mSurfaceRequest != null && mSurfaceRequest == surfaceRequest) {
                        mSurfaceRequest = null;
                        mSurfaceReleaseFuture = null;
                    }
                });

        tryToProvidePreviewSurface();
    };
}
 
Example 2
Source File: SurfaceViewImplementation.java    From mollyim-android with GNU General Public License v3.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@NonNull
@Override
public Preview.SurfaceProvider getSurfaceProvider() {
    return mSurfaceProvider;
}
 
Example 3
Source File: PreviewView.java    From mollyim-android with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Gets the {@link Preview.SurfaceProvider} to be used with
 * {@link Preview#setSurfaceProvider(Executor, Preview.SurfaceProvider)}.
 */
@NonNull
public Preview.SurfaceProvider getPreviewSurfaceProvider() {
    return mImplementation.getSurfaceProvider();
}
 
Example 4
Source File: PreviewView.java    From mollyim-android with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Gets the {@link Preview.SurfaceProvider} to be used with {@link Preview}.
 */
@NonNull
Preview.SurfaceProvider getSurfaceProvider();