public class ParentViewHolder
extends RecyclerView.ViewHolder
implements android.view.View.OnClickListener
ParentListItem
Keeps track of expanded state and holds callbacks which can be used to
trigger expansion-based events.| Modifier and Type | Class and Description |
|---|---|
static interface |
ParentViewHolder.ParentListItemExpandCollapseListener
Empowers
ExpandableRecyclerAdapter
implementations to be notified of expand/collapse state change events. |
| Constructor and Description |
|---|
ParentViewHolder(android.view.View itemView)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
collapseView()
Triggers collapse of the parent.
|
protected void |
expandView()
Triggers expansion of the parent.
|
ParentViewHolder.ParentListItemExpandCollapseListener |
getParentListItemExpandCollapseListener()
Getter for the
ParentViewHolder.ParentListItemExpandCollapseListener implemented in
ExpandableRecyclerAdapter. |
boolean |
isExpanded()
Returns expanded state for the
ParentListItem
corresponding to this ParentViewHolder. |
void |
onClick(android.view.View v)
View.OnClickListener to listen for click events on
the entire parent View. |
void |
onExpansionToggled(boolean expanded)
Callback triggered when expansion state is changed, but not during
initialization.
|
void |
setExpanded(boolean expanded)
Setter method for expanded state, used for initialization of expanded state.
|
void |
setMainItemClickToExpand()
Sets a
View.OnClickListener on the entire parent
view to trigger expansion. |
void |
setParentListItemExpandCollapseListener(ParentViewHolder.ParentListItemExpandCollapseListener parentListItemExpandCollapseListener)
Setter for the
ParentViewHolder.ParentListItemExpandCollapseListener implemented in
ExpandableRecyclerAdapter. |
boolean |
shouldItemViewClickToggleExpansion()
Used to determine whether a click in the entire parent
View
should trigger row expansion. |
public ParentViewHolder(android.view.View itemView)
itemView - The View being hosted in this ViewHolderpublic void setMainItemClickToExpand()
View.OnClickListener on the entire parent
view to trigger expansion.public boolean isExpanded()
ParentListItem
corresponding to this ParentViewHolder.public void setExpanded(boolean expanded)
onExpansionToggled(boolean)expanded - true if expanded, false if notpublic void onExpansionToggled(boolean expanded)
Useful for implementing animations on expansion.
expanded - true if view is expanded before expansion is toggled,
false if notpublic ParentViewHolder.ParentListItemExpandCollapseListener getParentListItemExpandCollapseListener()
ParentViewHolder.ParentListItemExpandCollapseListener implemented in
ExpandableRecyclerAdapter.ParentViewHolder.ParentListItemExpandCollapseListener set in the ParentViewHolderpublic void setParentListItemExpandCollapseListener(ParentViewHolder.ParentListItemExpandCollapseListener parentListItemExpandCollapseListener)
ParentViewHolder.ParentListItemExpandCollapseListener implemented in
ExpandableRecyclerAdapter.parentListItemExpandCollapseListener - The ParentViewHolder.ParentListItemExpandCollapseListener to set on the ParentViewHolderpublic void onClick(android.view.View v)
View.OnClickListener to listen for click events on
the entire parent View.
Only registered if shouldItemViewClickToggleExpansion() is true.
onClick in interface android.view.View.OnClickListenerv - The View that is the trigger for expansionpublic boolean shouldItemViewClickToggleExpansion()
View
should trigger row expansion.
If you return false, you can call expandView() to trigger an
expansion in response to a another event or collapseView() to
trigger a collapse.
View.OnClickListener on the item viewprotected void expandView()
protected void collapseView()