FocusMeteringAction.Builder

public static class FocusMeteringAction.Builder
extends Object

java.lang.Object
   ↳ androidx.camera.core.FocusMeteringAction.Builder


The builder used to create the FocusMeteringAction. App must use from(MeteringPoint) or from(MeteringPoint, MeteringMode) to create the FocusMeteringAction.Builder.

Summary

Public methods

FocusMeteringAction.Builder addPoint(MeteringPoint point, FocusMeteringAction.MeteringMode mode)

Adds another MeteringPoint with specified FocusMeteringAction.MeteringMode.

FocusMeteringAction.Builder addPoint(MeteringPoint point)

Adds another MeteringPoint with default FocusMeteringAction.MeteringMode.

FocusMeteringAction build()

Builds the FocusMeteringAction instance.

FocusMeteringAction.Builder disableAutoCancel()

Disables the auto-cancel.

static FocusMeteringAction.Builder from(MeteringPoint meteringPoint)

Creates the Builder from a MeteringPoint with default FocusMeteringAction.MeteringMode.

static FocusMeteringAction.Builder from(MeteringPoint meteringPoint, FocusMeteringAction.MeteringMode mode)

Creates the Builder from a MeteringPoint and FocusMeteringAction.MeteringMode

FocusMeteringAction.Builder setAutoCancelDuration(long duration, TimeUnit timeUnit)

Sets the auto-cancel duration.

FocusMeteringAction.Builder setAutoFocusCallback(Executor executor, FocusMeteringAction.OnAutoFocusListener listener)

Sets the FocusMeteringAction.OnAutoFocusListener to be notified when auto-focus completes.

FocusMeteringAction.Builder setAutoFocusCallback(FocusMeteringAction.OnAutoFocusListener listener)

Sets the FocusMeteringAction.OnAutoFocusListener to be notified when auto-focus completes.

Inherited methods

Public methods

addPoint

public FocusMeteringAction.Builder addPoint (MeteringPoint point, 
                FocusMeteringAction.MeteringMode mode)

Adds another MeteringPoint with specified FocusMeteringAction.MeteringMode.

Parameters
point MeteringPoint

mode FocusMeteringAction.MeteringMode

Returns
FocusMeteringAction.Builder

addPoint

public FocusMeteringAction.Builder addPoint (MeteringPoint point)

Adds another MeteringPoint with default FocusMeteringAction.MeteringMode.

Parameters
point MeteringPoint

Returns
FocusMeteringAction.Builder

build

public FocusMeteringAction build ()

Builds the FocusMeteringAction instance.

Returns
FocusMeteringAction

disableAutoCancel

public FocusMeteringAction.Builder disableAutoCancel ()

Disables the auto-cancel.

Returns
FocusMeteringAction.Builder

from

public static FocusMeteringAction.Builder from (MeteringPoint meteringPoint)

Creates the Builder from a MeteringPoint with default FocusMeteringAction.MeteringMode.

Parameters
meteringPoint MeteringPoint

Returns
FocusMeteringAction.Builder

from

public static FocusMeteringAction.Builder from (MeteringPoint meteringPoint, 
                FocusMeteringAction.MeteringMode mode)

Creates the Builder from a MeteringPoint and FocusMeteringAction.MeteringMode

Parameters
meteringPoint MeteringPoint

mode FocusMeteringAction.MeteringMode

Returns
FocusMeteringAction.Builder

setAutoCancelDuration

public FocusMeteringAction.Builder setAutoCancelDuration (long duration, 
                TimeUnit timeUnit)

Sets the auto-cancel duration. After set, CameraControl.cancelFocusAndMetering() will be called in specified duration. By default, auto-cancel is enabled with 5 seconds duration.

Parameters
duration long

timeUnit TimeUnit

Returns
FocusMeteringAction.Builder

setAutoFocusCallback

public FocusMeteringAction.Builder setAutoFocusCallback (Executor executor, 
                FocusMeteringAction.OnAutoFocusListener listener)

Sets the FocusMeteringAction.OnAutoFocusListener to be notified when auto-focus completes. The listener is called on specified Executor.

Parameters
executor Executor

listener FocusMeteringAction.OnAutoFocusListener

Returns
FocusMeteringAction.Builder

setAutoFocusCallback

public FocusMeteringAction.Builder setAutoFocusCallback (FocusMeteringAction.OnAutoFocusListener listener)

Sets the FocusMeteringAction.OnAutoFocusListener to be notified when auto-focus completes. The listener is called on main thread.

Parameters
listener FocusMeteringAction.OnAutoFocusListener

Returns
FocusMeteringAction.Builder