From 50149b557c94bd00e2391b030fe3ccf0a67bfc3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=CC=81=20Carvalho?= Date: Tue, 19 Dec 2023 10:12:50 +0100 Subject: [PATCH] Bump Glance to version 1.0.0 and Lifecycle to version 2.6.2 + adds MaterialComponents dependency --- app/build.gradle.kts | 1 + .../java/pt/andre/widgetcandy/widget/CandyWidget.kt | 10 +++++++--- buildSrc/src/main/kotlin/Libraries.kt | 2 ++ buildSrc/src/main/kotlin/Versions.kt | 5 +++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 4fa7e2b..505329f 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -86,6 +86,7 @@ dependencies { implementation(Libraries.Compose.Lifecycle) implementation(Libraries.Hilt.Core) implementation(Libraries.Hilt.Navigation) + implementation(Libraries.MaterialComponents) kapt(Libraries.Hilt.Compiler) diff --git a/app/src/main/java/pt/andre/widgetcandy/widget/CandyWidget.kt b/app/src/main/java/pt/andre/widgetcandy/widget/CandyWidget.kt index d4a7787..ea5a25b 100644 --- a/app/src/main/java/pt/andre/widgetcandy/widget/CandyWidget.kt +++ b/app/src/main/java/pt/andre/widgetcandy/widget/CandyWidget.kt @@ -1,15 +1,19 @@ package pt.andre.widgetcandy.widget +import android.content.Context import androidx.compose.runtime.Composable +import androidx.glance.GlanceId import androidx.glance.appwidget.GlanceAppWidget +import androidx.glance.appwidget.provideContent import androidx.glance.state.PreferencesGlanceStateDefinition import androidx.glance.text.Text internal class CandyWidget : GlanceAppWidget() { - @Composable - override fun Content() { - Text(text = "Hello World!") + override suspend fun provideGlance(context: Context, id: GlanceId) { + provideContent { + Text(text = "Hello World!") + } } override val stateDefinition = PreferencesGlanceStateDefinition diff --git a/buildSrc/src/main/kotlin/Libraries.kt b/buildSrc/src/main/kotlin/Libraries.kt index 901bf59..214ad9d 100644 --- a/buildSrc/src/main/kotlin/Libraries.kt +++ b/buildSrc/src/main/kotlin/Libraries.kt @@ -39,6 +39,8 @@ object Libraries { const val JUnit = "junit:junit:${Versions.JUnit.MAIN}" + const val MaterialComponents = "com.google.android.material:material:${Versions.MATERIAL_COMPONENTS}" + object Kotlin { const val Coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.Kotlin.COROUTINES}" diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index d3bf4ac..e10a52b 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -6,8 +6,8 @@ object Versions { const val ACTIVITY = "1.8.2" const val CORE = "1.12.0" const val DATASTORE = "1.0.0" - const val LIFECYCLE = "2.6.1" - const val GLANCE = "1.0.0-alpha05" + const val LIFECYCLE = "2.6.2" + const val GLANCE = "1.0.0" } object Accompanist { @@ -24,6 +24,7 @@ object Versions { } const val COIL = "2.2.2" + const val MATERIAL_COMPONENTS = "1.11.0" object Compose { const val HILT = "1.1.0"