ViewfinderSurfaceRequest.Builder


public final class ViewfinderSurfaceRequest.Builder


Builder for ViewfinderSurfaceRequest.

Summary

Public constructors

Constructor for Builder.

Builder(@NonNull Size resolution)

Constructor for Builder.

Constructor for Builder.

Public methods

final @NonNull ViewfinderSurfaceRequest

Builds the ViewfinderSurfaceRequest.

final @NonNull ViewfinderSurfaceRequest.Builder

Sets the ImplementationMode.

final @NonNull ViewfinderSurfaceRequest.Builder
setOutputMirrorMode(int outputMirrorMode)

Sets the output mirror mode.

final @NonNull ViewfinderSurfaceRequest.Builder
setSourceOrientation(int sourceOrientation)

Sets the sensor orientation.

Public constructors

Builder

Added in 1.4.0-alpha10
public Builder(@NonNull ViewfinderSurfaceRequest.Builder 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
@NonNull ViewfinderSurfaceRequest.Builder builder

Builder instance.

Builder

Added in 1.4.0-alpha10
public Builder(@NonNull Size resolution)

Constructor for Builder.

Creates a builder with viewfinder resolution.

Parameters
@NonNull Size resolution

viewfinder resolution.

Builder

Added in 1.4.0-alpha10
public Builder(@NonNull ViewfinderSurfaceRequest surfaceRequest)

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
@NonNull ViewfinderSurfaceRequest surfaceRequest

ViewfinderSurfaceRequest instance.

Public methods

setImplementationMode

Added in 1.4.0-alpha10
public final @NonNull ViewfinderSurfaceRequest.Builder setImplementationMode(ImplementationMode implementationMode)

Sets the ImplementationMode.

Possible values:

Parameters
ImplementationMode implementationMode

The ImplementationMode.

Returns
@NonNull ViewfinderSurfaceRequest.Builder

This builder.

setOutputMirrorMode

Added in 1.4.0-alpha10
public final @NonNull ViewfinderSurfaceRequest.Builder setOutputMirrorMode(int outputMirrorMode)

Sets the output mirror mode.

Possible values:

If not set, MIRROR_MODE_NONE will be used by default.

Parameters
int outputMirrorMode

The viewfinder output mirror mode.

Returns
@NonNull ViewfinderSurfaceRequest.Builder

This builder.

setSourceOrientation

Added in 1.4.0-alpha10
public final @NonNull ViewfinderSurfaceRequest.Builder setSourceOrientation(int sourceOrientation)

Sets the sensor orientation.

Range of valid values:

0, 90, 180, 270

If it is not set, 0 will be used by default.

Parameters
int sourceOrientation

The viewfinder source orientation.

Returns
@NonNull ViewfinderSurfaceRequest.Builder

This builder.

Extension functions

ViewfinderSurfaceRequestUtil.populateFromCharacteristics

public final @NonNull ViewfinderSurfaceRequest.Builder ViewfinderSurfaceRequestUtil.populateFromCharacteristics(
    @NonNull ViewfinderSurfaceRequest.Builder receiver,
    @NonNull CameraCharacteristics cameraCharacteristics
)

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.EMBEDDED.