public class CharacterSelectorAdapter extends androidx.recyclerview.widget.RecyclerView.Adapter<CharacterSelectorAdapter.Item>
Modifier and Type | Class and Description |
---|---|
class |
CharacterSelectorAdapter.ButtonActions
Class for the implementation of the buttons.
|
class |
CharacterSelectorAdapter.Item
Class that implements the recyclerview.
|
Modifier and Type | Field and Description |
---|---|
private CharacterSelector |
activity |
private ArrayList<CharacterItem> |
characterItems |
private iCharacterSelected |
iSelected |
private int |
resource |
Constructor and Description |
---|
CharacterSelectorAdapter(iCharacterSelected iSelected,
ArrayList<CharacterItem> characterItems,
int resource,
CharacterSelector activity)
Constructor of the character selector.
|
Modifier and Type | Method and Description |
---|---|
int |
getItemCount()
Method to get the item count.
|
void |
onBindViewHolder(CharacterSelectorAdapter.Item holder,
int position)
Method to act over the creation of the view holder.
|
CharacterSelectorAdapter.Item |
onCreateViewHolder(android.view.ViewGroup parent,
int viewType)
Method to act over the view holder creation.
|
bindViewHolder, createViewHolder, getItemId, getItemViewType, hasObservers, hasStableIds, notifyDataSetChanged, notifyItemChanged, notifyItemChanged, notifyItemInserted, notifyItemMoved, notifyItemRangeChanged, notifyItemRangeChanged, notifyItemRangeInserted, notifyItemRangeRemoved, notifyItemRemoved, onAttachedToRecyclerView, onBindViewHolder, onDetachedFromRecyclerView, onFailedToRecycleView, onViewAttachedToWindow, onViewDetachedFromWindow, onViewRecycled, registerAdapterDataObserver, setHasStableIds, unregisterAdapterDataObserver
private ArrayList<CharacterItem> characterItems
private int resource
private CharacterSelector activity
private iCharacterSelected iSelected
public CharacterSelectorAdapter(iCharacterSelected iSelected, ArrayList<CharacterItem> characterItems, int resource, CharacterSelector activity)
iSelected
- Selected character.characterItems
- Items corresponding to the character.resource
- Resource code.activity
- Activity context.@NonNull public CharacterSelectorAdapter.Item onCreateViewHolder(@NonNull android.view.ViewGroup parent, int viewType)
onCreateViewHolder
in class androidx.recyclerview.widget.RecyclerView.Adapter<CharacterSelectorAdapter.Item>
parent
- Parent viewgroup.viewType
- View type code.RecyclerView.Adapter.getItemViewType(int)
,
#onBindViewHolder(ViewHolder, int)
public void onBindViewHolder(@NonNull CharacterSelectorAdapter.Item holder, int position)
onBindViewHolder
in class androidx.recyclerview.widget.RecyclerView.Adapter<CharacterSelectorAdapter.Item>
holder
- Holder item.position
- Position code.public int getItemCount()
getItemCount
in class androidx.recyclerview.widget.RecyclerView.Adapter<CharacterSelectorAdapter.Item>