diff --git a/README.md b/README.md index bbc8415..1e74d9c 100644 --- a/README.md +++ b/README.md @@ -179,15 +179,36 @@ class MainActivity : AppCompatActivity() { } } +``` -🌟 You are all set! +You can also directly integrate livedata to your button. This will automatically change the state of +button according to the livedata. + +```kotlin + +//This is an enum that contains all button states, use this for livedata +enum class ButtonStates { + LOADING, ENABLED, DISABLED, FINISHED +} -## 🍰 Contribute +//liveData variable +val buttonState = MutableLiveData() + +//In Fragment or Activity +binding.progressButton.attachToLiveData(buttonState) + +``` + +Just post the button state to the livedata like +`livedata.postValue(ButtonStates.LOADING)` and button will change to loading state automatically + +🌟 You are all set! -Feel free to fork this project, to optimise the code or to add new features. +## 🍰 Contribute +Feel free to fork this project, to optimise the code or to add new features. -## 📝 TODO +## 📝 TODO * Lottie support