Add Predictive Back support - #665
Merged
Merged
Conversation
Opt the intellij demo into the predictive back gesture via android:enableOnBackInvokedCallback, so the RibActivity OnBackPressedCallback path is actually exercised on Android 13+. Drop StackRouterNavigator.peekPreviousRouter(). It was added only to let a peek animation pre-render the previous screen, and that animation is not part of this change, so it was unused public API. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Add android:enableOnBackInvokedCallback to the stack-nav manifest, matching the intellij demo. This demo drives StackRouterNavigator, so it exercises the RibActivity OnBackPressedCallback path against a real router stack rather than a single screen. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
RibActivity now handles back via an OnBackPressedCallback instead of an onBackPressed() override, so the uber#662 regression test has to drive the dispatcher to reach it. On androidx.activity 1.13 the deprecated ComponentActivity.onBackPressed() delivers through NavigationEventInput, which never reaches the dispatcher under Robolectric. Intent is unchanged: with attachContent overridden to skip attach, a back press must not crash on the null router and must fall through to super. Co-Authored-By: Claude Opus 5 (1M context) <ANONYMIZED_EMAIL_ADDRESS_0_6>
psteiger
reviewed
Sep 23, 2026
| RxActivityEvents { | ||
| private var router: ViewRouter<*, *>? = null | ||
|
|
||
| private val ribBackPressCallback = |
Contributor
There was a problem hiding this comment.
I'd consider this class implementing this interface to save the object allocation; not sure if that is still relevant on modern android, but it doesn't hurt
psteiger
approved these changes
Sep 23, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
Old RIBs + Predictive Back opt-out
https://github.com/user-attachments/assets/6077cd8a-086a-4d16-9576-161486643fc3
Old RIBs + NO Predictive Back opt-out
https://github.com/user-attachments/assets/58621020-d78b-4042-b312-f56087b3d153
This Change + Predictive Back opt-out
https://github.com/user-attachments/assets/6654d5f9-4b0d-419d-80c5-2268b5bfde9b
This Change + NO Predictive Back opt-out
https://github.com/user-attachments/assets/6d357d38-aaf9-4c07-a6d1-48395db98ce7