hadilq/LiveEvent

[Feature Request] Encapsulation

TurKurT656 opened this issue · 1 comments

Hi,
I always used Event wrapper for handling actions. But I found this solution as a better approach.

However It would be great if you add encapsulation support. I mean for LiveData itself we have two classes: LiveData and MutableLiveData and for example we use them in a ViewModel like below:

private val _isEnabled = MutableLiveData<Boolean>(false)
val isEnabled: LiveData<Boolean>
    get() = _isEnabled

With this approach we cannot post values inside view to the LiveData we observing. So in this library we can have two classes like LiveEvent and MutableLiveEvent that extends from LiveEvent. This two functions (postValue() and setValue()) must be protected inside LiveEvent class and public inside MutableLiveEvent.

Sorry I didn't read the usage section carefully. My bad :)