Created
September 3, 2018 21:54
-
-
Save nhaarman/0d038432d7d24defd6d1f9cb5afd82f2 to your computer and use it in GitHub Desktop.
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
interface SimpleContainer { | |
var text: String | |
} | |
class SimpleScreen( | |
val name: String | |
) : Screen<SimpleContainer> { | |
override fun attach(v: SimpleContainer) { | |
v.text = "Hello, $name!" | |
} | |
override fun saveInstanceState() = savedState { | |
it["name"] = name | |
} | |
companion object { | |
fun from(savedState: SavedState) : SimpleScreen { | |
return SimpleScreen(savedState["name"]) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment