Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Jintin committed Dec 19, 2020
1 parent feb3b94 commit f13e81c
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dependencies {

### Activity

Extend from `BindingActivity` with your actual `ViewBinding` type 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 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:

```kotlin
class MainActivity : BindingActivity<ActivityMainBinding>(ActivityMainBinding::inflate) {
Expand All @@ -43,7 +43,7 @@ class MainActivity : BindingActivity<ActivityMainBinding>(ActivityMainBinding::i

### Fragment

Extend from `BindingFragment` with your actual `ViewBinding` type then you can use `binding` directly after `super.onCreateView(inflater, container, savedInstanceState)` is called:
Extend from `BindingFragment` with your actual `ViewBinding` inflate method reference then you can use `binding` directly after `super.onCreateView(inflater, container, savedInstanceState)` is called:

```kotlin
class MainFragment : BindingFragment<FragmentMainBinding>(FragmentMainBinding::inflate) {
Expand All @@ -58,6 +58,20 @@ class MainFragment : BindingFragment<FragmentMainBinding>(FragmentMainBinding::i
}
```

### ViewHolder

Extend from `BindingHolder` with parent `ViewGroup` and your actual `ViewBinding` inflate method reference then you can use `binding` directly:

```kotlin
class ViewHolder(parent: ViewGroup) :
BindingHolder<AdapterMainBinding>(parent, AdapterMainBinding::inflate) {

fun bind(data: String) {
binding.name.text = data
}
}
```

You can go to ./app module for more information.
## Contributing
Bug reports and pull requests are welcome on GitHub at [https://github.com/Jintin/BindingExtension](https://github.com/Jintin/BindingExtension).
Expand Down

0 comments on commit f13e81c

Please sign in to comment.