diff --git a/README.md b/README.md index 918dac8..8ad7041 100644 --- a/README.md +++ b/README.md @@ -28,14 +28,14 @@ dependencies { First of all, BindingExtension using refelction a lot to link many things internally in order to provide simple usage. To prevent having trouble with proguard, please remember to exclude ViewBinding related class in your proguard file. -For example, if your package is `com.jintin.bindingextension.app`: +For example, if your ViewBinding class is all under `com.jintin.bindingextension.app` package: ``` -keep public class com.jintin.bindingextension.app.databinding** { ; } ``` ### Activity -Extend from `BindingActivity` with your actual `ViewBinding` inflate method reference then you can use `binding` directly after calling `super.onCreate(savedInstanceState)` and you don't have to call `setContentView` anymore: +Extend from `BindingActivity` with your `ViewBinding` type then you can use `binding` directly after calling `super.onCreate(savedInstanceState)` and you don't have to call `setContentView` anymore: ```kotlin class MainActivity : BindingActivity() { @@ -50,7 +50,7 @@ class MainActivity : BindingActivity() { ### Fragment -Extend from `BindingFragment` with your actual `ViewBinding` inflate method reference then you can use `binding` directly after `super.onCreateView(inflater, container, savedInstanceState)` is called: +Extend from `BindingFragment` with your `ViewBinding` type then you can use `binding` directly after `super.onCreateView(inflater, container, savedInstanceState)` is called: ```kotlin class MainFragment : BindingFragment() { @@ -67,16 +67,16 @@ class MainFragment : BindingFragment() { ### ViewHolder -BindingExtension provide an extension function for ViewGroup, you can call `ViewGroup.toBinding()` in `onCreateViewHolder` to get your desire type of `ViewBinding`. -And ViewHolder can than access ViewBinding directly without further modification. +BindingExtension provide an extension function for `ViewGroup`, you can call `ViewGroup.toBinding()` in `onCreateViewHolder` to get your desire type of `ViewBinding`. +And `ViewHolder` can than access `ViewBinding` directly without further transformation. ```kotlin +// inside adapter override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { return MainViewHolder(parent.toBinding()) } -//... - +// ViewHolder class MainViewHolder(private val binding: AdapterMainBinding) : RecyclerView.ViewHolder(binding.root) {