public class DividableGridAdapter
extends android.widget.BaseAdapter
BottomSheet. It allows to show the items in a
list or grid and supports to show dividers.| Constructor and Description |
|---|
DividableGridAdapter(android.content.Context context,
BottomSheet.Style style,
int width)
Creates a new adapter, which manages the items of a
BottomSheet. |
| Modifier and Type | Method and Description |
|---|---|
void |
add(AbstractItem item)
Adds a new item to the adapter.
|
void |
clear()
Removes all items from the adapter.
|
boolean |
containsDividers()
Returns, whether the adapter contains dividers, or not.
|
int |
getColumnCount()
Returns the number of columns, which are displayed by the adapter.
|
int |
getCount() |
int |
getDividerColor()
Returns the color of the adapter's dividers.
|
AbstractItem |
getItem(int position) |
int |
getItemColor()
Returns the text color of the adapter's items.
|
int |
getItemCount()
Returns the number of items, which are contained by the adapter.
|
long |
getItemId(int position) |
int |
getItemViewType(int position) |
BottomSheet.Style |
getStyle()
Returns the style, which is used to display the adapter's items.
|
android.view.View |
getView(int position,
android.view.View convertView,
android.view.ViewGroup parent) |
int |
getViewTypeCount() |
boolean |
isEnabled(int position) |
boolean |
isItemEnabled(int index)
Returns, whether the item at a specific index is enabled, or not.
|
void |
notifyOnChange(boolean notifyOnChange)
Sets, whether the
notifyDataSetChanged-method should be called automatically,
when the adapter's items have been changed, or not. |
void |
remove(int index)
Removes the item at a specific index.
|
void |
set(int index,
AbstractItem item)
Replaces the item with at a specific index
|
void |
setDividerColor(int color)
Sets the color of the adapter's dividers.
|
void |
setItemColor(int color)
Sets the text color of the adapter's items.
|
void |
setItemEnabled(int index,
boolean enabled)
Sets, whether the item at a specific index should be enabled, or not.
|
void |
setStyle(BottomSheet.Style style)
Sets the style, which should be used to display the adapter's items.
|
void |
setWidth(int width)
Sets the width of the bottom sheet, the items, which are displayed by the adapter, belong
to.
|
public DividableGridAdapter(android.content.Context context,
BottomSheet.Style style,
int width)
BottomSheet.context - The context, which should be used by the adapter, as an instance of the class Context. The context may not be nullstyle - The style, which should be used to display the adapter's items, as a value of the
enum BottomSheet.Style. The style may either be LIST,
LIST_COLUMNS or GRIDwidth - The width of the bottom sheet, the items, which are displayed by the adapter, belong
to, as an Integer valuepublic final BottomSheet.Style getStyle()
BottomSheet.Style. The style may either be LIST, LIST_COLUMNS or
GRIDpublic final void setStyle(BottomSheet.Style style)
style - The style, which should be set, as a value of the enum BottomSheet.Style. The style may
either be LIST, LIST_COLUMNS or GRIDpublic final void setWidth(int width)
width - The width, which should be set, as an Integer valuepublic final boolean containsDividers()
public final int getColumnCount()
public final int getItemColor()
Integer value or -1, if no custom
color has been setpublic final void setItemColor(int color)
color - The text color, which should be set, as an Integer value or -1, if no custom
color should be setpublic final int getDividerColor()
Integer value or -1, if no custom
color has been setpublic final void setDividerColor(int color)
color - The color, which should be set, as an Integer value or -1, if no custom color
should be setpublic final void add(AbstractItem item)
item - The item, which should be added, as an instance of the class AbstractItem.
The item may not be nullpublic final void set(int index,
AbstractItem item)
index - The index of the item, which should be replaced, as an Integer valueitem - The item, which should be set, as an instance of the class AbstractItem. The
item may not be nullpublic final void remove(int index)
index - The index of the item, which should be removed, as an Integer valuepublic final void clear()
public final int getItemCount()
public final boolean isItemEnabled(int index)
index - The index of the item, which should be checked, as an Integer valuepublic final void setItemEnabled(int index,
boolean enabled)
index - The index of the item as an Integer valueenabled - True, if the item should be enabled, false otherwisepublic final void notifyOnChange(boolean notifyOnChange)
notifyDataSetChanged-method should be called automatically,
when the adapter's items have been changed, or not.notifyOnChange - True, if the notifyDataSetChanged-method should be called automatically,
when the adapter's items have been changed, false otherwisepublic final boolean isEnabled(int position)
isEnabled in interface android.widget.ListAdapterisEnabled in class android.widget.BaseAdapterpublic final int getCount()
public final AbstractItem getItem(int position)
public final long getItemId(int position)
public final android.view.View getView(int position,
android.view.View convertView,
android.view.ViewGroup parent)
public final int getViewTypeCount()
getViewTypeCount in interface android.widget.AdaptergetViewTypeCount in class android.widget.BaseAdapterpublic final int getItemViewType(int position)
getItemViewType in interface android.widget.AdaptergetItemViewType in class android.widget.BaseAdapter