Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Jintin committed Dec 16, 2020
1 parent ef82fb4 commit 5fe7f5e
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 62 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,62 @@
# BindingExtension
# BindingExtension

ViewBinding is an amazing tool for Android but it's not so fit in Android development as we still have to do some config. BindingExtension is built to provide a simpler usage.

## Install

Add [Jitpack](https://jitpack.io/) repository to your root `build.grable`:
```groovy
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```

Then add dependency in your module `build.gradle`:
```groovy
dependencies {
implementation 'com.github.jintin:BindingExtension:1.0.0'
}
```

## Usage

### Activity

Extend from `BindingActivity` with your actual `ViewBinding` type then you can use `binding` directly after calling `super.onCreate(savedInstanceState)` :

```kotlin
class MainActivity : BindingActivity<ActivityMainBinding>() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

binding.label.setText(R.string.activity_label)
}
}
```

### Fragment

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

```kotlin
class MainFragment : BindingFragment<FragmentMainBinding>() {

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

binding.button.setOnClickListener {
binding.button.setText(R.string.fragment_label)
}
}
}
```

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).

[![Buy Me A Coffee](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/jintin)

0 comments on commit 5fe7f5e

Please sign in to comment.