selectDuration

fun selectDuration(duration: Duration)

Programmatically selects duration without dispatching DurationPicker user callbacks.

Parameters

duration

The finite, non-negative, whole-minute duration to select.

Throws

if duration is not finite, non-negative, whole-minute, or its whole-hour part does not fit in Int.


fun selectDuration(hours: Int, minutes: Int)

Programmatically selects elapsed hours and minute-within-hour minutes.

Parameters

hours

The non-negative elapsed whole-hour component.

minutes

The minute-within-hour component in 0..59.

Throws

if either part is outside its supported range.


Programmatically selects the closest duration to duration allowed by items.

Parameters

duration

The requested finite, non-negative, whole-minute duration.

items

The item sources and scalar bounds used for coercion.

Throws

if the requested value or item configuration is invalid or the item configuration has no selectable scalar combination.


fun selectDuration(hours: Int, minutes: Int, items: DurationPickerItems)

Programmatically selects the closest duration to hours/minutes allowed by items.

Parameters

hours

The requested non-negative elapsed whole-hour component.

minutes

The requested minute-within-hour component in 0..59.

items

The item sources and scalar bounds used for coercion.

Throws

if the requested parts or item configuration are invalid or the item configuration has no selectable scalar combination.