Skip to content

manager: optimize BottomBar pagescroll animation - #3196

Merged
YuKongA merged 2 commits into
tiann:mainfrom
u9521:page-anim
Feb 3, 2026
Merged

YuKongA merged 2 commits into
tiann:mainfrom
u9521:page-anim

Conversation

@u9521

@u9521 u9521 commented Feb 3, 2026

Copy link
Copy Markdown
Contributor
  • Replace animateScrollToPage with animateScrollBy
  • using a dynamic duration based on the distance between pages.

- 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 <63995396+u9521@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 animateScrollToPage with pixel-based animateScrollBy for 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.

Comment thread manager/app/src/main/java/me/weishu/kernelsu/ui/component/BottomBar.kt Outdated
- 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 <63995396+u9521@users.noreply.github.com>
@YuKongA
YuKongA merged commit 097f832 into tiann:main Feb 3, 2026
@YuKongA

YuKongA commented Feb 3, 2026 •

Copy link
Copy Markdown
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 <63995396+u9521@users.noreply.github.com>
@u9521

u9521 commented Feb 3, 2026

Copy link
Copy Markdown
Contributor Author

漏了从第四页通过侧滑回主页时也需要

#3197 😥 加了,现在首页两个卡片和返回也用新动画了,应该齐了吧

@u9521
u9521 deleted the page-anim branch February 3, 2026 12:56
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.

3 participants