Created
December 22, 2019 12:57
-
-
Save zsoltk/cc516d1535b4f35cc4f578ed89c8edc9 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
class MainActivity : AppCompatActivity() { | |
private val rootHandler = ScopedBackPressHandler() | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContent { | |
MaterialTheme { | |
RootBackHandler(rootHandler) { | |
Root.Content(LoggedOut) | |
} | |
} | |
} | |
} | |
override fun onBackPressed() { | |
if (!rootHandler.handle()) { | |
super.onBackPressed() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment