Class DateAdapter
- java.lang.Object
-
- androidx.recyclerview.widget.RecyclerView.Adapter<VH>
-
- com.cheetahdigital.uikit.widget.list.ListAdapter<EventDate,DateViewHolder>
-
- com.cheetahdigital.event.ui.eventdate.list.DateAdapter
-
public class DateAdapter extends com.cheetahdigital.uikit.widget.list.ListAdapter<EventDate,DateViewHolder>
The adapter forEventDateListAdapter
-
-
Constructor Summary
Constructors Constructor Description DateAdapter(android.content.Context context, java.util.List<EventDate> dataList)
Constructor forDateAdapter
DateAdapter(android.content.Context context, java.util.List<EventDate> dataList, OnDateSelectedListener listener)
Constructor forDateAdapter
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAll(java.util.List<EventDate> data)
Appends all of the elements in the specified collection to the end of this list and notifies registered observers that the item list has been changed.protected void
bindNormalViewHolder(DateViewHolder holder, int position)
Abstract method to bind the normal view holder.protected DateViewHolder
createNormalViewHolder(android.view.ViewGroup parent, int viewType)
Abstract method to create normal view holder.void
enableUseOriginalWidth(boolean useOriginalWidth)
Enable the use of original widthvoid
next()
Select the next item and update the properties of the view to be in selected statevoid
previous()
Select previous item and update the properties of the view in selected statevoid
setOriginalWidth(int originalWidth)
Set the original width of each date cellvoid
setSelectedIndex(int selectedIndex)
Set the current selected indexvoid
updateSelectedIndex(int index)
Update the selected index and the views for the current cell-
Methods inherited from class com.cheetahdigital.uikit.widget.list.ListAdapter
addItem, addItem, clear, getDataList, getItemAt, getItemCount, getItemViewType, getPlaceHolderResource, insertItems, isListEmpty, onBindViewHolder, onCreateViewHolder, removeItem, replaceItemAt, setCustomEmptyMessageResource, setPlaceHolderResource, sort
-
Methods inherited from class androidx.recyclerview.widget.RecyclerView.Adapter
bindViewHolder, createViewHolder, getItemId, hasObservers, hasStableIds, notifyDataSetChanged, notifyItemChanged, notifyItemChanged, notifyItemInserted, notifyItemMoved, notifyItemRangeChanged, notifyItemRangeChanged, notifyItemRangeInserted, notifyItemRangeRemoved, notifyItemRemoved, onAttachedToRecyclerView, onBindViewHolder, onDetachedFromRecyclerView, onFailedToRecycleView, onViewAttachedToWindow, onViewDetachedFromWindow, onViewRecycled, registerAdapterDataObserver, setHasStableIds, unregisterAdapterDataObserver
-
-
-
-
Constructor Detail
-
DateAdapter
public DateAdapter(android.content.Context context, java.util.List<EventDate> dataList)
Constructor forDateAdapter
- Parameters:
context
- context of the view that the adapter to be attacheddataList
- list ofEventDate
to be displayed
-
DateAdapter
public DateAdapter(android.content.Context context, java.util.List<EventDate> dataList, OnDateSelectedListener listener)
Constructor forDateAdapter
- Parameters:
context
- context of the view that the adapter to be attacheddataList
- list ofEventDate
to be displayedlistener
- theOnDateSelectedListener
that handles when a date is clicked
-
-
Method Detail
-
createNormalViewHolder
protected DateViewHolder createNormalViewHolder(android.view.ViewGroup parent, int viewType)
Description copied from class:com.cheetahdigital.uikit.widget.list.ListAdapter
Abstract method to create normal view holder.- Specified by:
createNormalViewHolder
in classcom.cheetahdigital.uikit.widget.list.ListAdapter<EventDate,DateViewHolder>
- Parameters:
parent
- used to get resourceviewType
- type of view- Returns:
- view holder for non special items
-
bindNormalViewHolder
protected void bindNormalViewHolder(DateViewHolder holder, int position)
Description copied from class:com.cheetahdigital.uikit.widget.list.ListAdapter
Abstract method to bind the normal view holder.- Specified by:
bindNormalViewHolder
in classcom.cheetahdigital.uikit.widget.list.ListAdapter<EventDate,DateViewHolder>
- Parameters:
holder
- view holder to vindSposition
- index of the item
-
addAll
public void addAll(java.util.List<EventDate> data)
Description copied from class:com.cheetahdigital.uikit.widget.list.ListAdapter
Appends all of the elements in the specified collection to the end of this list and notifies registered observers that the item list has been changed.- Overrides:
addAll
in classcom.cheetahdigital.uikit.widget.list.ListAdapter<EventDate,DateViewHolder>
- Parameters:
data
- list of items to add
-
enableUseOriginalWidth
public void enableUseOriginalWidth(boolean useOriginalWidth)
Enable the use of original width- Parameters:
useOriginalWidth
-true
to use original width, elsefalse
-
setOriginalWidth
public void setOriginalWidth(int originalWidth)
Set the original width of each date cell- Parameters:
originalWidth
- widht of date cell
-
setSelectedIndex
public void setSelectedIndex(int selectedIndex)
Set the current selected index- Parameters:
selectedIndex
- current index selected
-
updateSelectedIndex
public void updateSelectedIndex(int index)
Update the selected index and the views for the current cell- Parameters:
index
- index to set as selected
-
next
public void next()
Select the next item and update the properties of the view to be in selected state
-
previous
public void previous()
Select previous item and update the properties of the view in selected state
-
-