diff --git a/README.md b/README.md index 9e6ff7a8b..d4404bfd7 100644 --- a/README.md +++ b/README.md @@ -6,21 +6,26 @@ Accompanist is a labs like environment for new Compose APIs. We use it to help f ## Compose versions -Each [release](https://github.com/google/accompanist/releases) outlines what version of the Compose libraries it depends on. We are currently releasing multiple versions of Accompanist for the different versions of Compose: +Each [release](https://github.com/google/accompanist/releases) outlines what version of the Compose UI libraries it depends on. We are currently releasing multiple versions of Accompanist for the different versions of Compose: - + - + - + + + +
Compose 1.0 (1.0.x)Maven CentralCompose 1.0 (1.0.x)Maven Central
Compose 1.1 (1.1.x)Maven CentralCompose 1.1 (1.1.x)Maven Central
Compose 1.2 (1.2.x)Maven CentralCompose UI 1.2 (1.2.x)Maven Central
Compose UI 1.3 (1.3.x)Maven Central
-> :warning: **Ensure you are using the Accompanist version that matches with your Compose version**: If you upgrade Accompanist, it will upgrade your Compose version via transitive dependencies. +For stable versions of Compose, we use the latest *stable* version of the Compose compiler. For non-stable versions (alpha, beta, etc), we use the latest compiler at the time of release. + +> :warning: **Ensure you are using the Accompanist version that matches with your Compose UI version**: If you upgrade Accompanist, it will upgrade your Compose libraries version via transitive dependencies. ## Libraries diff --git a/build.gradle b/build.gradle index fb4365e16..dc661879c 100644 --- a/build.gradle +++ b/build.gradle @@ -36,7 +36,7 @@ buildscript { } plugins { - id "com.diffplug.spotless" version "5.9.0" + id "com.diffplug.spotless" version "6.5.2" } apply plugin: 'org.jetbrains.dokka' @@ -86,6 +86,7 @@ allprojects { subprojects { apply plugin: 'com.diffplug.spotless' + spotless { kotlin { target "**/*.kt" @@ -117,13 +118,6 @@ subprojects { && details.requested.version.contains('jre')) { details.useVersion details.requested.version.replace('jre', 'android') } - - // FIXME: The AndroidX snapshots are currently in a weird state where they depend - // on 1.0.1 which isn't yet public. Remove this once 1.0.1 is out. - if (details.requested.group.startsWith('androidx.compose') - && details.requested.version == '1.0.1') { - details.useVersion libs.versions.compose.get() - } } } diff --git a/flowlayout/src/sharedTest/kotlin/com/google/accompanist/flowlayout/FlowLayoutTest.kt b/flowlayout/src/sharedTest/kotlin/com/google/accompanist/flowlayout/FlowLayoutTest.kt index 8d5251f8a..784d1da60 100644 --- a/flowlayout/src/sharedTest/kotlin/com/google/accompanist/flowlayout/FlowLayoutTest.kt +++ b/flowlayout/src/sharedTest/kotlin/com/google/accompanist/flowlayout/FlowLayoutTest.kt @@ -34,7 +34,7 @@ import java.util.concurrent.TimeUnit import kotlin.math.roundToInt @RunWith(AndroidJUnit4::class) -class FlowTest : LayoutTest() { +class FlowLayoutTest : LayoutTest() { @Test fun testFlowRow() { val numberOfSquares = 15 diff --git a/gradle.properties b/gradle.properties index d4f8a2551..8d8408755 100644 --- a/gradle.properties +++ b/gradle.properties @@ -33,7 +33,7 @@ systemProp.org.gradle.internal.http.socketTimeout=120000 GROUP=com.google.accompanist # !! No longer need to update this manually when using a Compose SNAPSHOT -VERSION_NAME=0.25.1-SNAPSHOT +VERSION_NAME=0.26.0-alpha POM_DESCRIPTION=Utilities for Jetpack Compose diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 2c9464cfe..2c0fe71f5 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,14 +1,15 @@ [versions] -compose = "1.2.0" -composeCompiler = "1.2.0" + +compose = "1.3.0-alpha02" +composeCompiler = "1.3.0-rc01" composesnapshot = "-" # a single character = no snapshot # gradlePlugin and lint need to be updated together gradlePlugin = "7.3.0-beta05" lintMinCompose = "30.0.0" -ktlint = "0.42.1" -kotlin = "1.7.0" +ktlint = "0.45.2" +kotlin = "1.7.10" coroutines = "1.6.0" okhttp = "3.12.13" coil = "1.3.2" @@ -55,13 +56,13 @@ coil-coil = { module = "io.coil-kt:coil", version.ref = "coil" } coil-gif = { module = "io.coil-kt:coil-gif", version.ref = "coil" } coil-compose = { module = "io.coil-kt:coil-compose", version.ref = "coil" } -androidx-appcompat = "androidx.appcompat:appcompat:1.4.1" -androidx-core = "androidx.core:core-ktx:1.8.0-alpha06" -androidx-activity-compose = "androidx.activity:activity-compose:1.5.0-rc01" -androidx-fragment = "androidx.fragment:fragment-ktx:1.4.0" +androidx-appcompat = "androidx.appcompat:appcompat:1.4.2" +androidx-core = "androidx.core:core-ktx:1.8.0" +androidx-activity-compose = "androidx.activity:activity-compose:1.5.1" +androidx-fragment = "androidx.fragment:fragment-ktx:1.5.1" androidx-dynamicanimation = "androidx.dynamicanimation:dynamicanimation-ktx:1.0.0-alpha03" -androidx-lifecycle-runtime = "androidx.lifecycle:lifecycle-runtime-ktx:2.4.0" -androidx-lifecycle-viewmodel-compose = "androidx.lifecycle:lifecycle-viewmodel-compose:2.4.0" +androidx-lifecycle-runtime = "androidx.lifecycle:lifecycle-runtime-ktx:2.5.1" +androidx-lifecycle-viewmodel-compose = "androidx.lifecycle:lifecycle-viewmodel-compose:2.5.1" androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "androidxnavigation" } androidx-navigation-testing = { module = "androidx.navigation:navigation-testing", version.ref = "androidxnavigation" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index aa991fcea..8049c684f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/insets/src/main/java/com/google/accompanist/insets/WindowInsets.kt b/insets/src/main/java/com/google/accompanist/insets/WindowInsets.kt index 03ff3dbbc..5a2351163 100644 --- a/insets/src/main/java/com/google/accompanist/insets/WindowInsets.kt +++ b/insets/src/main/java/com/google/accompanist/insets/WindowInsets.kt @@ -24,6 +24,7 @@ import androidx.annotation.FloatRange import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.DisposableEffect +import androidx.compose.runtime.ProvidableCompositionLocal import androidx.compose.runtime.Stable import androidx.compose.runtime.remember import androidx.compose.runtime.staticCompositionLocalOf @@ -549,4 +550,5 @@ The androidx.compose equivalent of LocalWindowInsets is the extensions on Window For more migration information, please visit https://google.github.io/accompanist/insets/#migration """ ) -val LocalWindowInsets = staticCompositionLocalOf { WindowInsets.Empty } +val LocalWindowInsets: ProvidableCompositionLocal = + staticCompositionLocalOf { WindowInsets.Empty } diff --git a/navigation-animation/src/main/java/com/google/accompanist/navigation/animation/AnimatedNavHost.kt b/navigation-animation/src/main/java/com/google/accompanist/navigation/animation/AnimatedNavHost.kt index 9a0a85e69..e096fbd34 100644 --- a/navigation-animation/src/main/java/com/google/accompanist/navigation/animation/AnimatedNavHost.kt +++ b/navigation-animation/src/main/java/com/google/accompanist/navigation/animation/AnimatedNavHost.kt @@ -154,8 +154,7 @@ public fun AnimatedNavHost( ) as? AnimatedComposeNavigator ?: return val visibleEntries by remember(navController.visibleEntries) { navController.visibleEntries.map { - it.filter { - entry -> + it.filter { entry -> entry.destination.navigatorName == AnimatedComposeNavigator.NAME } } diff --git a/settings.gradle b/settings.gradle index a753c34ad..017fefa3b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -15,7 +15,7 @@ */ plugins { - id 'com.gradle.enterprise' version '3.10.1' + id 'com.gradle.enterprise' version '3.10.3' } gradleEnterprise { @@ -43,8 +43,3 @@ include ':systemuicontroller' include ':swiperefresh' include ':sample' include ':web' - -// Enable Gradle's version catalog support -// https://docs.gradle.org/current/userguide/platforms.html -enableFeaturePreview("VERSION_CATALOGS") - diff --git a/web/src/main/java/com/google/accompanist/web/WebView.kt b/web/src/main/java/com/google/accompanist/web/WebView.kt index e89ff1252..55f46fcae 100644 --- a/web/src/main/java/com/google/accompanist/web/WebView.kt +++ b/web/src/main/java/com/google/accompanist/web/WebView.kt @@ -36,6 +36,7 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.rememberUpdatedState import androidx.compose.runtime.setValue +import androidx.compose.runtime.snapshots.SnapshotStateList import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalInspectionMode import androidx.compose.ui.viewinterop.AndroidView @@ -293,7 +294,7 @@ class WebViewState(webContent: WebContent) { /** * The content being loaded by the WebView */ - var content by mutableStateOf(webContent) + var content: WebContent by mutableStateOf(webContent) /** * Whether the WebView is currently [LoadingState.Loading] data in its main frame (along with @@ -325,7 +326,7 @@ class WebViewState(webContent: WebContent) { * Errors could be from any resource (iframe, image, etc.), not just for the main page. * For more fine grained control use the OnError callback of the WebView. */ - val errorsForCurrentRequest = mutableStateListOf() + val errorsForCurrentRequest: SnapshotStateList = mutableStateListOf() } /** @@ -401,7 +402,7 @@ class WebViewNavigator(private val coroutineScope: CoroutineScope) { @Composable fun rememberWebViewNavigator( coroutineScope: CoroutineScope = rememberCoroutineScope() -) = remember(coroutineScope) { WebViewNavigator(coroutineScope) } +): WebViewNavigator = remember(coroutineScope) { WebViewNavigator(coroutineScope) } /** * A wrapper class to hold errors from the WebView. @@ -426,7 +427,7 @@ data class WebViewError( * Note that these headers are used for all subsequent requests of the WebView. */ @Composable -fun rememberWebViewState(url: String, additionalHttpHeaders: Map = emptyMap()) = +fun rememberWebViewState(url: String, additionalHttpHeaders: Map = emptyMap()): WebViewState = // Rather than using .apply {} here we will recreate the state, this prevents // a recomposition loop when the webview updates the url itself. remember(url, additionalHttpHeaders) { @@ -444,7 +445,7 @@ fun rememberWebViewState(url: String, additionalHttpHeaders: Map * @param data The uri to load in the WebView */ @Composable -fun rememberWebViewStateWithHTMLData(data: String, baseUrl: String? = null) = +fun rememberWebViewStateWithHTMLData(data: String, baseUrl: String? = null): WebViewState = remember(data, baseUrl) { WebViewState(WebContent.Data(data, baseUrl)) }