Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
emeruvia committed Apr 29, 2022
1 parent aeb71c8 commit f6e7e63
Showing 1 changed file with 12 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,22 @@ package com.seannajera.dkouple
import android.view.View
import androidx.recyclerview.widget.RecyclerView


/**
* ComponentView is a type of ViewHolder that uses an associated, strongly typed, Component generic
* parameter as its state representation and can only be associated with that one type of
* Component.
*
* The ComponentView is created by the ComponentAdapter.onBindViewHolder method, where the
* ComponentFactory uses the ComponentView's associated Component's annotated layoutId (via
* the DkoupleComponent annotation) to lookup the correct ComponentView
*
* ComponentView receives its updated Component state from the ComponentAdapter.onBindViewHolder
* method.
*
* When using DKouple's annotation processor to generate the ComponentFactory, please ensure that
* ComponentView contains the DKoupleView class annotation in your source code as well as the
* FactoryView annotation on the view in the constructor.
* ComponentViewBinding expands upon ComponentView. It adds a ViewBinding generic parameter so
* that the user can associate with the respective ViewBinding file generated by the XML layout.
* This forces any class implementing the ComponentViewBinding to add the respective ViewBinding file.
*/
abstract class ComponentViewBinding<Component: com.seannajera.dkouple.Component, ViewBinding>(
view: View
) : ComponentView<Component>(view) {

/**
* Instance of ViewBinding file generated by the XML Layout. It's initialization can be done
* lazily using:
* val binding: ViewBinding by lazy {
* ViewBinding.bind(view)
* }
*/
abstract val binding: ViewBinding
}

0 comments on commit f6e7e63

Please sign in to comment.