lightbulb_outline Please take our October 2018 developer survey. Start survey

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

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)

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 setEnabled(boolean enabled)

Sets the enabled state of the bound ListItem.ViewHolder.

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 setPrimaryActionIconListener(View.OnClickListener onClickListener)

Sets an OnClickListener for the icon representing the Primary Action.

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)

This method is deprecated. use either setSupplementalIcon(Drawable, boolean) or setSupplementalIcon(int, boolean) and setSupplementalIconListener(android.view.View.OnClickListener).

void setSupplementalIconListener(View.OnClickListener listener)

Sets OnClickListener for a 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

public SeekbarListItem (Context context)

Parameters
context Context

Public methods

createViewHolder

public static SeekbarListItem.ViewHolder createViewHolder (View itemView)

Creates a SeekbarListItem.ViewHolder.

Parameters
itemView View

Returns
SeekbarListItem.ViewHolder

getViewType

public int getViewType ()

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

Returns
int type of this ListItem.

setEnabled

public void setEnabled (boolean enabled)

Sets the enabled state of the bound ListItem.ViewHolder.

All visible children views of ViewHolder should be set to enabled. Caller is responsible for notifying ListItemAdapter about data change.

Disabled items are usually styled at 50% opacity. Consider similar styling for consistency.

Parameters
enabled boolean

setMax

public void setMax (int max)

Sets max value of seekbar.

Parameters
max int

setOnSeekBarChangeListener

public void setOnSeekBarChangeListener (SeekBar.OnSeekBarChangeListener listener)

Sets SeekBar.OnSeekBarChangeListener.

Parameters
listener SeekBar.OnSeekBarChangeListener

setPrimaryActionEmptyIcon

public void setPrimaryActionEmptyIcon ()

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

setPrimaryActionIcon

public 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

public void setPrimaryActionIcon (int iconResId)

Sets Primary Action to be represented by an icon.

Parameters
iconResId int: the resource identifier of the drawable.

setPrimaryActionIconListener

public void setPrimaryActionIconListener (View.OnClickListener onClickListener)

Sets an OnClickListener for the icon representing the Primary Action.

Parameters
onClickListener View.OnClickListener: the listener to be set for the primary action icon.

setProgress

public void setProgress (int progress)

Sets progress of seekbar.

Parameters
progress int

setSecondaryProgress

public void setSecondaryProgress (int secondaryProgress)

Sets secondary progress of seekbar.

Parameters
secondaryProgress int

setSupplementalEmptyIcon

public 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

public void setSupplementalIcon (int iconResId, 
                boolean showSupplementalIconDivider)

Sets Supplemental Action to be represented by an Supplemental Icon.

Parameters
iconResId int

showSupplementalIconDivider boolean

setSupplementalIcon

public void setSupplementalIcon (Drawable drawable, 
                boolean showSupplementalIconDivider)

Sets Supplemental Action to be represented by an Supplemental Icon.

Parameters
drawable Drawable

showSupplementalIconDivider boolean

setSupplementalIcon

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

This method is deprecated.
use either setSupplementalIcon(Drawable, boolean) or setSupplementalIcon(int, boolean) and setSupplementalIconListener(android.view.View.OnClickListener).

Sets Supplemental Action to be represented by an Supplemental Icon.

Parameters
drawable Drawable

showSupplementalIconDivider boolean

listener View.OnClickListener

setSupplementalIconListener

public void setSupplementalIconListener (View.OnClickListener listener)

Sets OnClickListener for a Supplemental Icon.

Parameters
listener View.OnClickListener

setText

public void setText (String text)

Sets text that sits on top of seekbar.

Parameters
text String

Protected methods

onBind

protected void onBind (SeekbarListItem.ViewHolder viewHolder)

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

Parameters
viewHolder SeekbarListItem.ViewHolder

resolveDirtyState

protected void resolveDirtyState ()

Calculates the layout params for views in SeekbarListItem.ViewHolder.