- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2.7k
feat(ui): improve predictive back animations #2675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| Feels like an AI coded PR to me not gonna lie | 
| 
 Fr 😂 | 
| Looks like AI while looking at the description and comments, i doubt anyone writes that much for real | 
This pull request introduces custom screen transition animations to
enhance the overall user experience during navigation.
The key change is the implementation of a custom slide/fade effect for
navigating from main screens (i.e., screens hosted in the bottom
navigation bar) to detail screens. Transitions between the bottom
navigation bar tabs themselves retain a simple, clean cross-fade effect
to ensure a fast and smooth user interaction.
This PR also addresses the root cause of an issue where custom
animations were being overridden by the navigation library's defaults.
During implementation, it was discovered that custom transition
animations defined in the `defaultTransitions` parameter of the
`DestinationsNavHost` in `MainActivity` were not being applied. Instead,
a default fade-in/fade-out animation was always present.
The root cause was traced to the `compose-destinations` KSP (Kotlin
Symbol Processing) code generator. By default, the generator creates a
`NavGraphSpec` (e.g., `RootNavGraph.kt`) that includes its own
`defaultTransitions` property. This property, defined at compile-time
within the generated graph object, has a higher precedence than the
`defaultTransitions` parameter supplied to the `DestinationsNavHost`
composable at runtime.
As a result, our intended custom animations were being ignored and
overridden by the generated default.
To resolve this precedence issue permanently, this PR adopts the
official configuration method recommended by the `compose-destinations`
library.
- The following KSP argument has been added to the
`app/build.gradle.kts` file:
```kotlin
ksp {
    arg("compose-destinations.defaultTransitions", "none")
}
```
- This argument instructs the code generator to omit the
`defaultTransitions` property from the generated `NavGraphSpec`.
- By removing the higher-priority, generated default, the
`defaultTransitions` parameter on `DestinationsNavHost` now functions as
the effective default, allowing our custom animation logic to execute as
intended.
The new animation logic is conditional and defined within
`MainActivity`. It distinguishes between two primary navigation types:
- Main Screen → Detail Screen:
   - Enter: The new detail screen slides in from the right.
   - Exit: The old main screen slides out to the left while fading out.
- Detail Screen → Main Screen (on Pop):
- Pop Enter: The main screen slides back in from the left while fading
in.
   - Pop Exit: The detail screen slides out to the right.
- Between Bottom Navigation Tabs:
- A simple cross-fade (`fadeIn`/`fadeOut`) is maintained for these
transitions to provide a quick and non-disruptive experience when
switching between primary sections of the app.
Signed-off-by: rsuntk <[email protected]>
    | No reason not to merge IMO if the PR is good. Whether it was written by slamming one's head against the keyboard, with esoteric telepathy, or using AI, all that matters is the question: is the PR good and maintainable? Everything else is gate-keeping and status signaling. | 
| 
 Using AI to generate comments and pr descriptions is not allowed here? I'm new here, if so, I'll be more careful. | 
| 
 What's wrong with that if PR is good? | 
This pull request introduces custom screen transition animations to
enhance the overall user experience during navigation.
The key change is the implementation of a custom slide/fade effect for
navigating from main screens (i.e., screens hosted in the bottom
navigation bar) to detail screens. Transitions between the bottom
navigation bar tabs themselves retain a simple, clean cross-fade effect
to ensure a fast and smooth user interaction.
This PR also addresses the root cause of an issue where custom
animations were being overridden by the navigation library's defaults.
During implementation, it was discovered that custom transition
animations defined in the `defaultTransitions` parameter of the
`DestinationsNavHost` in `MainActivity` were not being applied. Instead,
a default fade-in/fade-out animation was always present.
The root cause was traced to the `compose-destinations` KSP (Kotlin
Symbol Processing) code generator. By default, the generator creates a
`NavGraphSpec` (e.g., `RootNavGraph.kt`) that includes its own
`defaultTransitions` property. This property, defined at compile-time
within the generated graph object, has a higher precedence than the
`defaultTransitions` parameter supplied to the `DestinationsNavHost`
composable at runtime.
As a result, our intended custom animations were being ignored and
overridden by the generated default.
To resolve this precedence issue permanently, this PR adopts the
official configuration method recommended by the `compose-destinations`
library.
- The following KSP argument has been added to the
`app/build.gradle.kts` file:
```kotlin
ksp {
    arg("compose-destinations.defaultTransitions", "none")
}
```
- This argument instructs the code generator to omit the
`defaultTransitions` property from the generated `NavGraphSpec`.
- By removing the higher-priority, generated default, the
`defaultTransitions` parameter on `DestinationsNavHost` now functions as
the effective default, allowing our custom animation logic to execute as
intended.
The new animation logic is conditional and defined within
`MainActivity`. It distinguishes between two primary navigation types:
- Main Screen → Detail Screen:
   - Enter: The new detail screen slides in from the right.
   - Exit: The old main screen slides out to the left while fading out.
- Detail Screen → Main Screen (on Pop):
- Pop Enter: The main screen slides back in from the left while fading
in.
   - Pop Exit: The detail screen slides out to the right.
- Between Bottom Navigation Tabs:
- A simple cross-fade (`fadeIn`/`fadeOut`) is maintained for these
transitions to provide a quick and non-disruptive experience when
switching between primary sections of the app.
    * 'main' of https://github.com/tiann/KernelSU: (42 commits) Unmount isolated process which forks from zygote unconditionally (tiann#2747) fix 'for' loop problem (tiann#2745) update resetprop (tiann#2733) Strip JNI debug logs on release build (tiann#2732) manager: Support search module (tiann#2730) manager: Add uninstall 2nd confirm (tiann#2729) manager: Fix some issues (tiann#2725) manager: fix button issues in module cards (tiann#2719) manager: switch ui to miuix design style (tiann#2710) Revert "Handle unmount for isolated process correctly" (tiann#2718) Handle unmount for isolated process correctly (tiann#2696) Reset seccomp filter count when escaping to root (tiann#2708) kernel: selinux: rules: Micro-optimize get_policydb() and fix illegal RCU lock usage in handle_sepolicy() (tiann#2695) Update resetprop from Magisk v30.2 (tiann#2700) ksud: support vendor_boot patching for some odd devices (tiann#2650) ksud: make clippy happy (tiann#2683) feat(ui): improve predictive back animations (tiann#2675) kernel: added new prctl CMD_GET_MANAGER_UID to get the uid of the crowned manager (tiann#2673) kernel: selinux: rules: Fix illegal RCU lock usage in apply_kernelsu_rules() (tiann#2646) manger: fix lkm detection (tiann#2654) ... Conflicts: kernel/core_hook.c kernel/selinux/rules.c kernel/throne_tracker.c Change-Id: Iebf7dd870a7d9e35f4cecbf97fa13eeb174b7b5d
Summary
This pull request introduces custom screen transition animations to enhance the overall user experience during navigation.
The key change is the implementation of a custom slide/fade effect for navigating from main screens (i.e., screens hosted in the bottom navigation bar) to detail screens. Transitions between the bottom navigation bar tabs themselves retain a simple, clean cross-fade effect to ensure a fast and smooth user interaction.
This PR also addresses the root cause of an issue where custom animations were being overridden by the navigation library's defaults.
Root Cause
During implementation, it was discovered that custom transition animations defined in the
defaultTransitionsparameter of theDestinationsNavHostinMainActivitywere not being applied. Instead, a default fade-in/fade-out animation was always present.The root cause was traced to the
compose-destinationsKSP (Kotlin Symbol Processing) code generator. By default, the generator creates aNavGraphSpec(e.g.,RootNavGraph.kt) that includes its owndefaultTransitionsproperty. This property, defined at compile-time within the generated graph object, has a higher precedence than thedefaultTransitionsparameter supplied to theDestinationsNavHostcomposable at runtime.As a result, our intended custom animations were being ignored and overridden by the generated default.
Solution
To resolve this precedence issue permanently, this PR adopts the official configuration method recommended by the
compose-destinationslibrary.app/build.gradle.ktsfile:ksp { arg("compose-destinations.defaultTransitions", "none") }This argument instructs the code generator to omit the
defaultTransitionsproperty from the generatedNavGraphSpec.By removing the higher-priority, generated default, the
defaultTransitionsparameter onDestinationsNavHostnow functions as the effective default, allowing our custom animation logic to execute as intended.Animation Logic Details
The new animation logic is conditional and defined within
MainActivity. It distinguishes between two primary navigation types:Main Screen → Detail Screen:
Enter: The new detail screen slides in from the right.
Exit: The old main screen slides out to the left while fading out.
Detail Screen → Main Screen (on Pop):
Pop Enter: The main screen slides back in from the left while fading in.
Pop Exit: The detail screen slides out to the right.
Between Bottom Navigation Tabs:
fadeIn/fadeOut) is maintained for these transitions to provide a quick and non-disruptive experience when switching between primary sections of the app.