This file contains hidden or 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
sealed class MainViewEvent { | |
data class NewsItemClicked(val newsItem: NewsItem) : MainViewEvent() | |
object FabClicked : MainViewEvent() | |
object OnSwipeRefresh : MainViewEvent() | |
object FetchNews : MainViewEvent() | |
} |
This file contains hidden or 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
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") |
This file contains hidden or 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
open class AacMviDH<STATE, EFFECT> { | |
private val _states: MutableLiveData<STATE> = MutableLiveData() | |
val stateLiveData: LiveData<STATE> | |
get() = _states | |
private var _state: STATE? = null | |
var state: STATE | |
get() = _state | |
?: throw UninitializedPropertyAccessException("\"state\" was queried before being initialized") |
OlderNewer