Skip to content

Instantly share code, notes, and snippets.

@n-belokopytov
Created April 16, 2018 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save n-belokopytov/b67db2efdeea92e0d6fc3c2c26324109 to your computer and use it in GitHub Desktop.
Save n-belokopytov/b67db2efdeea92e0d6fc3c2c26324109 to your computer and use it in GitHub Desktop.
A state object implemented with Kotlin's sealed classes
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()
class Element
class TabElement
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment