Fixed
Status Update
Comments
pb...@google.com <pb...@google.com> #2
I would guess then a method to get the color that would be applied in a given context? Would something like this be appropriate?
/* Returns the color the provider would use in the given context. */
fun ColorProvider.resolve(context: Context): Color
to...@gmail.com <to...@gmail.com> #3
Yes that what I tried to implement myself but was blocked by the internal DayNightColorProvider preventing casting and calling resolve on it.
za...@google.com <za...@google.com> #4
Willie to look if there is an easy way to expose the provider.
ap...@google.com <ap...@google.com> #5
Project: platform/frameworks/support
Branch: androidx-main
commit 025ca1611036a7ca409b6cf951b1a31ca0ebadc9
Author: Willie Koomson <wvk@google.com>
Date: Mon Mar 14 19:36:00 2022
Add ColorProvider.resolve()
This change adds a resolve() function to the ColorProvider interface,
which returns what color the provider will use in the given context.
Bug: 214733442
Test: ColorProviderTest
Relnote: Add ColorProvider.resolve()
Change-Id: Ife532c3a9d5093c727a979e56847915fe36a83ca
M glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/unit/ColorProviderTest.kt
M glance/glance-appwidget/src/test/res/values/colors.xml
M glance/glance/src/androidMain/kotlin/androidx/glance/unit/ColorProvider.kt
M glance/glance-wear-tiles/src/androidMain/kotlin/androidx/glance/wear/tiles/WearCompositionTranslator.kt
M glance/glance/api/current.txt
M glance/glance/api/public_plus_experimental_current.txt
M glance/glance-appwidget/src/androidMain/kotlin/androidx/glance/appwidget/translators/TextTranslator.kt
M glance/glance/api/restricted_current.txt
M glance/glance-appwidget/src/androidMain/kotlin/androidx/glance/appwidget/unit/ColorProvider.kt
https://android-review.googlesource.com/2025248
Branch: androidx-main
commit 025ca1611036a7ca409b6cf951b1a31ca0ebadc9
Author: Willie Koomson <wvk@google.com>
Date: Mon Mar 14 19:36:00 2022
Add ColorProvider.resolve()
This change adds a resolve() function to the ColorProvider interface,
which returns what color the provider will use in the given context.
Bug: 214733442
Test: ColorProviderTest
Relnote: Add ColorProvider.resolve()
Change-Id: Ife532c3a9d5093c727a979e56847915fe36a83ca
M glance/glance-appwidget/src/test/kotlin/androidx/glance/appwidget/unit/ColorProviderTest.kt
M glance/glance-appwidget/src/test/res/values/colors.xml
M glance/glance/src/androidMain/kotlin/androidx/glance/unit/ColorProvider.kt
M glance/glance-wear-tiles/src/androidMain/kotlin/androidx/glance/wear/tiles/WearCompositionTranslator.kt
M glance/glance/api/current.txt
M glance/glance/api/public_plus_experimental_current.txt
M glance/glance-appwidget/src/androidMain/kotlin/androidx/glance/appwidget/translators/TextTranslator.kt
M glance/glance/api/restricted_current.txt
M glance/glance-appwidget/src/androidMain/kotlin/androidx/glance/appwidget/unit/ColorProvider.kt
Description
Component used: glance-appwidget Version used: 1.0 alpha1
It would be nice to be able to manually resolve ColorProvider to avoid code duplication. It's currently not possible as the DayNight provider is internal.
This is useful to modify the colors to add alpha (like disabled status) or manually apply tint since the API does not yet support it.