belongs to Maven artifact androidx.car:car:1.0.0-alpha1

SeekbarListItem

public class SeekbarListItem
extends ListItem<SeekbarListItem.ViewHolder>

java.lang.Object
   ↳ androidx.car.widget.ListItem<androidx.car.widget.SeekbarListItem.ViewHolder>
     ↳ androidx.car.widget.SeekbarListItem


Class to build a list item with SeekBar.

An item supports primary action and supplemental action(s).

An item visually composes of 3 parts; each part may contain multiple views.

  • Primary Action: represented by an icon of following types.
    • Primary Icon - icon size could be large or small.
    • No Icon - no icon is shown.
    • Empty Icon - Seekbar offsets start space as if there was an icon.
  • Seekbar: with optional Text.
  • Supplemental Action: presented by an icon of following types; aligned to the end of item.
    • Supplemental Icon.
    • Supplemental Empty Icon - Seekbar offsets end space as if there was an icon.
SeekbarListItem binds data to SeekbarListItem.ViewHolder based on components selected.

When conflicting methods are called (e.g. setting primary action to both primary icon and no icon), the last called method wins. minimum value is set to 0.

Summary

Nested classes

class SeekbarListItem.ViewHolder

Holds views of SeekbarListItem. 

Public constructors

SeekbarListItem(Context context, int max, int progress, SeekBar.OnSeekBarChangeListener listener, String text)

This constructor is deprecated. use SeekbarListItem(Context) and individual field setters instead.

SeekbarListItem(Context context)

Public methods

static SeekbarListItem.ViewHolder createViewHolder(View itemView)

Creates a SeekbarListItem.ViewHolder.

int getViewType()

Used by ListItemAdapter to choose layout to inflate for view holder.

void setMax(int max)

Sets max value of seekbar.

void setOnSeekBarChangeListener(SeekBar.OnSeekBarChangeListener listener)

Sets SeekBar.OnSeekBarChangeListener.

void setPrimaryActionEmptyIcon()

Sets Primary Action to be empty icon.

void setPrimaryActionIcon(Drawable drawable)

Sets Primary Action to be represented by an icon.

void setPrimaryActionIcon(int iconResId)

Sets Primary Action to be represented by an icon.

void setProgress(int progress)

Sets progress of seekbar.

void setSecondaryProgress(int secondaryProgress)

Sets secondary progress of seekbar.

void setSupplementalEmptyIcon(boolean seekbarOffsetDividerWidth)

Sets Supplemental Action to be empty icon.

void setSupplementalIcon(int iconResId, boolean showSupplementalIconDivider)

Sets Supplemental Action to be represented by an Supplemental Icon.

void setSupplementalIcon(Drawable drawable, boolean showSupplementalIconDivider)

Sets Supplemental Action to be represented by an Supplemental Icon.

void setSupplementalIcon(Drawable drawable, boolean showSupplementalIconDivider, View.OnClickListener listener)

Sets Supplemental Action to be represented by an Supplemental Icon.

void setSupplementalIcon(int iconResId, boolean showSupplementalIconDivider, View.OnClickListener listener)

Sets Supplemental Action to be represented by an Supplemental Icon.

void setText(String text)

Sets text that sits on top of seekbar.

Protected methods

void onBind(SeekbarListItem.ViewHolder viewHolder)

Hides all views in SeekbarListItem.ViewHolder then applies ViewBinders to adjust view layout params.

void resolveDirtyState()

Calculates the layout params for views in SeekbarListItem.ViewHolder.

Inherited methods

Public constructors

SeekbarListItem

SeekbarListItem (Context context, 
                int max, 
                int progress, 
                SeekBar.OnSeekBarChangeListener listener, 
                String text)

This constructor is deprecated.
use SeekbarListItem(Context) and individual field setters instead.

Creates a SeekbarListItem.

Parameters
context Context: context

max int: the upper range of the SeekBar.

progress int: the current progress of the specified value.

listener SeekBar.OnSeekBarChangeListener: listener to receive notification of changes to progress level.

text String: displays a text on top of the SeekBar.

SeekbarListItem

SeekbarListItem (Context context)

Parameters
context Context

Public methods

createViewHolder

SeekbarListItem.ViewHolder createViewHolder (View itemView)

Creates a SeekbarListItem.ViewHolder.

Parameters
itemView View

Returns
SeekbarListItem.ViewHolder

getViewType

int getViewType ()

Used by ListItemAdapter to choose layout to inflate for view holder.

Returns
int type of this ListItem.

setMax

void setMax (int max)

Sets max value of seekbar.

Parameters
max int

setOnSeekBarChangeListener

void setOnSeekBarChangeListener (SeekBar.OnSeekBarChangeListener listener)

Sets SeekBar.OnSeekBarChangeListener.

Parameters
listener SeekBar.OnSeekBarChangeListener

setPrimaryActionEmptyIcon

void setPrimaryActionEmptyIcon ()

Sets Primary Action to be empty icon. Seekbar would have a start margin as if Primary Action were set as icon.

setPrimaryActionIcon

void setPrimaryActionIcon (Drawable drawable)

Sets Primary Action to be represented by an icon.

Parameters
drawable Drawable: the Drawable to set, or null to clear the content.

setPrimaryActionIcon

void setPrimaryActionIcon (int iconResId)

Sets Primary Action to be represented by an icon.

Parameters
iconResId int: the resource identifier of the drawable.

setProgress

void setProgress (int progress)

Sets progress of seekbar.

Parameters
progress int

setSecondaryProgress

void setSecondaryProgress (int secondaryProgress)

Sets secondary progress of seekbar.

Parameters
secondaryProgress int

setSupplementalEmptyIcon

void setSupplementalEmptyIcon (boolean seekbarOffsetDividerWidth)

Sets Supplemental Action to be empty icon. Seekbar would have an end margin as if Supplemental Action were set.

Parameters
seekbarOffsetDividerWidth boolean

setSupplementalIcon

void setSupplementalIcon (int iconResId, 
                boolean showSupplementalIconDivider)

Sets Supplemental Action to be represented by an Supplemental Icon.

Parameters
iconResId int

showSupplementalIconDivider boolean

setSupplementalIcon

void setSupplementalIcon (Drawable drawable, 
                boolean showSupplementalIconDivider)

Sets Supplemental Action to be represented by an Supplemental Icon.

Parameters
drawable Drawable

showSupplementalIconDivider boolean

setSupplementalIcon

void setSupplementalIcon (Drawable drawable, 
                boolean showSupplementalIconDivider, 
                View.OnClickListener listener)

Sets Supplemental Action to be represented by an Supplemental Icon.

Parameters
drawable Drawable

showSupplementalIconDivider boolean

listener View.OnClickListener

setSupplementalIcon

void setSupplementalIcon (int iconResId, 
                boolean showSupplementalIconDivider, 
                View.OnClickListener listener)

Sets Supplemental Action to be represented by an Supplemental Icon.

Parameters
iconResId int

showSupplementalIconDivider boolean

listener View.OnClickListener

setText

void setText (String text)

Sets text that sits on top of seekbar.

Parameters
text String

Protected methods

onBind

void onBind (SeekbarListItem.ViewHolder viewHolder)

Hides all views in SeekbarListItem.ViewHolder then applies ViewBinders to adjust view layout params.

Parameters
viewHolder SeekbarListItem.ViewHolder

resolveDirtyState

void resolveDirtyState ()

Calculates the layout params for views in SeekbarListItem.ViewHolder.