PickerColumn

open class PickerColumn
kotlin.Any
   ↳ androidx.leanback.widget.picker.PickerColumn

Picker column class used by Picker, defines a contiguous value ranges and associated labels. A PickerColumn has a minValue and maxValue to choose between. The Picker column has a current value. The labels can be dynamically generated from value by #setLabelFormat(String) or a list of static labels set by #setStaticLabels(CharSequence[]).

Summary

Public constructors

Public methods
open Int

Returns maximum value of the Column.

open Unit
setMinValue(minValue: Int)

Sets minimal value of the Column.

open Unit

Set static labels for each value, minValue maps to labels[0], maxValue maps to labels[labels.

open Int

Returns minimal value of the Column.

open String!

Return string format (see String#format) to display label for value.

open Int

Returns current value of the Column.

open CharSequence!
getLabelFor(value: Int)

Get a label for value.

open Unit

Sets current value of the Column.

open Unit
setMaxValue(maxValue: Int)

Sets maximum value of the Column.

open Array<CharSequence!>!

Returns static labels for each value, minValue maps to labels[0], maxValue maps to labels[labels.

open Int

Get total items count between minValue and maxValue.

open Unit
setLabelFormat(labelFormat: String!)

Set string format (see String#format) to display label for an integer value.

Public constructors

<init>

PickerColumn()

Public methods

getMaxValue

open fun getMaxValue(): Int

Returns maximum value of the Column.

Return
Int: Maximum value of the Column.

setMinValue

open fun setMinValue(minValue: Int): Unit

Sets minimal value of the Column.

Parameters
minValue Int: New minimal value to set.

setStaticLabels

open fun setStaticLabels(labels: Array<CharSequence!>!): Unit

Set static labels for each value, minValue maps to labels[0], maxValue maps to labels[labels.length - 1].

Parameters
labels Array<CharSequence!>!: Static labels for each value between minValue and maxValue.

getMinValue

open fun getMinValue(): Int

Returns minimal value of the Column.

Return
Int: Minimal value of the Column.

getLabelFormat

open fun getLabelFormat(): String!

Return string format (see String#format) to display label for value.

Return
String!: String format to display label for value.

getCurrentValue

open fun getCurrentValue(): Int

Returns current value of the Column.

Return
Int: Current value of the Column.

getLabelFor

open fun getLabelFor(value: Int): CharSequence!

Get a label for value. The label can be static #setStaticLabels(CharSequence[]) or dynamically generated #setLabelFormat(String) when static labels is null.

Parameters
value Int: Value between minValue and maxValue.
Return
CharSequence!: Label for the value.

setCurrentValue

open fun setCurrentValue(value: Int): Unit

Sets current value of the Column.

setMaxValue

open fun setMaxValue(maxValue: Int): Unit

Sets maximum value of the Column.

Parameters
maxValue Int: New maximum value to set.

getStaticLabels

open fun getStaticLabels(): Array<CharSequence!>!

Returns static labels for each value, minValue maps to labels[0], maxValue maps to labels[labels.length - 1]. When null, #getLabelFormat() will be used.

getCount

open fun getCount(): Int

Get total items count between minValue and maxValue.

Return
Int: Total items count between minValue and maxValue.

setLabelFormat

open fun setLabelFormat(labelFormat: String!): Unit

Set string format (see String#format) to display label for an integer value. #setStaticLabels(CharSequence[]) overrides the format.

Parameters
labelFormat String!: String format to display label for value between minValue and maxValue.