Skip to content

[fix] while tapping on prompt screen 2, 3 times -> fast , #73

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

predator313
Copy link

Step to Reproduce

  1. click prompt Button
  2. click photo Button
  3. again click prompt Button
  4. tap prompt screen 2,3 times fast
Image
Recording_20250703_022159.mp4

Copy link

google-cla bot commented Jul 2, 2025

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.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

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 TextPrompt composable. 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

  1. 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.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

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 }
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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.

Suggested change
derivedStateOf { pagerState.currentPage == PromptType.TEXT.ordinal && pagerState.targetPage == pagerState.currentPage }
derivedStateOf { !pagerState.isScrollInProgress && pagerState.currentPage == PromptType.TEXT.ordinal }

@predator313 predator313 force-pushed the app_crash_tapping_prompt_screen_repetative_fixed branch from 0478bb6 to b624d89 Compare July 2, 2025 21:42
@predator313 predator313 changed the title fixed while tapping prompt screen 2, 3 times fast , [fix] while tapping on prompt screen 2, 3 times -> fast , Jul 3, 2025
@tiwiz tiwiz requested a review from riggaroo July 7, 2025 13:40
@riggaroo
Copy link
Collaborator

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.

@riggaroo
Copy link
Collaborator

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

@Stas474
Copy link

Stas474 commented Jul 17, 2025

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 TextPrompt composable. 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

  1. 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.

Copy link
Contributor

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.

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