Skip to content

Conversation

@helpingstar
Copy link
Contributor

@helpingstar helpingstar commented Nov 6, 2025

Changed hardcoded "TAG" string to TAG constant in tap-to-focus log statement

onTap = {
with(coordinateTransformer) {
val surfaceCoords = it.transform()
Log.d(
"TAG",
"onTapToFocus: " +
"input{$it} -> surface{$surfaceCoords}"
)

Please note: I understand that minor typo fixes might not be the priority for this project. If you prefer not to accept this type of contribution, I'm happy to close this PR. No hard feelings!

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @helpingstar, 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 introduces a minor refactoring to enhance code consistency by replacing a hardcoded log tag string with a predefined constant. This change specifically targets a log statement within the tap-to-focus functionality, ensuring that log tags adhere to established conventions.

Highlights

  • Code Consistency: Replaced a hardcoded string literal "TAG" with a TAG constant in a log statement, improving code consistency and maintainability.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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 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. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

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

The pull request effectively addresses the use of a hardcoded string for the log tag by replacing it with the TAG constant, which improves consistency and maintainability. This change aligns with good coding practices.

val surfaceCoords = it.transform()
Log.d(
"TAG",
TAG,
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 the change to use the TAG constant is an improvement for consistency, the presence of this Log.d statement itself should be scrutinized 1. The repository's guidelines suggest that Log.d calls are often remnants of debugging and should be removed before merging unless they provide essential, long-term value. Please consider if this log statement is necessary for the long-term operation of the application.

Style Guide References

Footnotes

  1. Scrutinize Debug Logs: Question the use of Log.d, Log.v, and especially println(). These are often remnants of debugging and should be removed before merging unless they provide essential, long-term value.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @helpingstar, 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 enhances code consistency and maintainability by standardizing the log tag used in a specific logging statement. By replacing a hardcoded string with a constant, it ensures that log messages originating from the tap-to-focus feature are uniformly tagged, making log filtering and debugging more reliable.

Highlights

  • Log Tag Consistency: Replaced a hardcoded string literal 'TAG' with a predefined TAG constant in a log statement.
  • Tap-to-Focus Logging: The change specifically targets a Log.d call within the tap-to-focus functionality of the PreviewDisplay function.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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 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. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

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 correctly replaces a hardcoded log tag with the TAG constant, which is a good improvement. I've also identified a related issue in the log message formatting and provided a suggestion to fix it. This will ensure the log output is correct and also makes the code more idiomatic.

Comment on lines 471 to 475
Log.d(
"TAG",
TAG,
"onTapToFocus: " +
"input{$it} -> surface{$surfaceCoords}"
)
Copy link
Contributor

Choose a reason for hiding this comment

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

high

While you're fixing the log tag, there's an opportunity to improve the log message itself. The current string concatenation will not interpolate the variables it and surfaceCoords, which means the log will not contain the expected values. Using a Kotlin template string will fix this bug and make the code more concise and readable.1

                                        Log.d(
                                            TAG,
                                            "onTapToFocus: input{$it} -> surface{$surfaceCoords}"
                                        )

Style Guide References

Footnotes

  1. The style guide recommends simplifying complex logic into more concise and readable idiomatic expressions. Using a template string instead of string concatenation is a good example of this.

Copy link
Collaborator

@temcguir temcguir left a comment

Choose a reason for hiding this comment

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

Thanks for the catch on this.

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.

2 participants