manager: optimize BottomBar pagescroll animation#3196
Merged
YuKongA merged 2 commits intotiann:mainfrom Feb 3, 2026
Merged
Conversation
- Replace `animateScrollToPage` with `animateScrollBy` using a dynamic duration based on the distance between pages. - Ensure the selected state synchronizes with the `pageState` upon completion of the scroll animation. Signed-off-by: u9521 <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR optimizes the BottomBar page scroll animation by replacing animateScrollToPage with animateScrollBy and implementing dynamic animation duration based on page distance. The change aims to provide smoother and more proportional animations when navigating between pages in the bottom navigation bar.
Changes:
- Replaced
animateScrollToPagewith pixel-basedanimateScrollByfor more granular control - Introduced dynamic duration calculation that scales with navigation distance
- Added state management (
selectedPage,isNavigating) to track navigation state and prevent conflicts during animation
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
manager/app/src/main/java/me/weishu/kernelsu/ui/component/BottomBar.kt
Outdated
Show resolved
Hide resolved
- Track navigation coroutine jobs to allow cancellation when a new page is selected. - Ensure `isNavigating` and `selectedPage` are only updated by the most recent navigation job. - Adjust scroll animation duration calculation based on distance. Signed-off-by: u9521 <[email protected]>
YuKongA
approved these changes
Feb 3, 2026
Collaborator
|
漏了从第四页通过侧滑回主页时也需要 |
KOWX712
pushed a commit
to KOWX712/KernelSU
that referenced
this pull request
Feb 3, 2026
- Replace `animateScrollToPage` with `animateScrollBy` - using a dynamic duration based on the distance between pages. --------- Signed-off-by: u9521 <[email protected]>
Contributor
Author
#3197 😥 加了,现在首页两个卡片和返回也用新动画了,应该齐了吧 |
PhuScam
pushed a commit
to PhuScam/KernelSU
that referenced
this pull request
Feb 5, 2026
- Replace `animateScrollToPage` with `animateScrollBy` - using a dynamic duration based on the distance between pages. --------- Signed-off-by: u9521 <[email protected]>
PhuScam
pushed a commit
to PhuScam/KernelSU
that referenced
this pull request
Feb 18, 2026
- Replace `animateScrollToPage` with `animateScrollBy` - using a dynamic duration based on the distance between pages. --------- Signed-off-by: u9521 <[email protected]>
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.
animateScrollToPagewithanimateScrollBy