Skip to content
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

Optimize home page sliding animations & improve user guide module animation effects #275

Merged
merged 4 commits into from
Mar 25, 2025

Conversation

guowei0105
Copy link
Contributor

@guowei0105 guowei0105 commented Mar 24, 2025

Summary by CodeRabbit

  • New Features

    • Introduced interactive tutorial and guide screens to enhance user onboarding.
    • Added functionality for managing visibility and animations of UI components on the homescreen.
    • Enhanced interactivity with event callbacks for click events in tutorial interfaces.
  • Refactor

    • Optimized homescreen transitions and animations for smoother, more responsive interactions.
    • Streamlined the display and behavior of interface elements for a more fluid user experience.
    • Updated initialization and visibility management for the app drawer.
  • Version Update

    • Incremented the minor version of the firmware to reflect new features and improvements.

@guowei0105 guowei0105 requested a review from a team as a code owner March 24, 2025 03:21
Copy link

coderabbitai bot commented Mar 24, 2025

Walkthrough

This pull request updates the homescreen.py file to modify animation timings, positions, and event handling. It updates the AppDrawer initialization by adding a hidden flag and revises the hidden_others method to manage UI element visibility. The animation parameters are switched to linear easing, and the starting position of the AppDrawer is set to (0, 0). New classes, UserGuide and BaseTutorial, are introduced with updated signatures and methods for collecting animation targets and handling click events. Additionally, obsolete commented code has been removed.

Changes

File Change Summary
core/.../homescreen.py - Reduced constants for animation timing
- Added hidden flag to AppDrawer initialization
- Modified hidden_others to reset background and toggle title/subtitle visibility
- Updated AppDrawer starting position to (0, 0) and event handling in on_slide_up
- Changed animation paths to linear
- Added new animated classes and methods
- Removed commented code
core/.../version.h - Updated ONEKEY_VERSION_MINOR from 12 to 13
- Updated ONEKEY_VERSION_PATCH from 1 to 0

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between a6e99ef and f751b1a.

📒 Files selected for processing (2)
  • core/embed/firmware/version.h (1 hunks)
  • core/src/trezor/lvglui/scrs/homescreen.py (9 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
core/src/trezor/lvglui/scrs/homescreen.py (6)
core/src/storage/device.py (1)
  • get_homescreen (890-898)
core/src/trezor/lvglui/scrs/components/anim.py (1)
  • Anim (4-41)
core/src/trezor/lvglui/scrs/common.py (5)
  • AnimScreen (56-204)
  • _load_scr (163-177)
  • _load_scr (318-321)
  • load_screen (187-195)
  • load_screen (331-341)
core/src/trezor/lvglui/scrs/initscreen.py (1)
  • _load_scr (44-45)
core/src/trezor/lvglui/scrs/components/button.py (1)
  • ListItemBtn (74-192)
core/src/trezor/lvglui/scrs/bootscreen.py (1)
  • load_screen (30-33)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Gen check
  • GitHub Check: Style check
  • GitHub Check: Defs check
🔇 Additional comments (12)
core/embed/firmware/version.h (1)

12-13: Version numbers updated.

core/src/trezor/lvglui/scrs/homescreen.py (11)

51-52: No issues


135-135: No issues


139-146: No issues


147-152: No issues


224-224: No issues


255-255: No issues


375-383: No issues


387-391: No issues


513-515: No issues


5332-5340: No issues


5401-5406: No issues


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
core/src/trezor/lvglui/scrs/homescreen.py (1)

439-453: Position calculation needs debugging removal.

-                    print(current_y + y_offset)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 08c2513 and e18d4a7.

📒 Files selected for processing (1)
  • core/src/trezor/lvglui/scrs/homescreen.py (9 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
core/src/trezor/lvglui/scrs/homescreen.py (4)
core/src/storage/device.py (1)
  • get_homescreen (890-898)
core/src/trezor/lvglui/scrs/common.py (5)
  • AnimScreen (56-204)
  • load_screen (187-195)
  • load_screen (331-341)
  • _load_scr (163-177)
  • _load_scr (318-321)
core/src/trezor/lvglui/scrs/bootscreen.py (1)
  • load_screen (30-33)
core/src/trezor/lvglui/scrs/initscreen.py (1)
  • _load_scr (44-45)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Defs check
  • GitHub Check: Style check
  • GitHub Check: Gen check
🔇 Additional comments (8)
core/src/trezor/lvglui/scrs/homescreen.py (8)

51-52: Animation timings reduced.

Reduced APP_DRAWER_UP_TIME from 50 to 10 and APP_DRAWER_DOWN_TIME from 150 to 50. Faster animations, better responsiveness.


135-135: AppDrawer hidden by default.


140-152: Improved visibility management.


176-176: Fixed app drawer visibility.


224-224: Changed initial position.

Initial position set to (0,0) instead of off-screen.


376-378: Animation parameters optimized.

Animation now uses linear path for smoother movements.

Also applies to: 383-383, 388-391


5333-5339: New AnimScreen-based UserGuide class.


5398-5404: New AnimScreen-based BaseTutorial class.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
core/src/trezor/lvglui/scrs/homescreen.py (1)

439-452: Position threshold for animations is very small.

2px threshold might cause excessive updates.

-            position_threshold = 2
+            position_threshold = 5
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between e18d4a7 and a9aa6dc.

📒 Files selected for processing (1)
  • core/src/trezor/lvglui/scrs/homescreen.py (9 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
core/src/trezor/lvglui/scrs/homescreen.py (4)
core/src/storage/device.py (1)
  • get_homescreen (890-898)
core/src/trezor/lvglui/scrs/common.py (5)
  • AnimScreen (56-204)
  • load_screen (187-195)
  • load_screen (331-341)
  • _load_scr (163-177)
  • _load_scr (318-321)
core/src/trezor/lvglui/scrs/bootscreen.py (1)
  • load_screen (30-33)
core/src/trezor/lvglui/scrs/initscreen.py (1)
  • _load_scr (44-45)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Gen check
  • GitHub Check: Defs check
  • GitHub Check: Style check
🔇 Additional comments (8)
core/src/trezor/lvglui/scrs/homescreen.py (8)

140-152: Good visibility management improvement.


376-378: Animation path changed to linear.

Also applies to: 383-383


388-391: Matching animation path for dismiss.


5332-5395: New AnimScreen class implementation looks good.


5397-5460: BaseTutorial mirrors UserGuide structure.


5462-5542: SecurityProtection follows consistent pattern.


51-52:

❓ Verification inconclusive

Animation timings are very short.

10ms and 50ms might be too quick for smooth animations.


🏁 Script executed:

#!/bin/bash
# Check for other animation timings in the codebase for comparison
rg --type py "TIME\s*=\s*\d+" | grep -v APP_DRAWER

Length of output: 961


Animation timings in homescreen might be too short.

  • In core/src/trezor/lvglui/scrs/homescreen.py (lines 51–52), APP_DRAWER_UP_TIME is 10 and APP_DRAWER_DOWN_TIME is 50.
  • Other modules use timings between 20 and 150.
    Verify if these low values are intended.

224-224:

✅ Verification successful

Verify other positioning references for consistency.


🏁 Script executed:

#!/bin/bash
# Find other instances where app drawer position is set or referenced
rg "apps\.(set_pos|get_pos)" --type py

Length of output: 40



🏁 Script executed:

#!/bin/bash
echo "Searching for all occurrences of 'set_pos(' in Python files:"
rg "set_pos(" --type py
echo "----------------------"
echo "Searching for all occurrences of 'get_pos(' in Python files:"
rg "get_pos(" --type py

Length of output: 634



🏁 Script executed:

#!/bin/bash
echo "Searching for occurrences of 'set_pos(' with escaped parentheses:"
rg "set_pos\(" --type py
echo "----------------------"
echo "Searching for occurrences of 'get_pos(' with escaped parentheses:"
rg "get_pos\(" --type py

Length of output: 1510


Positioning references are consistent.

  • The usage in homescreen.py at line 224 aligns with similar calls in other files.
  • No discrepancy found.

Lu1zz
Lu1zz previously approved these changes Mar 25, 2025
@guowei0105 guowei0105 merged commit 1d0ef85 into OneKeyHQ:main Mar 25, 2025
7 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.

None yet

3 participants