Skip to content

fix(settings): stop old page flashing on back gesture; desynced page … - #156

Merged
dragonx943 merged 1 commit into
UsagiApp:fix/settingsfrom
nichind:devel
Oct 21, 2026
Merged

dragonx943 merged 1 commit into
UsagiApp:fix/settingsfrom
nichind:devel

Conversation

@nichind

@nichind nichind commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

…titles

what

  • Going back from any settings section with the gesture showed the old section again for one frame.
  • Section titles changed only after the back animation had finished.
SVID_20261019_190400_1.mp4

why

  • Sections used setTransition(TRANSIT_FRAGMENT_OPEN), which plays fragment Animators. With predictive back (Android 14+), FragmentManager seeks those Animators with setCurrentPlayTime() and calls AnimatorSet.start() when the gesture is committed. That call draws one frame at the start values (alpha 1, scale 1).
  • Titles were set in onResume(). The entering page only reaches RESUMED after the transition ends.

fix

  • Sections use Fade instead of setTransition(). Transitions are seeked by a different mechanism and don't flash, and the fade still follows the gesture.
  • Duration is 100 ms (motionDurationShort2 from the Material theme); the default 300 ms felt slow.
  • The fade uses M3 emphasized decelerate easing. After the finger is lifted, androidx.transition finishes the seek with its own fixed spring (STIFFNESS_LOW, about 300 ms) that can't be configured, so the fade is front-loaded to be nearly done before release. The visible page change after a gesture went from about 200 ms to 33–66 ms.
  • Transitions aren't saved with fragments, so FragmentLifecycleCallbacks re-applies them to restored fragments. Without this, back after a theme change or rotation had no animation.
  • Titles are set in onStart() (BasePreferenceFragment, SourceSettingsFragment, and the changelog, nav config, sources manage and plugins manage fragments), which runs when the transition starts. A cancelled gesture runs the section's onStart() again and restores its title. All title setters moved together; otherwise SourceSettingsFragment would show "Settings" before the source name.
SVID_20261019_211913_1.mp4

test

  • compileDebugKotlin passes.
  • Tested on Android 15 & 13

@nichind
nichind requested a review from dragonx943 as a code owner October 19, 2026 18:23
@dragonx943
dragonx943 changed the base branch from devel to fix/settings October 21, 2026 04:39
@dragonx943
dragonx943 merged commit 63c0974 into UsagiApp:fix/settings Oct 21, 2026
2 checks passed
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.

2 participants