DpadComposeFocusViewHolder
class DpadComposeFocusViewHolder<T>(parent: ViewGroup, compositionStrategy: ViewCompositionStrategy = RecyclerViewCompositionStrategy.DisposeOnRecycled, isFocusable: Boolean = true, content: @Composable (item: T) -> Unit = {}) : RecyclerView.ViewHolder
Similar to DpadComposeViewHolder, but sends the focus down to composables
This allows inline definition of ViewHolders in onCreateViewHolder
:
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): DpadComposeFocusViewHolder<Int> {
return DpadComposeFocusViewHolder(parent) { item, isSelected ->
ItemComposable(item, isSelected)
}
}
Content copied to clipboard
To update the current item, override onBindViewHolder
and call setItemState:
override fun onBindViewHolder(holder: DpadComposeFocusViewHolder<Int>, position: Int) {
holder.setItemState(getItem(position))
}
Content copied to clipboard
Constructors
Link copied to clipboard
constructor(parent: ViewGroup, compositionStrategy: ViewCompositionStrategy = RecyclerViewCompositionStrategy.DisposeOnRecycled, isFocusable: Boolean = true, content: @Composable (item: T) -> Unit = {})
Functions
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard