ViewfinderSurfaceRequest.Builder


class ViewfinderSurfaceRequest.Builder


Builder for ViewfinderSurfaceRequest.

Summary

Public constructors

Constructor for Builder.

Builder(resolution: Size)

Constructor for Builder.

Constructor for Builder.

Extension functions

ViewfinderSurfaceRequest.Builder

This function is deprecated. Use androidx.camera.viewfinder.surface.ViewfinderSurfaceRequest as argument

Public constructors

Builder

Added in 1.4.0-alpha10
Deprecated in 1.4.0-alpha10
Builder(builder: ViewfinderSurfaceRequest.Builder)

Constructor for Builder.

Creates a builder with other builder instance. The returned builder will be pre-populated with the state of the provided builder.

Parameters
builder: ViewfinderSurfaceRequest.Builder

Builder instance.

Builder

Added in 1.4.0-alpha10
Deprecated in 1.4.0-alpha10
Builder(resolution: Size)

Constructor for Builder.

Creates a builder with viewfinder resolution.

Parameters
resolution: Size

viewfinder resolution.

Builder

Added in 1.4.0-alpha10
Deprecated in 1.4.0-alpha10
Builder(surfaceRequest: ViewfinderSurfaceRequest)

Constructor for Builder.

Creates a builder with other ViewfinderSurfaceRequest instance. The returned builder will be pre-populated with the state of the provided ViewfinderSurfaceRequest instance.

Parameters
surfaceRequest: ViewfinderSurfaceRequest

ViewfinderSurfaceRequest instance.

Public functions

setImplementationMode

Added in 1.4.0-alpha10
Deprecated in 1.4.0-alpha10
fun setImplementationMode(
    implementationMode: CameraViewfinder.ImplementationMode?
): ViewfinderSurfaceRequest.Builder

Sets the androidx.camera.viewfinder.CameraViewfinder.ImplementationMode.

Possible values:

If not set or setting to null, the androidx.camera.viewfinder.CameraViewfinder.ImplementationMode set via app :implementationMode in layout xml will be used for CameraViewfinder. If not set in the layout xml, the default value PERFORMANCE will be used in CameraViewfinder.

Parameters
implementationMode: CameraViewfinder.ImplementationMode?

The .

Returns
ViewfinderSurfaceRequest.Builder

This builder.

setLensFacing

Added in 1.4.0-alpha10
Deprecated in 1.4.0-alpha10
fun setLensFacing(lensFacing: Int): ViewfinderSurfaceRequest.Builder

Sets the lens facing.

Possible values:

The value can be retrieved from CameraCharacteristics by key LENS_FACING. If not set, LENS_FACING_BACK will be used by default.

Parameters
lensFacing: Int

The lens facing.

Returns
ViewfinderSurfaceRequest.Builder

This builder.

setSensorOrientation

Added in 1.4.0-alpha10
Deprecated in 1.4.0-alpha10
fun setSensorOrientation(sensorOrientation: Int): ViewfinderSurfaceRequest.Builder

Sets the sensor orientation.

Range of valid values: 0, 90, 180, 270

The value can be retrieved from CameraCharacteristics by key SENSOR_ORIENTATION. If it is not set, 0 will be used by default.

Parameters
sensorOrientation: Int

The camera sensor orientation.

Returns
ViewfinderSurfaceRequest.Builder

this builder.

Extension functions

populateFromCharacteristics

fun ViewfinderSurfaceRequest.Builder.populateFromCharacteristics(
    cameraCharacteristics: CameraCharacteristics
): ViewfinderSurfaceRequest.Builder

Populates ViewfinderSurfaceRequest.Builder from CameraCharacteristics.

The CameraCharacteristics will be used to populate information including lens facing, sensor orientation and ImplementationMode. If the hardware level is legacy, the ImplementationMode will be set to ImplementationMode.COMPATIBLE.