View TabbedListState.kt
sealed class TabbedListState
class InProgressState : TabbedListState()
class FinishedState : TabbedListState()
data class ErrorState(val errorMessage: String,
val errorColor: Int) : TabbedListState()
data class ListState(val listElements: List<Element>,
val totalItems: Int,
val currentTabId: Int,
val tabs: List<TabElement>) : TabbedListState()
data class OfflineState(val listElements: List<Element>) : TabbedListState()
View TabbedListActivity.kt
override fun onStart() {
viewModel.tabbedListLiveData.observe(this, Observer {
when (it) {
is ErrorState -> {
showProgress(false)
showErrorView(it.errorMessage, it.errorColor)
}
is InProgressState -> showProgress(true)
is OfflineState -> {