Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
AacMviViewModel for Activities with DataHolder
open class AacMviViewModelDH<STATE, EFFECT, EVENT>(application: Application, private val aacMviDH: AacMviDH<STATE, EFFECT>) :
AndroidViewModel(application), ViewModelContract<EVENT> {
fun viewStates(): LiveData<STATE> = aacMviDH.stateLiveData
fun viewEffects(): LiveData<EFFECT> = aacMviDH.effectLiveData
@CallSuper
override fun process(viewEvent: EVENT) {
Log.d(TAG, "processing viewEvent : $viewEvent")
}
override fun onCleared() {
super.onCleared()
aacMviDH.onCleared()
Log.d(TAG, "onCleared")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment