Ido Flax
12/15/2023, 5:45 PMIdo Flax
12/28/2023, 12:25 AMheec.choi
01/03/2024, 10:04 AMVinu Polly
01/31/2024, 3:29 PMJan Bína
02/10/2024, 2:49 PMTextStyle
is of type ColorProvider
and the factory function to create ColorProvider
from resource is restricted to the library and says
Returns a [ColorProvider] that resolves to the color resource. This should not be used outside of the Glance Libraries due to inconsistencies with regards to what process (app vs launcher) colors are resolved inThat's also the case with
colorFilter
for Image
, color of CircularProgressIndicator
and probably more.
On the other hand, there's a .background
modifier that accepts color resource and is working just fine.
I tried to overcome this by using RemoteViews
directly, so for example I can set the color of Text like this:
AndroidRemoteViews(
remoteViews = RemoteViews(context.packageName, R.layout.widget_textview).apply {
setTextViewText(R.id.text, text)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
setTextViewTextColorResource(R.id.text, colorRes)
} else {
setTextColor(R.id.text, LocalContext.current.getColor(colorRes))
}
},
)
and this seems to be working fine too. After all, the glance theme's dynamic colors are also created from resources...
So, what's the reason for that restriction of ColorProvider
? And can my approach with remote views cause troubles in some cases (not resolving to correct color)?Md Sohail
02/19/2024, 11:55 AMBirgit L
03/15/2024, 3:16 PMglance-experimental-tools
for getting a preview for your app widget? I've tried appwidget-host
as well as appwidget-viewer
but didn't have success with either method. Is this still the way to do glance previews or is there a newer method out there? My widget is done, so technically I don't need previews any more but I would have liked to use the preview image export.Farhazul Mullick
04/13/2024, 9:53 AMhorizontalArrangement
is not provided in compose.glance.layout.Row
?Farhazul Mullick
04/13/2024, 4:56 PMArrangement. SpaceBetween
tony-choi
04/17/2024, 9:37 AMHristijan
04/25/2024, 11:58 AMheec.choi
04/29/2024, 5:36 AMNthily
04/29/2024, 2:24 PMinitialLayout
and not show the custom interface i've written.
also, I've tried upgrading other repos that use glance to i 1.0.0 and they all have this issue and include this:
https://github.com/android/user-interface-samples/tree/main/AppWidgetRihards
05/14/2024, 8:33 AMandroid:previewImage
to display the preview.Rihards
05/17/2024, 8:09 AMdoWork
function for the CoroutineWorker
to fetch data for the widget. Any idea of what could be the reason? 😕 I’m using very similar logic as in this sample, but it’s not working for me.Hristijan
05/17/2024, 7:32 PMRihards
05/20/2024, 1:22 PMandroidx.glance.session.SessionWorker
inside the WorkerFactory
of CoroutineWorker
? I have to use the factory due to dependency injection, but now it seems quite confusing.Nizam
05/24/2024, 8:53 AMNizam
05/27/2024, 4:21 PMOsanosa
07/27/2024, 4:51 PMOsanosa
07/27/2024, 5:12 PMNizam
07/28/2024, 2:54 AMLukáš Kúšik
10/04/2024, 9:02 AMBoxWithConstraints
or a hack with RemoteViews that would expose a measurement.Lukáš Kúšik
10/15/2024, 9:10 AMMantas Varnagiris
10/21/2024, 2:56 PMLazyColumn
but it seems like it composes ALL items in the list regardless if they are visible or not. Effectively behaving like Column
with scrollNizam
10/22/2024, 12:31 PMNathan79c
04/10/2025, 5:23 PMbbade_
04/28/2025, 5:49 PMPablo
05/12/2025, 1:07 PMPablo
05/12/2025, 1:55 PMprovideContent {
GlanceTheme(
// Using colors from app theme
colors = ColorProviders(light = lightScheme,dark = darkScheme)
) {
MyContent()
}
}
is ignoring primary and onPrimary, for example I need to do this to force white text in my texts:
Text(style = TextStyle(color = GlanceTheme.colors.onPrimary))
is this normal? to be mandatory to set manually every color of the theme in every composable used in glance?