Class DynamicPresetsAdapter<T extends DynamicAppTheme>
java.lang.Object
androidx.recyclerview.widget.RecyclerView.Adapter<VH>
com.pranavpandey.android.dynamic.support.recyclerview.adapter.DynamicRecyclerViewAdapter<DynamicPresetsAdapter.ViewHolder<T>>
com.pranavpandey.android.dynamic.support.theme.adapter.DynamicPresetsAdapter<T>
- Type Parameters:
T
- The type of the dynamic app theme this adapter will receive.
public class DynamicPresetsAdapter<T extends DynamicAppTheme>
extends DynamicRecyclerViewAdapter<DynamicPresetsAdapter.ViewHolder<T>>
A recycler view adapter to show the theme presets.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic @interface
Interface to hold the presets layout according to the recycler view orientation.static class
View holder class to hold the preset view.Nested classes/interfaces inherited from class com.pranavpandey.android.dynamic.support.recyclerview.adapter.DynamicRecyclerViewAdapter
DynamicRecyclerViewAdapter.DynamicRecyclerViewItem, DynamicRecyclerViewAdapter.ItemType
-
Field Summary
Fields inherited from class com.pranavpandey.android.dynamic.support.recyclerview.adapter.DynamicRecyclerViewAdapter
TYPE_EMPTY_VIEW, TYPE_ITEM, TYPE_SECTION_DIVIDER, TYPE_SECTION_HEADER, TYPE_SETTING, TYPE_UNKNOWN
-
Constructor Summary
ConstructorDescriptionDynamicPresetsAdapter
(Context context, int type) Constructor to initialize an object of this class.DynamicPresetsAdapter
(Context context, int type, int layoutRes) Constructor to initialize an object of this class. -
Method Summary
Modifier and TypeMethodDescriptionGet the dynamic preset listener used by this adapter.int
int
Returns the layout resource containing the theme preview.void
onBindViewHolder
(DynamicPresetsAdapter.ViewHolder<T> holder, int position) onCreateViewHolder
(ViewGroup parent, int viewType) void
setDynamicPresetsListener
(DynamicPresetsView.DynamicPresetsListener<T> dynamicPresetsListener) Sets the dynamic preset listener for this adapter.void
setPresets
(Cursor presets) Sets the theme presets for this adapter.Methods inherited from class com.pranavpandey.android.dynamic.support.recyclerview.adapter.DynamicRecyclerViewAdapter
getContext, getLayoutManager, getRecyclerView, isComputingLayout, onAttachedToRecyclerView
Methods inherited from class androidx.recyclerview.widget.RecyclerView.Adapter
bindViewHolder, createViewHolder, getItemId, getItemViewType, hasObservers, hasStableIds, notifyDataSetChanged, notifyItemChanged, notifyItemChanged, notifyItemInserted, notifyItemMoved, notifyItemRangeChanged, notifyItemRangeChanged, notifyItemRangeInserted, notifyItemRangeRemoved, notifyItemRemoved, onBindViewHolder, onDetachedFromRecyclerView, onFailedToRecycleView, onViewAttachedToWindow, onViewDetachedFromWindow, onViewRecycled, registerAdapterDataObserver, setHasStableIds, unregisterAdapterDataObserver
-
Constructor Details
-
DynamicPresetsAdapter
Constructor to initialize an object of this class.- Parameters:
context
- The context to get the layout inflater.type
- The type of the preset layout.
-
DynamicPresetsAdapter
Constructor to initialize an object of this class.- Parameters:
context
- The context to get the layout inflater.type
- The type of the preset layout.layoutRes
- The layout resource containing the theme preview.- See Also:
-
-
Method Details
-
onCreateViewHolder
@NonNull public DynamicPresetsAdapter.ViewHolder<T> onCreateViewHolder(@NonNull ViewGroup parent, int viewType) - Specified by:
onCreateViewHolder
in classRecyclerView.Adapter<DynamicPresetsAdapter.ViewHolder<T extends DynamicAppTheme>>
-
getItemCount
public int getItemCount()- Specified by:
getItemCount
in classRecyclerView.Adapter<DynamicPresetsAdapter.ViewHolder<T extends DynamicAppTheme>>
-
setPresets
Sets the theme presets for this adapter.- Parameters:
presets
- The theme presets to be set.
-
getLayoutRes
Returns the layout resource containing the theme preview.- Returns:
- The layout resource containing the theme preview.
-
getDynamicPresetsListener
Get the dynamic preset listener used by this adapter.- Returns:
- The dynamic preset listener used by this adapter.
-