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
ConstructorsConstructorDescriptionDynamicTutorialsAdapter(FragmentActivity fragmentActivity) Constructor to initialize an object of this class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddTutorial(int location, Tutorial<T, V> tutorial) Add tutorial to this adapter.booleanaddTutorial(Tutorial<T, V> tutorial) Add tutorial to this adapter.booleanaddTutorials(int location, Collection<? extends Tutorial<T, V>> tutorials) Add a collection of tutorials to this adapter.booleanaddTutorials(Collection<? extends Tutorial<T, V>> tutorials) Add a collection of tutorials to this adapter.booleanRemove all the tutorials from this adapter.createFragment(int position) intgetTutorial(int position) Returns the tutorial for a particular position.Get the tutorials shown by this adapter.voidonAttachedToRecyclerView(RecyclerView recyclerView) protected voidThis method will be called to setup the recycler view.booleanremoveTutorial(Tutorial<T, V> tutorial) Remove tutorial from this adapter.booleanremoveTutorials(Collection<? extends Tutorial<T, V>> tutorials) Remove a collection of tutorials from this adapter.booleanretainTutorials(Collection<? extends Tutorial<T, V>> tutorials) Retain a collection of tutorials to this adapter.voidsetTutorials(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, tintRecyclerViewMethods inherited from class androidx.viewpager2.adapter.FragmentStateAdapter
containsItem, getItemId, onBindViewHolder, onCreateViewHolder, onDetachedFromRecyclerView, onFailedToRecycleView, onViewAttachedToWindow, onViewRecycled, restoreState, saveState, setHasStableIdsMethods 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:
createFragmentin classFragmentStateAdapter
-
getItemCount
public int getItemCount()- Specified by:
getItemCountin classRecyclerView.Adapter<FragmentViewHolder>
-
onAttachedToRecyclerView
- Overrides:
onAttachedToRecyclerViewin classDynamicFragmentStateAdapter
-
onSetupRecyclerView
protected void onSetupRecyclerView()Description copied from class:DynamicFragmentStateAdapterThis method will be called to setup the recycler view.- Overrides:
onSetupRecyclerViewin 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:
trueif the tutorials added successfully.
-
addTutorials
Add a collection of tutorials to this adapter.- Parameters:
tutorials- The collection of tutorials to be added.- Returns:
trueif the tutorials added successfully.
-
clearTutorials
public boolean clearTutorials()Remove all the tutorials from this adapter.- Returns:
trueif 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:
trueif the tutorials removed successfully.
-
retainTutorials
Retain a collection of tutorials to this adapter.- Parameters:
tutorials- The collection of tutorials to be retained.- Returns:
trueif the tutorials retained successfully.
-