Skip to content

Migrate away from the deprecated onBackPressed#472

Open
ElCruncharino wants to merge 1 commit into
LivingWithHippos:masterfrom
ElCruncharino:fix/predictive-back
Open

Migrate away from the deprecated onBackPressed#472
ElCruncharino wants to merge 1 commit into
LivingWithHippos:masterfrom
ElCruncharino:fix/predictive-back

Conversation

@ElCruncharino

Copy link
Copy Markdown
Contributor

On Android 16 predictive back is enabled by default for apps targeting API 36 and the deprecated onBackPressed override stops being called, so the double back to exit confirmation was broken.

The exit confirmation now lives in an OnBackPressedCallback registered on the dispatcher. The callback is only enabled when pressing back would actually close the app (same destinations as before: user or authentication screen with no real back stack behind them). Everywhere else the system handles back natively, so the predictive back animations keep working. Also replaced the deprecated call in SettingsActivity.

Closes #262

On Android 16+ predictive back is enabled by default for apps targeting
API 36 and the deprecated onBackPressed override is no longer called,
which broke the double-back-to-exit confirmation.

The exit confirmation now lives in an OnBackPressedCallback that is
only enabled when a back press would actually leave the app, so the
system back animations keep working on every other screen.

Closes LivingWithHippos#262
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE REQUEST] Update deprecated onBackPressed

1 participant