Update ExerciseScreen to work better in ambient mode#327
Update ExerciseScreen to work better in ambient mode#327ithinkihaveacat merged 8 commits intoandroid:mainfrom
Conversation
There was a problem hiding this comment.
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
LocalAmbientStatefrom the Horologist Compose Ambient library. - Modified
formatElapsedTimefunction to display "--" instead of seconds when in ambient mode. Specifically, line 52 now checksLocalAmbientState.current.isInteractive.
- Imported
- health-services/ExerciseSampleCompose/app/src/main/java/com/example/exercisesamplecompose/presentation/component/HRText.kt
- Imported
LocalAmbientStatefrom the Horologist Compose Ambient library. - Modified
HRTextcomposable to display "--" instead of the heart rate value when in ambient mode. Specifically, line 41 now checksLocalAmbientState.current.isInteractiveand if hr is not null.
- Imported
- health-services/ExerciseSampleCompose/app/src/main/java/com/example/exercisesamplecompose/presentation/exercise/ExerciseScreen.kt
- Removed the
ambientStateparameter from theExerciseScreencomposable function definition (lines 126, 127). - Removed the
ambientBlankmodifier from theBoxsurrounding thePagerScreen(lines 139, 140). - Removed the
ambientStateparameter from theExerciseScreenpreview (line 317).
- Removed the
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
-
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
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.
|
Closing until API 36 emulators/devices are readily available. |
| */ | ||
| package com.example.exercisesamplecompose.presentation.component | ||
|
|
||
| import android.R.attr.fontWeight |
Previously, we blanked out most of the screen:
Now, we display a simplified metrics screen, with "--" replacing the values that are usually frequently updated: