HelpItemAdapter

class HelpItemAdapter(context: Context, data: List<HelpData>, armadilloViewModel: ArmadilloViewModel, lifecycleOwner: LifecycleOwner) : RecyclerView.Adapter<HelpItemAdapter.HelpItemViewHolder>

RecyclerView adapter used to display the list of help resources for the current Fragment.

The adapter manages the RecyclerView HelpItemViewHolders and binds the values from the help resource list to the holders. If a holder is currently (re)usable, the current help resource is bound to it. If no holder is (re)usable, a new one is created and the current help resource is then bound to it. As soon as the user scrolls further and a Holder leaves the screen, it is no longer needed to display its current content and can be reused by binding a new content to it.

Constructors

HelpItemAdapter
Link copied to clipboard
fun HelpItemAdapter(context: Context, data: List<HelpData>, armadilloViewModel: ArmadilloViewModel, lifecycleOwner: LifecycleOwner)

Types

HelpItemViewHolder
Link copied to clipboard
class HelpItemViewHolder(view: View) : RecyclerView.ViewHolder
ViewHolder class used by HelpItemAdapter.

Properties

armadilloViewModel
Link copied to clipboard
private val armadilloViewModel: ArmadilloViewModel
Is necessary because the dyslexicFont value is saved there.
context
Link copied to clipboard
private val context: Context
necessary to be able to convert resource IDs from data to resources.
data
Link copied to clipboard
private val data: List<HelpData>
retrieved list of help resources from HelpViewModel which was parsed from /assets/helpdata.
lifecycleOwner
Link copied to clipboard
private val lifecycleOwner: LifecycleOwner
Is necessary to set an observer to dyslexicFont value in armadilloViewModel.

Inherited properties

mHasStableIds
Link copied to clipboard
private val mHasStableIds: Boolean
mObservable
Link copied to clipboard
private val mObservable: RecyclerView.AdapterDataObservable

Functions

getItemCount
Link copied to clipboard
open override fun getItemCount(): Int
Count the items from the parsed help data list.
onBindViewHolder
Link copied to clipboard
open override fun onBindViewHolder(holder: HelpItemAdapter.HelpItemViewHolder, position: Int)
If there is a (re)usable HelpItemViewHolder: change its content.
onCreateViewHolder
Link copied to clipboard
open override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): HelpItemAdapter.HelpItemViewHolder
If there is no (re)usable HelpItemViewHolder: create a new one.

Inherited functions

bindViewHolder
Link copied to clipboard
fun bindViewHolder(@NonNull() p0: HelpItemAdapter.HelpItemViewHolder, p1: Int)
createViewHolder
Link copied to clipboard
fun createViewHolder(@NonNull() p0: ViewGroup, p1: Int): HelpItemAdapter.HelpItemViewHolder
getItemId
Link copied to clipboard
open fun getItemId(p0: Int): Long
getItemViewType
Link copied to clipboard
open fun getItemViewType(p0: Int): Int
hasObservers
Link copied to clipboard
fun hasObservers(): Boolean
hasStableIds
Link copied to clipboard
fun hasStableIds(): Boolean
notifyDataSetChanged
Link copied to clipboard
fun notifyDataSetChanged()
notifyItemChanged
Link copied to clipboard
fun notifyItemChanged(p0: Int)
fun notifyItemChanged(p0: Int, @Nullable() p1: Any?)
notifyItemInserted
Link copied to clipboard
fun notifyItemInserted(p0: Int)
notifyItemMoved
Link copied to clipboard
fun notifyItemMoved(p0: Int, p1: Int)
notifyItemRangeChanged
Link copied to clipboard
fun notifyItemRangeChanged(p0: Int, p1: Int)
fun notifyItemRangeChanged(p0: Int, p1: Int, @Nullable() p2: Any?)
notifyItemRangeInserted
Link copied to clipboard
fun notifyItemRangeInserted(p0: Int, p1: Int)
notifyItemRangeRemoved
Link copied to clipboard
fun notifyItemRangeRemoved(p0: Int, p1: Int)
notifyItemRemoved
Link copied to clipboard
fun notifyItemRemoved(p0: Int)
onAttachedToRecyclerView
Link copied to clipboard
open fun onAttachedToRecyclerView(@NonNull() p0: RecyclerView)
onBindViewHolder
Link copied to clipboard
open fun onBindViewHolder(@NonNull() p0: HelpItemAdapter.HelpItemViewHolder, p1: Int, @NonNull() p2: MutableList<Any>)
onDetachedFromRecyclerView
Link copied to clipboard
open fun onDetachedFromRecyclerView(@NonNull() p0: RecyclerView)
onFailedToRecycleView
Link copied to clipboard
open fun onFailedToRecycleView(@NonNull() p0: HelpItemAdapter.HelpItemViewHolder): Boolean
onViewAttachedToWindow
Link copied to clipboard
open fun onViewAttachedToWindow(@NonNull() p0: HelpItemAdapter.HelpItemViewHolder)
onViewDetachedFromWindow
Link copied to clipboard
open fun onViewDetachedFromWindow(@NonNull() p0: HelpItemAdapter.HelpItemViewHolder)
onViewRecycled
Link copied to clipboard
open fun onViewRecycled(@NonNull() p0: HelpItemAdapter.HelpItemViewHolder)
registerAdapterDataObserver
Link copied to clipboard
open fun registerAdapterDataObserver(@NonNull() p0: RecyclerView.AdapterDataObserver)
setHasStableIds
Link copied to clipboard
open fun setHasStableIds(p0: Boolean)
unregisterAdapterDataObserver
Link copied to clipboard
open fun unregisterAdapterDataObserver(@NonNull() p0: RecyclerView.AdapterDataObserver)