-
Notifications
You must be signed in to change notification settings - Fork 662
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[connect] Use AndroidX Navigation in Example app (#9767)
* refactor using androidx navigation compose * use bottom sheet in MainActivity; safe nav up * ruby scripts/dependencies/update_transitive_dependencies.rb
- Loading branch information
1 parent
72e13bc
commit 5d21a09
Showing
13 changed files
with
280 additions
and
304 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
14 changes: 14 additions & 0 deletions
14
...ect-example/src/main/java/com/stripe/android/connect/example/core/NavigationExtensions.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.stripe.android.connect.example.core | ||
|
||
import androidx.lifecycle.Lifecycle | ||
import androidx.navigation.NavHostController | ||
|
||
/** | ||
* Safer [NavHostController.navigateUp] that prevents navigating past the previous screen, | ||
* typically due to accidental double-clicks. | ||
*/ | ||
fun NavHostController.safeNavigateUp() { | ||
if (currentBackStackEntry?.lifecycle?.currentState == Lifecycle.State.RESUMED) { | ||
navigateUp() | ||
} | ||
} |
This file contains 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
Oops, something went wrong.