Skip to content
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

AmbientAware isAlwaysOnScreen flag #1679

Merged
merged 4 commits into from
Sep 14, 2023
Merged

AmbientAware isAlwaysOnScreen flag #1679

merged 4 commits into from
Sep 14, 2023

Conversation

garanj
Copy link
Collaborator

@garanj garanj commented Sep 14, 2023

WHAT

Adds support for selectively enabling or disabling always-on

WHY

Some screens will require always-on, but some will not, for example, a workout screen (yes) vs a workout summary screen (no).

HOW

AmbientAware now takes an optional parameter to specify whether the screen should enable always-on or not. This can be hoisted above the use of AmbientAware e.g.

AmbientAware(isAlwaysOnScreen == currentScreen.useAlwaysOn) { ambientStateUpdate ->

// ...

}

Checklist 📋

  • Add explicit visibility modifier and explicit return types for public declarations
  • Run spotless check
  • Run tests
  • Update metalava's signature text files

This is useful if different screens in the app may need or not need this behaviour, for example a workout screen vs an end-of-workout summary.
This is useful if different screens in the app may need or not need this behaviour, for example a workout screen vs an end-of-workout summary.
@garanj garanj requested a review from yschimke September 14, 2023 18:30
@yschimke yschimke changed the title Ambient 3 AmbientAware isAlwaysOnScreen flag Sep 14, 2023
Copy link
Collaborator

@yschimke yschimke left a comment

Choose a reason for hiding this comment

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

Really elegant approach. Nice!

@yschimke yschimke merged commit 9566d20 into main Sep 14, 2023
@yschimke yschimke deleted the ambient-3 branch September 14, 2023 19:04
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