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 optionalText
.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 |
int
|
getViewType()
Used by |
void
|
setEnabled(boolean enabled)
Sets the enabled state of the bound |
void
|
setMax(int max)
Sets max value of seekbar. |
void
|
setOnSeekBarChangeListener(SeekBar.OnSeekBarChangeListener listener)
|
void
|
setPrimaryActionEmptyIcon()
Sets |
void
|
setPrimaryActionIcon(Drawable drawable)
This method is deprecated.
Use |
void
|
setPrimaryActionIcon(Icon icon)
Sets |
void
|
setPrimaryActionIcon(int iconResId)
This method is deprecated.
Use |
void
|
setPrimaryActionIconListener(View.OnClickListener onClickListener)
Sets an |
void
|
setProgress(int progress)
Sets progress of seekbar. |
void
|
setSecondaryProgress(int secondaryProgress)
Sets secondary progress of seekbar. |
void
|
setSupplementalEmptyIcon(boolean seekbarOffsetDividerWidth)
Sets |
void
|
setSupplementalIcon(Icon icon, boolean showSupplementalIconDivider)
Sets |
void
|
setSupplementalIcon(int iconResId, boolean showSupplementalIconDivider)
This method is deprecated.
Use |
void
|
setSupplementalIcon(Drawable drawable, boolean showSupplementalIconDivider)
This method is deprecated.
Use |
void
|
setSupplementalIconListener(View.OnClickListener listener)
Sets |
void
|
setText(CharSequence text)
Sets text that sits on top of seekbar. |
Protected methods | |
---|---|
Context
|
getContext()
|
void
|
onBind(SeekbarListItem.ViewHolder viewHolder)
Hides all views in |
void
|
resolveDirtyState()
Calculates the layout params for views in |
Inherited methods | |
---|---|
Public constructors
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)
This method is deprecated.
Use setPrimaryActionIcon(Icon)
.
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 (Icon icon)
Sets Primary Action
to be represented by an icon.
Parameters | |
---|---|
icon |
Icon : An icon to set as primary action.
|
setPrimaryActionIcon
public void setPrimaryActionIcon (int iconResId)
This method is deprecated.
Use setPrimaryActionIcon(Icon)
.
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 (Icon icon, boolean showSupplementalIconDivider)
Sets Supplemental Action
to be represented by an Supplemental Icon
.
Parameters | |
---|---|
icon |
Icon |
showSupplementalIconDivider |
boolean |
setSupplementalIcon
public void setSupplementalIcon (int iconResId, boolean showSupplementalIconDivider)
This method is deprecated.
Use setSupplementalIcon(Icon, boolean)
.
Sets Supplemental Action
to be represented by an Supplemental Icon
.
Parameters | |
---|---|
iconResId |
int |
showSupplementalIconDivider |
boolean |
setSupplementalIcon
public void setSupplementalIcon (Drawable drawable, boolean showSupplementalIconDivider)
This method is deprecated.
Use setSupplementalIcon(Icon, boolean)
.
Sets Supplemental Action
to be represented by an Supplemental Icon
.
Parameters | |
---|---|
drawable |
Drawable |
showSupplementalIconDivider |
boolean |
setSupplementalIconListener
public void setSupplementalIconListener (View.OnClickListener listener)
Sets OnClickListener
for a Supplemental Icon
.
Parameters | |
---|---|
listener |
View.OnClickListener |
setText
public void setText (CharSequence text)
Sets text that sits on top of seekbar.
Parameters | |
---|---|
text |
CharSequence : text to be displayed, or null to clear the content.
|
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
.
Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.