Created
October 1, 2018 07:27
-
-
Save SabagRonen/76fba7e6bf20cd18617253029f875c7d to your computer and use it in GitHub Desktop.
Why Should You Wrap LiveData With Your Own Abstraction - use directly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private val backgroundColorLiveData = MutableLiveData<Int>() | |
override fun observeTitleBackgroundColorWithDefaultValue(lifecycle: Lifecycle, observer: (Int) -> Unit) { | |
observer(R.color.colorAccent) | |
backgroundColorLiveData.observe({lifecycle}) { | |
it?.let(observer) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment