New: Utility function for popping the backstack.

This commit is contained in:
Kevin Gorham 2021-04-23 14:22:44 -04:00
parent 517471208e
commit cbcb628466
No known key found for this signature in database
GPG Key ID: CCA55602DF49FC38
1 changed files with 4 additions and 0 deletions

View File

@ -213,6 +213,10 @@ class MainActivity : AppCompatActivity() {
findViewById<TextView>(R.id.text_message).text = message
}
fun popBackTo(@IdRes destination: Int, inclusive: Boolean = false) {
navController?.popBackStack(destination, inclusive)
}
fun safeNavigate(@IdRes destination: Int, extras: Navigator.Extras? = null) {
if (navController == null) {
navInitListeners.add {