-
Notifications
You must be signed in to change notification settings - Fork 97
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
Expands documentation for AmbientAware, adds support for AmbientDetails #1674
Conversation
} | ||
|
||
override fun onUpdateAmbient() { | ||
ambientUpdate = AmbientStateUpdate(AmbientState.AMBIENT) | ||
ambientUpdate = AmbientStateUpdate(AmbientState.Ambient()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we retain the previous value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I wondered about that, do these things change? I will add it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's about them changing, I think more about having immediate access to it via this type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added. Unfortunately, there still remains the chance of it being null, if the device is already in ambient, so onEnterAmbient
has not been called. I don't think this seems very likely in practice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure, we should test. If it's the case we should push it up to the Activity, out of the composition?
Or accept it can be null?
@yschimke - modified to remove the need for the extra field for the last ambient details. |
compose-layout/src/main/java/com/google/android/horologist/compose/ambient/AmbientAware.kt
Outdated
Show resolved
Hide resolved
…pose/ambient/AmbientAware.kt Co-authored-by: Yuri Schimke <yuri@schimke.ee>
WHAT
Provides further guidance on using
AmbientAware
and adds support forAmbientDetails
WHY
Using the
AmbientAware
composable changes the behavior of theActivity
, so should ideally be used high up in the composable tree. This needs clarifying in the documentation.AmbientDetails
are provided by the system when entering ambient mode, and can be used by the app to make decisions about how to render the UI.HOW
Updates kdoc and adds
AmbientDetails
as a property of theAmbient
state.Checklist 📋