Skip to content

Comments

Update ExerciseScreen to work better in ambient mode#327

Merged
ithinkihaveacat merged 8 commits intoandroid:mainfrom
ithinkihaveacat:ambient-updates
Jun 20, 2025
Merged

Update ExerciseScreen to work better in ambient mode#327
ithinkihaveacat merged 8 commits intoandroid:mainfrom
ithinkihaveacat:ambient-updates

Conversation

@ithinkihaveacat
Copy link
Contributor

Previously, we blanked out most of the screen:

adb-screenshot-20250508223358

Now, we display a simplified metrics screen, with "--" replacing the values that are usually frequently updated:

adb-screenshot-20250508222916

@ithinkihaveacat ithinkihaveacat requested a review from yschimke May 8, 2025 22:37
Copy link

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

Hello @ithinkihaveacat, 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!

Summary of Changes

This pull request updates the ExerciseScreen to improve its behavior in ambient mode on Wear OS devices. Previously, the screen was mostly blanked out in ambient mode. Now, it displays a simplified metrics screen with "--" replacing frequently updated values. This change enhances the user experience by providing some information even when the device is in a low-power state.

Highlights

  • Ambient Mode Enhancement: The ExerciseScreen now displays a simplified metrics view in ambient mode instead of blanking out.
  • Value Masking: Frequently updated values are replaced with "--" in ambient mode to conserve power and reduce screen updates.
  • Horologist Library Integration: The pull request utilizes the Horologist Compose Ambient library to detect and respond to ambient mode changes.

Changelog

  • health-services/ExerciseSampleCompose/app/src/main/java/com/example/exercisesamplecompose/presentation/component/FormattingUtils.kt
    • Imported LocalAmbientState from the Horologist Compose Ambient library.
    • Modified formatElapsedTime function to display "--" instead of seconds when in ambient mode. Specifically, line 52 now checks LocalAmbientState.current.isInteractive.
  • health-services/ExerciseSampleCompose/app/src/main/java/com/example/exercisesamplecompose/presentation/component/HRText.kt
    • Imported LocalAmbientState from the Horologist Compose Ambient library.
    • Modified HRText composable to display "--" instead of the heart rate value when in ambient mode. Specifically, line 41 now checks LocalAmbientState.current.isInteractive and if hr is not null.
  • health-services/ExerciseSampleCompose/app/src/main/java/com/example/exercisesamplecompose/presentation/exercise/ExerciseScreen.kt
    • Removed the ambientState parameter from the ExerciseScreen composable function definition (lines 126, 127).
    • Removed the ambientBlank modifier from the Box surrounding the PagerScreen (lines 139, 140).
    • Removed the ambientState parameter from the ExerciseScreen preview (line 317).
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.


In ambient's gentle state,
Metrics soften, update's wait,
Dashes fill the space,
A simpler, calmer face,
Power saved, a mindful trait.

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

@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 updates the ExerciseScreen to work better in ambient mode by displaying a simplified metrics screen with "--" replacing frequently updated values. This improves the user experience in ambient mode. The changes look good overall.

Merge Readiness

The pull request appears to be in good shape for merging. The changes are well-explained and address the issue of displaying information in ambient mode effectively. I am unable to directly approve the pull request, and recommend that others review and approve this code before merging.

@ithinkihaveacat
Copy link
Contributor Author

Closing until API 36 emulators/devices are readily available.

*/
package com.example.exercisesamplecompose.presentation.component

import android.R.attr.fontWeight
Copy link
Contributor

Choose a reason for hiding this comment

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

needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

@ithinkihaveacat ithinkihaveacat merged commit 03d896f into android:main Jun 20, 2025
5 checks passed
@ithinkihaveacat ithinkihaveacat deleted the ambient-updates branch June 20, 2025 13:15
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