[fix] while tapping on prompt screen 2, 3 times -> fast #73
[fix] while tapping on prompt screen 2, 3 times -> fast #73predator313 wants to merge 2 commits intoandroid:mainfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Summary of Changes
Hello @predator313, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request resolves a user interface bug that occurred during rapid interactions with the prompt screen, specifically when quickly switching between prompt types. The change ensures a more stable and predictable rendering of UI elements by synchronizing their visibility with the completion of navigation animations, thereby preventing visual inconsistencies caused by fast user input.
Highlights
- Bug Fix: Rapid Tapping UI Glitch: I've addressed a UI bug where rapid tapping on the prompt screen could lead to an inconsistent state or visual glitches. This was specifically observed when quickly navigating between prompt types.
- Conditional UI Rendering: To resolve the rapid tapping issue, I've implemented conditional rendering for the
TextPromptcomposable. It now only renders when the pager's current page matches its target page, ensuring that the UI is stable and fully settled after any navigation animations complete.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
This pull request addresses a bug that occurs when rapidly tapping on the prompt screen during navigation. The fix involves conditionally rendering the TextPrompt composable only when the pager animation is complete, which should prevent race conditions and crashes. The approach is sound and uses derivedStateOf for efficient state observation.
I've added one suggestion to improve the readability and maintainability of the condition by using the pagerState.isScrollInProgress property, which is more idiomatic for checking if the pager is idle.
| .padding(2.dp), | ||
| ) | ||
| val showTextPrompt by remember { | ||
| derivedStateOf { pagerState.currentPage == PromptType.TEXT.ordinal && pagerState.targetPage == pagerState.currentPage } |
There was a problem hiding this comment.
While using pagerState.targetPage == pagerState.currentPage is a valid way to check if a scroll is not in progress, PagerState provides a more idiomatic and readable property for this: isScrollInProgress.
Using !pagerState.isScrollInProgress makes the intent clearer and is generally the preferred way to check if the pager is idle.
| derivedStateOf { pagerState.currentPage == PromptType.TEXT.ordinal && pagerState.targetPage == pagerState.currentPage } | |
| derivedStateOf { !pagerState.isScrollInProgress && pagerState.currentPage == PromptType.TEXT.ordinal } |
0478bb6 to
b624d89
Compare
…mpt_screen_repetative_fixed
|
Not sure this is the correct solution to this bug, will come back to you after some internal discussions, thanks for the report and proposed fix in the meantime. |
|
Thanks for the bug report and workaround - I've filed a bug report for the issue internally as we shouldn't need to workaround this - https://issuetracker.google.com/432431393 |
Footnotes
|
|
It appears the previous comment is an automated summary generated by Gemini Code Assist itself, indicating that a review will follow shortly. As Gemini Code Assist, it would be redundant for me to respond to my own summary. I will proceed with the detailed code review as indicated in the summary. |
riggaroo
left a comment
There was a problem hiding this comment.
Lets merge whilst fix is rolling out
Step to Reproduce
Recording_20250703_022159.mp4