public abstract class Section
extends java.lang.Object
SectionedRecyclerViewAdapter.| Modifier and Type | Class and Description |
|---|---|
static class |
Section.State |
| Constructor and Description |
|---|
Section(SectionParameters sectionParameters)
Create a Section object based on
SectionParameters. |
| Modifier and Type | Method and Description |
|---|---|
abstract int |
getContentItemsTotal()
Return the total of items of this Section.
|
java.lang.Integer |
getEmptyResourceId()
Return the layout resource id of the empty view.
|
android.view.View |
getEmptyView(android.view.ViewGroup parent)
Creates the View for the Empty state.
|
androidx.recyclerview.widget.RecyclerView.ViewHolder |
getEmptyViewHolder(android.view.View view)
Return the ViewHolder for the Empty state of this Section.
|
java.lang.Integer |
getFailedResourceId()
Return the layout resource id of the failed view.
|
android.view.View |
getFailedView(android.view.ViewGroup parent)
Creates the View for the Failed state.
|
androidx.recyclerview.widget.RecyclerView.ViewHolder |
getFailedViewHolder(android.view.View view)
Return the ViewHolder for the Failed state of this Section.
|
java.lang.Integer |
getFooterResourceId()
Return the layout resource id of the footer.
|
android.view.View |
getFooterView(android.view.ViewGroup parent)
Creates the View for the Footer.
|
androidx.recyclerview.widget.RecyclerView.ViewHolder |
getFooterViewHolder(android.view.View view)
Return the ViewHolder for the Footer of this Section.
|
java.lang.Integer |
getHeaderResourceId()
Return the layout resource id of the header.
|
android.view.View |
getHeaderView(android.view.ViewGroup parent)
Creates the View for the Header.
|
androidx.recyclerview.widget.RecyclerView.ViewHolder |
getHeaderViewHolder(android.view.View view)
Return the ViewHolder for the Header of this Section.
|
java.lang.Integer |
getItemResourceId()
Return the layout resource id of the item.
|
android.view.View |
getItemView(android.view.ViewGroup parent)
Creates the View for a single Item.
|
abstract androidx.recyclerview.widget.RecyclerView.ViewHolder |
getItemViewHolder(android.view.View view)
Return the ViewHolder for a single Item of this Section.
|
java.lang.Integer |
getLoadingResourceId()
Return the layout resource id of the loading view.
|
android.view.View |
getLoadingView(android.view.ViewGroup parent)
Creates the View for the Loading state.
|
androidx.recyclerview.widget.RecyclerView.ViewHolder |
getLoadingViewHolder(android.view.View view)
Return the ViewHolder for the Loading state of this Section.
|
int |
getSectionItemsTotal()
Return the total of items of this Section, including content items (according to the section
state) plus header and footer.
|
Section.State |
getState()
Return the current State of this Section.
|
boolean |
hasFooter()
Check if this Section has a footer.
|
boolean |
hasHeader()
Check if this Section has a header.
|
boolean |
isEmptyViewWillBeProvided()
Return whether the empty view is provided through
getEmptyView(ViewGroup). |
boolean |
isFailedViewWillBeProvided()
Return whether the failed view is provided through
getFailedView(ViewGroup). |
boolean |
isFooterViewWillBeProvided()
Return whether the footer view is provided through
getFooterView(ViewGroup). |
boolean |
isHeaderViewWillBeProvided()
Return whether the header view is provided through
getHeaderView(ViewGroup). |
boolean |
isItemViewWillBeProvided()
Return whether the item view is provided through
getItemView(ViewGroup). |
boolean |
isLoadingViewWillBeProvided()
Return whether the loading view is provided through
getLoadingView(ViewGroup). |
boolean |
isVisible()
Check if this Section is visible.
|
void |
onBindEmptyViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder holder)
Bind the data to the ViewHolder for the Empty state of this Section.
|
void |
onBindEmptyViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder holder,
java.util.List<java.lang.Object> payloads)
Bind the data to the ViewHolder for the Empty state of this Section.
|
void |
onBindFailedViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder holder)
Bind the data to the ViewHolder for the Failed state of this Section.
|
void |
onBindFailedViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder holder,
java.util.List<java.lang.Object> payloads)
Bind the data to the ViewHolder for the Failed state of this Section.
|
void |
onBindFooterViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder holder)
Bind the data to the ViewHolder for the Footer of this Section.
|
void |
onBindFooterViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder holder,
java.util.List<java.lang.Object> payloads)
Bind the data to the ViewHolder for the Footer of this Section.
|
void |
onBindHeaderViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder holder)
Bind the data to the ViewHolder for the Header of this Section.
|
void |
onBindHeaderViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder holder,
java.util.List<java.lang.Object> payloads)
Bind the data to the ViewHolder for the Header of this Section.
|
abstract void |
onBindItemViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder holder,
int position)
Bind the data to the ViewHolder for an Item of this Section.
|
void |
onBindItemViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder holder,
int position,
java.util.List<java.lang.Object> payloads)
Bind the data to the ViewHolder for an Item of this Section.
|
void |
onBindLoadingViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder holder)
Bind the data to the ViewHolder for Loading state of this Section.
|
void |
onBindLoadingViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder holder,
java.util.List<java.lang.Object> payloads)
Bind the data to the ViewHolder for Loading state of this Section.
|
void |
setHasFooter(boolean hasFooter)
Set if this Section has footer.
|
void |
setHasHeader(boolean hasHeader)
Set if this Section has header.
|
void |
setState(Section.State state)
Set the State of this Section.
|
void |
setVisible(boolean visible)
Set if this Section is visible.
|
public Section(@NonNull
SectionParameters sectionParameters)
SectionParameters.sectionParameters - section parameterspublic final void setState(Section.State state)
state - state of this sectionpublic final Section.State getState()
public final boolean isVisible()
public final void setVisible(boolean visible)
visible - true if this Section is visiblepublic final boolean hasHeader()
public final void setHasHeader(boolean hasHeader)
hasHeader - true if this Section has a headerpublic final boolean hasFooter()
public final void setHasFooter(boolean hasFooter)
hasFooter - true if this Section has a footerpublic final boolean isItemViewWillBeProvided()
getItemView(ViewGroup).
If false, the item view is inflated using the resource from getItemResourceId().getItemView(ViewGroup).public final java.lang.Integer getItemResourceId()
public final boolean isHeaderViewWillBeProvided()
getHeaderView(ViewGroup).
If false, the header view is inflated using the resource from
getHeaderResourceId().getHeaderView(ViewGroup).public final java.lang.Integer getHeaderResourceId()
public final boolean isFooterViewWillBeProvided()
getFooterView(ViewGroup).
If false, the footer view is inflated using the resource from
getFooterResourceId().getFooterView(ViewGroup).public final java.lang.Integer getFooterResourceId()
public final boolean isLoadingViewWillBeProvided()
getLoadingView(ViewGroup).
If false, the loading view is inflated using the resource from
getLoadingResourceId().getLoadingView(ViewGroup).public final java.lang.Integer getLoadingResourceId()
public final boolean isFailedViewWillBeProvided()
getFailedView(ViewGroup).
If false, the failed view is inflated using the resource from
getFailedResourceId().getFailedView(ViewGroup).public final java.lang.Integer getFailedResourceId()
public final boolean isEmptyViewWillBeProvided()
getEmptyView(ViewGroup).
If false, the empty view is inflated using the resource from
getEmptyResourceId().getEmptyView(ViewGroup).public final java.lang.Integer getEmptyResourceId()
public final int getSectionItemsTotal()
public abstract int getContentItemsTotal()
public android.view.View getItemView(android.view.ViewGroup parent)
isItemViewWillBeProvided() is true.parent - The parent view. Note that there is no need to attach the new view.public abstract androidx.recyclerview.widget.RecyclerView.ViewHolder getItemViewHolder(android.view.View view)
view - View created by getItemView or inflated resource returned by getItemResourceIdpublic abstract void onBindItemViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder holder,
int position)
holder - ViewHolder for the Item of this Sectionposition - position of the item in the Section, not in the RecyclerViewpublic void onBindItemViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder holder,
int position,
java.util.List<java.lang.Object> payloads)
holder - ViewHolder for the Item of this Sectionposition - position of the item in the Section, not in the RecyclerViewpayloads - A non-null and non-empty list of merged payloads.public android.view.View getHeaderView(android.view.ViewGroup parent)
isHeaderViewWillBeProvided() is true.parent - The parent view. Note that there is no need to attach the new view.public androidx.recyclerview.widget.RecyclerView.ViewHolder getHeaderViewHolder(android.view.View view)
view - View inflated by resource returned by getHeaderResourceIdpublic void onBindHeaderViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder holder)
holder - ViewHolder for the Header of this Sectionpublic void onBindHeaderViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder holder,
java.util.List<java.lang.Object> payloads)
holder - ViewHolder for the Header of this Sectionpayloads - A non-null and non-empty list of merged payloads.public android.view.View getFooterView(android.view.ViewGroup parent)
isFooterViewWillBeProvided() is true.parent - The parent view. Note that there is no need to attach the new view.public androidx.recyclerview.widget.RecyclerView.ViewHolder getFooterViewHolder(android.view.View view)
view - View inflated by resource returned by getFooterResourceIdpublic void onBindFooterViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder holder)
holder - ViewHolder for the Footer of this Sectionpublic void onBindFooterViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder holder,
java.util.List<java.lang.Object> payloads)
holder - ViewHolder for the Footer of this Sectionpayloads - A non-null and non-empty list of merged payloads.public android.view.View getLoadingView(android.view.ViewGroup parent)
isLoadingViewWillBeProvided() is true.parent - The parent view. Note that there is no need to attach the new view.public androidx.recyclerview.widget.RecyclerView.ViewHolder getLoadingViewHolder(android.view.View view)
view - View inflated by resource returned by getItemResourceIdpublic void onBindLoadingViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder holder)
holder - ViewHolder for the Loading state of this Sectionpublic void onBindLoadingViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder holder,
java.util.List<java.lang.Object> payloads)
holder - ViewHolder for the Loading state of this Sectionpayloads - A non-null and non-empty list of merged payloads.public android.view.View getFailedView(android.view.ViewGroup parent)
isFailedViewWillBeProvided() is true.parent - The parent view. Note that there is no need to attach the new view.public androidx.recyclerview.widget.RecyclerView.ViewHolder getFailedViewHolder(android.view.View view)
view - View inflated by resource returned by getItemResourceIdpublic void onBindFailedViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder holder)
holder - ViewHolder for the Failed state of this Sectionpublic void onBindFailedViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder holder,
java.util.List<java.lang.Object> payloads)
holder - ViewHolder for the Failed state of this Sectionpayloads - A non-null and non-empty list of merged payloads.public android.view.View getEmptyView(android.view.ViewGroup parent)
isEmptyViewWillBeProvided() is true.parent - The parent view. Note that there is no need to attach the new view.public androidx.recyclerview.widget.RecyclerView.ViewHolder getEmptyViewHolder(android.view.View view)
view - View inflated by resource returned by getItemResourceIdpublic void onBindEmptyViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder holder)
holder - ViewHolder for the Empty state of this Sectionpublic void onBindEmptyViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder holder,
java.util.List<java.lang.Object> payloads)
holder - ViewHolder for the Empty state of this Sectionpayloads - A non-null and non-empty list of merged payloads.