Class DynamicFragmentStateAdapter
java.lang.Object
androidx.recyclerview.widget.RecyclerView.Adapter<FragmentViewHolder>
androidx.viewpager2.adapter.FragmentStateAdapter
com.pranavpandey.android.dynamic.support.adapter.DynamicFragmentStateAdapter
- All Implemented Interfaces:
StatefulAdapter
- Direct Known Subclasses:
DynamicTutorialsAdapter
A
FragmentStateAdapter
to be used with the ViewPager2
.
The main purpose of this adapter is to tint the recycler view edge glow according to the dynamic theme.
-
Constructor Summary
ConstructorDescriptionDynamicFragmentStateAdapter
(Fragment fragment) DynamicFragmentStateAdapter
(FragmentActivity fragmentActivity) DynamicFragmentStateAdapter
(FragmentManager fragmentManager, Lifecycle lifecycle) -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the contrast with color used by this adapter.Returns the recycler view attached to this adapter.void
onAttachedToRecyclerView
(RecyclerView recyclerView) protected void
This method will be called to setup the recycler view.void
setContrastWithColor
(int contrastWithColor) Set the contrast with color used by this adapter.void
Tint the recycler view attached to this adapter.Methods inherited from class androidx.viewpager2.adapter.FragmentStateAdapter
containsItem, createFragment, getItemId, onBindViewHolder, onCreateViewHolder, onDetachedFromRecyclerView, onFailedToRecycleView, onViewAttachedToWindow, onViewRecycled, restoreState, saveState, setHasStableIds
Methods inherited from class androidx.recyclerview.widget.RecyclerView.Adapter
bindViewHolder, createViewHolder, getItemCount, getItemViewType, hasObservers, hasStableIds, notifyDataSetChanged, notifyItemChanged, notifyItemChanged, notifyItemInserted, notifyItemMoved, notifyItemRangeChanged, notifyItemRangeChanged, notifyItemRangeInserted, notifyItemRangeRemoved, notifyItemRemoved, onBindViewHolder, onViewDetachedFromWindow, registerAdapterDataObserver, unregisterAdapterDataObserver
-
Constructor Details
-
DynamicFragmentStateAdapter
-
DynamicFragmentStateAdapter
-
DynamicFragmentStateAdapter
public DynamicFragmentStateAdapter(@NonNull FragmentManager fragmentManager, @NonNull Lifecycle lifecycle)
-
-
Method Details
-
onAttachedToRecyclerView
- Overrides:
onAttachedToRecyclerView
in classFragmentStateAdapter
-
onSetupRecyclerView
protected void onSetupRecyclerView()This method will be called to setup the recycler view. -
tintRecyclerView
public void tintRecyclerView()Tint the recycler view attached to this adapter. -
getRecyclerView
Returns the recycler view attached to this adapter.- Returns:
- The recycler view attached to this adapter.
-
getContrastWithColor
Returns the contrast with color used by this adapter.- Returns:
- The contrast with color used by this adapter.
-
setContrastWithColor
Set the contrast with color used by this adapter.- Parameters:
contrastWithColor
- The contrast with color to be set.
-