java.lang.Object
androidx.recyclerview.widget.RecyclerView.Adapter<FragmentViewHolder>
androidx.viewpager2.adapter.FragmentStateAdapter
com.pranavpandey.android.dynamic.support.adapter.DynamicFragmentStateAdapter
com.pranavpandey.android.dynamic.support.tutorial.adapter.DynamicTutorialsAdapter<V,T>
- Type Parameters:
V
- The type of the view or fragment this adapter will handle.T
- The type of the tutorial this adapter will handle.
- All Implemented Interfaces:
StatefulAdapter
public class DynamicTutorialsAdapter<V extends Fragment,T extends Tutorial<T,V>>
extends DynamicFragmentStateAdapter
A
DynamicFragmentStateAdapter
to display the supplied Tutorial
.-
Constructor Summary
ConstructorDescriptionDynamicTutorialsAdapter
(FragmentActivity fragmentActivity) Constructor to initialize an object of this class. -
Method Summary
Modifier and TypeMethodDescriptionboolean
addTutorial
(int location, Tutorial<T, V> tutorial) Add tutorial to this adapter.boolean
addTutorial
(Tutorial<T, V> tutorial) Add tutorial to this adapter.boolean
addTutorials
(int location, Collection<? extends Tutorial<T, V>> tutorials) Add a collection of tutorials to this adapter.boolean
addTutorials
(Collection<? extends Tutorial<T, V>> tutorials) Add a collection of tutorials to this adapter.boolean
Remove all the tutorials from this adapter.createFragment
(int position) int
getTutorial
(int position) Returns the tutorial for a particular position.Get the tutorials shown by this adapter.void
onAttachedToRecyclerView
(RecyclerView recyclerView) protected void
This method will be called to setup the recycler view.boolean
removeTutorial
(Tutorial<T, V> tutorial) Remove tutorial from this adapter.boolean
removeTutorials
(Collection<? extends Tutorial<T, V>> tutorials) Remove a collection of tutorials from this adapter.boolean
retainTutorials
(Collection<? extends Tutorial<T, V>> tutorials) Retain a collection of tutorials to this adapter.void
setTutorials
(Collection<? extends Tutorial<T, V>> tutorials) Set tutorials for this adapter.Methods inherited from class com.pranavpandey.android.dynamic.support.adapter.DynamicFragmentStateAdapter
getContrastWithColor, getRecyclerView, setContrastWithColor, tintRecyclerView
Methods inherited from class androidx.viewpager2.adapter.FragmentStateAdapter
containsItem, getItemId, onBindViewHolder, onCreateViewHolder, onDetachedFromRecyclerView, onFailedToRecycleView, onViewAttachedToWindow, onViewRecycled, restoreState, saveState, setHasStableIds
Methods inherited from class androidx.recyclerview.widget.RecyclerView.Adapter
bindViewHolder, createViewHolder, getItemViewType, hasObservers, hasStableIds, notifyDataSetChanged, notifyItemChanged, notifyItemChanged, notifyItemInserted, notifyItemMoved, notifyItemRangeChanged, notifyItemRangeChanged, notifyItemRangeInserted, notifyItemRangeRemoved, notifyItemRemoved, onBindViewHolder, onViewDetachedFromWindow, registerAdapterDataObserver, unregisterAdapterDataObserver
-
Constructor Details
-
DynamicTutorialsAdapter
Constructor to initialize an object of this class.- Parameters:
fragmentActivity
- The fragment activity to do the transactions.
-
-
Method Details
-
createFragment
- Specified by:
createFragment
in classFragmentStateAdapter
-
getItemCount
public int getItemCount()- Specified by:
getItemCount
in classRecyclerView.Adapter<FragmentViewHolder>
-
onAttachedToRecyclerView
- Overrides:
onAttachedToRecyclerView
in classDynamicFragmentStateAdapter
-
onSetupRecyclerView
protected void onSetupRecyclerView()Description copied from class:DynamicFragmentStateAdapter
This method will be called to setup the recycler view.- Overrides:
onSetupRecyclerView
in classDynamicFragmentStateAdapter
-
setTutorials
Set tutorials for this adapter.- Parameters:
tutorials
- The collection of tutorials to be set.
-
addTutorials
Add a collection of tutorials to this adapter.- Parameters:
location
- The index at which to add.tutorials
- The collection of tutorials to be added.- Returns:
true
if the tutorials added successfully.
-
addTutorials
Add a collection of tutorials to this adapter.- Parameters:
tutorials
- The collection of tutorials to be added.- Returns:
true
if the tutorials added successfully.
-
clearTutorials
public boolean clearTutorials()Remove all the tutorials from this adapter.- Returns:
true
if the tutorials removed successfully.
-
getTutorials
Get the tutorials shown by this adapter.- Returns:
- The tutorials shown by this adapter.
-
getTutorial
Returns the tutorial for a particular position.- Parameters:
position
- The position to get the tutorial.- Returns:
- The tutorial at the supplied position.
-
removeTutorials
Remove a collection of tutorials from this adapter.- Parameters:
tutorials
- The collection of tutorials to be removed.- Returns:
true
if the tutorials removed successfully.
-
retainTutorials
Retain a collection of tutorials to this adapter.- Parameters:
tutorials
- The collection of tutorials to be retained.- Returns:
true
if the tutorials retained successfully.
-