Builder
class Builder
kotlin.Any | |
↳ | androidx.camera.core.FocusMeteringAction.Builder |
The builder used to create the FocusMeteringAction
. App must use Builder#from(MeteringPoint)
or Builder#from(MeteringPoint, int)
to create the Builder
.
Summary
Public methods |
|
---|---|
open FocusMeteringAction.Builder |
addPoint(@NonNull point: MeteringPoint) Adds another |
open FocusMeteringAction.Builder |
addPoint(@NonNull point: MeteringPoint, mode: Int) Adds another |
open FocusMeteringAction |
build() Builds the |
open FocusMeteringAction.Builder |
Disables the auto-cancel. |
open static FocusMeteringAction.Builder |
from(@NonNull meteringPoint: MeteringPoint) Creates the Builder from a |
open static FocusMeteringAction.Builder |
from(@NonNull meteringPoint: MeteringPoint, mode: Int) Creates the Builder from a |
open FocusMeteringAction.Builder |
setAutoCancelDuration(duration: Long, @NonNull timeUnit: TimeUnit) Sets the auto-cancel duration. |
Public methods
addPoint
@NonNull open fun addPoint(@NonNull point: MeteringPoint): FocusMeteringAction.Builder
Adds another MeteringPoint
with default mode MeteringMode#AF
| MeteringMode#AE
| MeteringMode#AWB
.
If more points are added than what current device supports for AF/AE/AWB, only the first region and then in order up to the number of regions supported by the device will be enabled. If it turns out no added points can be supported on the device, the returned ListenableFuture
in CameraControl#startFocusAndMetering(FocusMeteringAction)
will fail immediately.
addPoint
@NonNull open fun addPoint(@NonNull point: MeteringPoint, mode: Int): FocusMeteringAction.Builder
Adds another MeteringPoint
with specified MeteringMode
.
If more points are added than what current device supports for AF/AE/AWB, only the first region and then in order up to the number of regions supported by the device will be enabled. If it turns out no added points can be supported on the device, the returned ListenableFuture
in CameraControl#startFocusAndMetering(FocusMeteringAction)
will fail immediately.
Parameters | |
---|---|
mode |
MeteringPoint: Must be a valid MeteringMode , otherwise an IllegalArgumentException is thrown. |
disableAutoCancel
@NonNull open fun disableAutoCancel(): FocusMeteringAction.Builder
Disables the auto-cancel.
from
@NonNull open static fun from(@NonNull meteringPoint: MeteringPoint): FocusMeteringAction.Builder
Creates the Builder from a MeteringPoint
with default mode MeteringMode#AF
| MeteringMode#AE
| MeteringMode#AWB
.
from
@NonNull open static fun from(@NonNull meteringPoint: MeteringPoint, mode: Int): FocusMeteringAction.Builder
Creates the Builder from a MeteringPoint
and MeteringMode
setAutoCancelDuration
@NonNull open fun setAutoCancelDuration(duration: Long, @NonNull timeUnit: TimeUnit): FocusMeteringAction.Builder
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. The duration must be greater than or equal to 1 otherwise it will throw a IllegalArgumentException
.