Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@kasem-sm
Last active May 30, 2022 13:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kasem-sm/1bda51d4830dd6f5b1e9442aba5050ec to your computer and use it in GitHub Desktop.
Save kasem-sm/1bda51d4830dd6f5b1e9442aba5050ec to your computer and use it in GitHub Desktop.
When Jetpack's Glance met his fellow worker, Work Manager
import androidx.glance.GlanceModifier
import androidx.glance.appwidget.GlanceAppWidget
import androidx.glance.layout.Column
class MyWidget() : GlanceAppWidget() {
@Composable
override fun Content() {
Column(
modifier = GlanceModifier
.fillMaxSize()
.background(R.color.widget_background_color),
) {
Text(
text = "Daily Read", // Header
style = TextStyle(
color = ColorProvider(R.color.widget_text_color),
fontSize = 22.sp,
fontWeight = FontWeight.Bold
)
)
Text(
text = "Article Title goes here...",
style = TextStyle(
color = ColorProvider(R.color.widget_text_color),
fontSize = 16.sp,
fontWeight = FontWeight.Normal
)
)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment