diff --git a/bluetoothle/src/main/java/com/sample/android/bluetoothle/kotlin/MainActivity.kt b/bluetoothle/src/main/java/com/sample/android/bluetoothle/kotlin/MainActivity.kt index c79aae13..5555c720 100644 --- a/bluetoothle/src/main/java/com/sample/android/bluetoothle/kotlin/MainActivity.kt +++ b/bluetoothle/src/main/java/com/sample/android/bluetoothle/kotlin/MainActivity.kt @@ -6,7 +6,6 @@ import android.content.Context import android.content.Intent import android.os.Bundle import androidx.appcompat.app.AppCompatActivity -import com.sample.android.bluetoothle.java.MainActivity class MainActivity : AppCompatActivity() { diff --git a/build.gradle.kts b/build.gradle.kts index fe9431c4..22d9028a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,6 +8,7 @@ plugins { alias(libs.plugins.kapt) apply false alias(libs.plugins.hilt) apply false alias(libs.plugins.kotlin.parcelize) apply false + alias(libs.plugins.compose.compiler) apply false alias(libs.plugins.kotlin.serialization) apply false } diff --git a/compose/recomposehighlighter/build.gradle.kts b/compose/recomposehighlighter/build.gradle.kts index 1bbdf6ea..fe8b79af 100644 --- a/compose/recomposehighlighter/build.gradle.kts +++ b/compose/recomposehighlighter/build.gradle.kts @@ -1,6 +1,7 @@ plugins { alias(libs.plugins.android.application) alias(libs.plugins.kotlin.android) + alias(libs.plugins.compose.compiler) } android { compileSdk = libs.versions.compileSdk.get().toInt() @@ -40,9 +41,6 @@ android { viewBinding = true } - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get() - } } dependencies { val composeBom = platform(libs.androidx.compose.bom) diff --git a/compose/snippets/build.gradle.kts b/compose/snippets/build.gradle.kts index a43a6f22..5d2b661f 100644 --- a/compose/snippets/build.gradle.kts +++ b/compose/snippets/build.gradle.kts @@ -20,6 +20,7 @@ plugins { alias(libs.plugins.kapt) alias(libs.plugins.hilt) alias(libs.plugins.kotlin.parcelize) + alias(libs.plugins.compose.compiler) alias(libs.plugins.kotlin.serialization) } @@ -63,10 +64,6 @@ android { viewBinding = true } - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get() - } - packaging.resources { // Multiple dependency bring these files in. Exclude them to enable // our test APK to build (has no effect on our AARs) diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/SnippetsActivity.kt b/compose/snippets/src/main/java/com/example/compose/snippets/SnippetsActivity.kt index 918de992..de8150f0 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/SnippetsActivity.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/SnippetsActivity.kt @@ -32,6 +32,7 @@ import com.example.compose.snippets.animations.sharedelement.PlaceholderSizeAnim import com.example.compose.snippets.components.AppBarExamples import com.example.compose.snippets.components.BadgeExamples import com.example.compose.snippets.components.ButtonExamples +import com.example.compose.snippets.components.CardExamples import com.example.compose.snippets.components.CheckboxExamples import com.example.compose.snippets.components.ChipExamples import com.example.compose.snippets.components.ComponentsScreen @@ -52,7 +53,6 @@ import com.example.compose.snippets.landing.LandingScreen import com.example.compose.snippets.navigation.Destination import com.example.compose.snippets.navigation.TopComponentsDestination import com.example.compose.snippets.ui.theme.SnippetsTheme -import com.example.topcomponents.CardExamples class SnippetsActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/adaptivelayouts/SampleListDetailPaneScaffold.kt b/compose/snippets/src/main/java/com/example/compose/snippets/adaptivelayouts/SampleListDetailPaneScaffold.kt index 68c14dfd..b79f7ee7 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/adaptivelayouts/SampleListDetailPaneScaffold.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/adaptivelayouts/SampleListDetailPaneScaffold.kt @@ -35,8 +35,6 @@ import androidx.compose.material3.adaptive.layout.ListDetailPaneScaffold import androidx.compose.material3.adaptive.layout.ListDetailPaneScaffoldRole import androidx.compose.material3.adaptive.navigation.rememberListDetailPaneScaffoldNavigator import androidx.compose.runtime.Composable -import androidx.compose.runtime.getValue -import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.tooling.preview.Preview diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/adaptivelayouts/SampleNavigationSuiteScaffold.kt b/compose/snippets/src/main/java/com/example/compose/snippets/adaptivelayouts/SampleNavigationSuiteScaffold.kt index f5c461f6..76006e68 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/adaptivelayouts/SampleNavigationSuiteScaffold.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/adaptivelayouts/SampleNavigationSuiteScaffold.kt @@ -14,8 +14,6 @@ * limitations under the License. */ -@file:OptIn(ExperimentalMaterial3AdaptiveNavigationSuiteApi::class) - package com.example.compose.snippets.adaptivelayouts import androidx.annotation.StringRes @@ -29,7 +27,6 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.material3.NavigationBarItemDefaults import androidx.compose.material3.Text import androidx.compose.material3.adaptive.currentWindowAdaptiveInfo -import androidx.compose.material3.adaptive.navigationsuite.ExperimentalMaterial3AdaptiveNavigationSuiteApi import androidx.compose.material3.adaptive.navigationsuite.NavigationSuiteDefaults import androidx.compose.material3.adaptive.navigationsuite.NavigationSuiteScaffold import androidx.compose.material3.adaptive.navigationsuite.NavigationSuiteScaffoldDefaults diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/animations/AnimationQuickGuide.kt b/compose/snippets/src/main/java/com/example/compose/snippets/animations/AnimationQuickGuide.kt index 297f579a..7c649357 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/animations/AnimationQuickGuide.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/animations/AnimationQuickGuide.kt @@ -87,7 +87,6 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.drawBehind @@ -720,7 +719,6 @@ private fun LoadingScreen() { } } -@OptIn(ExperimentalComposeUiApi::class) @Preview @Composable fun AnimationLayout() { diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/animations/AnimationSnippets.kt b/compose/snippets/src/main/java/com/example/compose/snippets/animations/AnimationSnippets.kt index 80c53540..08c69981 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/animations/AnimationSnippets.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/animations/AnimationSnippets.kt @@ -50,6 +50,7 @@ import androidx.compose.animation.core.createChildTransition import androidx.compose.animation.core.infiniteRepeatable import androidx.compose.animation.core.keyframes import androidx.compose.animation.core.rememberInfiniteTransition +import androidx.compose.animation.core.rememberTransition import androidx.compose.animation.core.repeatable import androidx.compose.animation.core.snap import androidx.compose.animation.core.spring @@ -65,7 +66,7 @@ import androidx.compose.animation.graphics.vector.AnimatedImageVector import androidx.compose.animation.shrinkVertically import androidx.compose.animation.slideInVertically import androidx.compose.animation.slideOutVertically -import androidx.compose.animation.with +import androidx.compose.animation.togetherWith import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.Image import androidx.compose.foundation.background @@ -190,7 +191,6 @@ private fun AnimatedVisibilityMutable() { // [END android_compose_animations_animated_visibility_mutable] } -@OptIn(ExperimentalAnimationApi::class) @Composable @Preview private fun AnimatedVisibilityAnimateEnterExitChildren() { @@ -222,7 +222,6 @@ private fun AnimatedVisibilityAnimateEnterExitChildren() { // [END android_compose_animations_animated_visibility_animate_enter_exit_children] } -@OptIn(ExperimentalAnimationApi::class) @Preview @Composable private fun AnimatedVisibilityTransition() { @@ -259,7 +258,6 @@ private fun AnimateAsStateSimple() { // [END android_compose_animations_animate_as_state] } -@OptIn(ExperimentalAnimationApi::class) @Preview @Composable private fun AnimatedContentSimple() { @@ -277,7 +275,6 @@ private fun AnimatedContentSimple() { // [END android_compose_animations_animated_content_simple] } -@OptIn(ExperimentalAnimationApi::class) @Composable private fun AnimatedContentTransitionSpec(count: Int) { // [START android_compose_animations_animated_content_transition_spec] @@ -288,12 +285,12 @@ private fun AnimatedContentTransitionSpec(count: Int) { if (targetState > initialState) { // If the target number is larger, it slides up and fades in // while the initial (smaller) number slides up and fades out. - slideInVertically { height -> height } + fadeIn() with + slideInVertically { height -> height } + fadeIn() togetherWith slideOutVertically { height -> -height } + fadeOut() } else { // If the target number is smaller, it slides down and fades in // while the initial number slides down and fades out. - slideInVertically { height -> -height } + fadeIn() with + slideInVertically { height -> -height } + fadeIn() togetherWith slideOutVertically { height -> height } + fadeOut() }.using( // Disable clipping since the faded slide-in/out should @@ -318,7 +315,7 @@ private fun AnimatedContentSizeTransform() { AnimatedContent( targetState = expanded, transitionSpec = { - fadeIn(animationSpec = tween(150, 150)) with + fadeIn(animationSpec = tween(150, 150)) togetherWith fadeOut(animationSpec = tween(150)) using SizeTransform { initialSize, targetSize -> if (targetState) { @@ -431,7 +428,7 @@ private object UpdateTransitionEnumState { // Start in collapsed state and immediately animate to expanded var currentState = remember { MutableTransitionState(BoxState.Collapsed) } currentState.targetState = BoxState.Expanded - val transition = updateTransition(currentState, label = "box state") + val transition = rememberTransition(currentState, label = "box state") // …… // [END android_compose_animations_transitions_state] } @@ -663,8 +660,8 @@ private fun AnimationSpecKeyframe() { targetValue = 1f, animationSpec = keyframes { durationMillis = 375 - 0.0f at 0 with LinearOutSlowInEasing // for 0-15 ms - 0.2f at 15 with FastOutLinearInEasing // for 15-75 ms + 0.0f at 0 using LinearOutSlowInEasing // for 0-15 ms + 0.2f at 15 using FastOutLinearInEasing // for 15-75 ms 0.4f at 75 // ms 0.4f at 225 // ms } diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/animations/sharedelement/SharedElementsWithNavigationSnippets.kt b/compose/snippets/src/main/java/com/example/compose/snippets/animations/sharedelement/SharedElementsWithNavigationSnippets.kt index 42662f9b..da1d178f 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/animations/sharedelement/SharedElementsWithNavigationSnippets.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/animations/sharedelement/SharedElementsWithNavigationSnippets.kt @@ -118,7 +118,7 @@ private fun DetailsScreen( painterResource(id = snack.image), contentDescription = snack.description, contentScale = ContentScale.Crop, - modifier = Modifier.Companion + modifier = Modifier .sharedElement( sharedTransitionScope.rememberSharedContentState(key = "image-$id"), animatedVisibilityScope = animatedContentScope @@ -129,7 +129,7 @@ private fun DetailsScreen( Text( snack.name, fontSize = 18.sp, modifier = - Modifier.Companion + Modifier .sharedElement( sharedTransitionScope.rememberSharedContentState(key = "text-$id"), animatedVisibilityScope = animatedContentScope @@ -164,7 +164,7 @@ private fun HomeScreen( painterResource(id = item.image), contentDescription = item.description, contentScale = ContentScale.Crop, - modifier = Modifier.Companion + modifier = Modifier .sharedElement( sharedTransitionScope.rememberSharedContentState(key = "image-$index"), animatedVisibilityScope = animatedContentScope diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/architecture/ArchitectureSnippets.kt b/compose/snippets/src/main/java/com/example/compose/snippets/architecture/ArchitectureSnippets.kt index b22421ff..3f9f41c3 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/architecture/ArchitectureSnippets.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/architecture/ArchitectureSnippets.kt @@ -18,13 +18,14 @@ package com.example.compose.snippets.architecture import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.wrapContentSize -import androidx.compose.material.Icon -import androidx.compose.material.IconButton -import androidx.compose.material.OutlinedTextField -import androidx.compose.material.Text -import androidx.compose.material.TopAppBar import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.ArrowBack +import androidx.compose.material.icons.automirrored.filled.ArrowBack +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +import androidx.compose.material3.IconButton +import androidx.compose.material3.OutlinedTextField +import androidx.compose.material3.Text +import androidx.compose.material3.TopAppBar import androidx.compose.runtime.Composable import androidx.compose.runtime.State import androidx.compose.runtime.getValue @@ -70,7 +71,7 @@ private object ArchitectureSnippets2 { private object ArchitectureSnippets3 { val localizedString = "" - + @OptIn(ExperimentalMaterial3Api::class) // [START android_compose_architecture_architecture3] @Composable fun MyAppTopAppBar(topAppBarText: String, onBackPressed: () -> Unit) { @@ -87,7 +88,7 @@ private object ArchitectureSnippets3 { navigationIcon = { IconButton(onClick = onBackPressed) { Icon( - Icons.Filled.ArrowBack, + Icons.AutoMirrored.Filled.ArrowBack, contentDescription = localizedString ) } diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/components/Card.kt b/compose/snippets/src/main/java/com/example/compose/snippets/components/Card.kt index 1259685e..1b755819 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/components/Card.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/components/Card.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.example.topcomponents +package com.example.compose.snippets.components import android.util.Log import androidx.compose.foundation.BorderStroke @@ -27,7 +27,6 @@ import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Card import androidx.compose.material3.CardDefaults import androidx.compose.material3.ElevatedCard -import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.MaterialTheme import androidx.compose.material3.OutlinedCard import androidx.compose.material3.Text @@ -55,7 +54,6 @@ fun CardExamples() { } } -@OptIn(ExperimentalMaterial3Api::class) // [START android_compose_components_customcard] @Composable fun CustomCardExample(event: () -> Unit) { diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/components/Chip.kt b/compose/snippets/src/main/java/com/example/compose/snippets/components/Chip.kt index 0737ddc8..36533db7 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/components/Chip.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/components/Chip.kt @@ -29,7 +29,6 @@ import androidx.compose.material.icons.filled.Person import androidx.compose.material.icons.filled.Settings import androidx.compose.material3.AssistChip import androidx.compose.material3.AssistChipDefaults -import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.FilterChip import androidx.compose.material3.FilterChipDefaults import androidx.compose.material3.Icon @@ -86,7 +85,6 @@ fun AssistChipExample() { } // [END android_compose_components_assistchip] -@OptIn(ExperimentalMaterial3Api::class) @Preview // [START android_compose_components_filterchip] @Composable @@ -116,7 +114,6 @@ fun FilterChipExample() { // You could set this up similarly to the filter chip above and have it toggleable, but this is // an example of a chip that can dismiss with a click. -@OptIn(ExperimentalMaterial3Api::class) // [START android_compose_components_inputchip] @Composable fun InputChipExample( diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/components/Dialog.kt b/compose/snippets/src/main/java/com/example/compose/snippets/components/Dialog.kt index b2ab9b72..beb0356b 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/components/Dialog.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/components/Dialog.kt @@ -32,7 +32,6 @@ import androidx.compose.material.icons.filled.Info import androidx.compose.material3.AlertDialog import androidx.compose.material3.Button import androidx.compose.material3.Card -import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Surface @@ -220,7 +219,6 @@ fun DialogWithImage( // [END android_compose_components_dialogwithimage] // [START android_compose_components_alertdialog] -@OptIn(ExperimentalMaterial3Api::class) @Composable fun AlertDialogExample( onDismissRequest: () -> Unit, diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/designsystems/AppCompatThemeSnippets.kt b/compose/snippets/src/main/java/com/example/compose/snippets/designsystems/AppCompatThemeSnippets.kt deleted file mode 100644 index 56cf8e37..00000000 --- a/compose/snippets/src/main/java/com/example/compose/snippets/designsystems/AppCompatThemeSnippets.kt +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.compose.snippets.designsystems - -import android.os.Bundle -import androidx.activity.compose.setContent -import androidx.appcompat.app.AppCompatActivity -// [START android_compose_designsystems_interop_appcompattheme] -import com.google.accompanist.themeadapter.appcompat.AppCompatTheme - -class AppCompatThemeExample : AppCompatActivity() { - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContent { - // Colors and typography have been read from the - // View-based theme used in this Activity - // Shapes are the default for M2 as this didn't exist in M1 - AppCompatTheme { - // Your app-level composable here - } - } - } -} -// [END android_compose_designsystems_interop_appcompattheme] diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/designsystems/CustomDesignSystem.kt b/compose/snippets/src/main/java/com/example/compose/snippets/designsystems/CustomDesignSystem.kt index c9489e45..f2ed138e 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/designsystems/CustomDesignSystem.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/designsystems/CustomDesignSystem.kt @@ -38,7 +38,6 @@ import androidx.compose.ui.text.TextStyle import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import com.example.compose.snippets.designsystems.FullyCustomDesignSystem.CustomTheme.elevation /* * Copyright 2022 The Android Open Source Project diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/designsystems/Material2Snippets.kt b/compose/snippets/src/main/java/com/example/compose/snippets/designsystems/Material2Snippets.kt index 540af22e..e838a1b7 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/designsystems/Material2Snippets.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/designsystems/Material2Snippets.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -@file:Suppress("unused", "DEPRECATION_ERROR") +@file:Suppress("unused", "DEPRECATION_ERROR", "UsingMaterialAndMaterial3Libraries") package com.example.compose.snippets.designsystems @@ -38,7 +38,7 @@ import androidx.compose.material.Typography import androidx.compose.material.contentColorFor import androidx.compose.material.darkColors import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.ArrowBack +import androidx.compose.material.icons.automirrored.filled.ArrowBack import androidx.compose.material.lightColors import androidx.compose.material.primarySurface import androidx.compose.material.ripple.LocalRippleTheme @@ -158,7 +158,7 @@ fun ColorUsage() { CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.disabled) { Icon( // [START_EXCLUDE] - Icons.Filled.ArrowBack, + Icons.AutoMirrored.Filled.ArrowBack, contentDescription = null // [END_EXCLUDE] ) diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/designsystems/Material3Snippets.kt b/compose/snippets/src/main/java/com/example/compose/snippets/designsystems/Material3Snippets.kt index 18f1ceb9..5d5d72d3 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/designsystems/Material3Snippets.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/designsystems/Material3Snippets.kt @@ -30,7 +30,6 @@ import androidx.compose.material3.Button import androidx.compose.material3.ButtonDefaults import androidx.compose.material3.Card import androidx.compose.material3.CardDefaults -import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.ExtendedFloatingActionButton import androidx.compose.material3.FloatingActionButton import androidx.compose.material3.Icon @@ -53,7 +52,6 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember -import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.RectangleShape @@ -72,7 +70,6 @@ import com.example.compose.snippets.ui.theme.Typography private object Material3Snippets { // [START android_compose_material3_experimental_annotation] // import androidx.compose.material3.ExperimentalMaterial3Api - @OptIn(ExperimentalMaterial3Api::class) @Composable fun AppComposable() { // M3 composables diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/designsystems/MdcThemeSnippets.kt b/compose/snippets/src/main/java/com/example/compose/snippets/designsystems/MdcThemeSnippets.kt deleted file mode 100644 index 514b9af0..00000000 --- a/compose/snippets/src/main/java/com/example/compose/snippets/designsystems/MdcThemeSnippets.kt +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.compose.snippets.designsystems - -import android.os.Bundle -import androidx.activity.compose.setContent -import androidx.appcompat.app.AppCompatActivity -// [START android_compose_designsystems_interop_mdctheme] -import com.google.accompanist.themeadapter.material.MdcTheme - -class MdcThemeExample : AppCompatActivity() { - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - // Use MdcTheme instead of M2 MaterialTheme - // Colors, typography, and shapes have been read from the - // View-based theme used in this Activity - setContent { - MdcTheme { - // Your app-level composable here - } - } - } -} -// [END android_compose_designsystems_interop_mdctheme] diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/graphics/BrushExampleSnippets.kt b/compose/snippets/src/main/java/com/example/compose/snippets/graphics/BrushExampleSnippets.kt index 0aaf13b9..23a6a58e 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/graphics/BrushExampleSnippets.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/graphics/BrushExampleSnippets.kt @@ -51,7 +51,6 @@ import androidx.compose.ui.graphics.TileMode import androidx.compose.ui.graphics.drawscope.inset import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.res.imageResource -import androidx.compose.ui.text.ExperimentalTextApi import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.tooling.preview.Preview @@ -244,7 +243,6 @@ fun GraphicsBrushSizeRecreationExample() { // [END android_compose_graphics_brush_recreation] } -@OptIn(ExperimentalTextApi::class) @Preview @Composable fun GraphicsImageBrush() { diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/graphics/CanvasSnippets.kt b/compose/snippets/src/main/java/com/example/compose/snippets/graphics/CanvasSnippets.kt index 74e1a4d3..4b53db6e 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/graphics/CanvasSnippets.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/graphics/CanvasSnippets.kt @@ -16,7 +16,6 @@ package com.example.compose.snippets.graphics -import android.graphics.Canvas import android.graphics.drawable.ShapeDrawable import android.graphics.drawable.shapes.OvalShape import androidx.compose.animation.core.Animatable @@ -48,7 +47,6 @@ import androidx.compose.ui.graphics.drawscope.withTransform import androidx.compose.ui.graphics.nativeCanvas import androidx.compose.ui.res.imageResource import androidx.compose.ui.text.AnnotatedString -import androidx.compose.ui.text.ExperimentalTextApi import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.drawText import androidx.compose.ui.text.rememberTextMeasurer @@ -59,7 +57,6 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.toSize import com.example.compose.snippets.R -import java.util.Collections.rotate /* * Copyright 2022 The Android Open Source Project @@ -192,7 +189,6 @@ fun CanvasMultipleTransformations() { // [END android_compose_graphics_canvas_multiple_transforms] } -@OptIn(ExperimentalTextApi::class) @Preview @Composable fun CanvasDrawText() { @@ -238,7 +234,6 @@ fun CanvasDrawPath() { // [END android_compose_graphics_canvas_draw_path] } -@OptIn(ExperimentalTextApi::class) @Preview @Composable fun CanvasMeasureText() { @@ -268,7 +263,6 @@ fun CanvasMeasureText() { // [END android_compose_graphics_canvas_draw_text_measure] } -@OptIn(ExperimentalTextApi::class) @Preview @Composable fun CanvasMeasureTextOverflow() { diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/graphics/ShapesSnippets.kt b/compose/snippets/src/main/java/com/example/compose/snippets/graphics/ShapesSnippets.kt index de0a5ee9..efe9bfa1 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/graphics/ShapesSnippets.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/graphics/ShapesSnippets.kt @@ -38,6 +38,7 @@ import androidx.compose.foundation.layout.size import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.State import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Alignment @@ -280,7 +281,7 @@ fun List.toPath(path: Path = Path(), scale: Float = 1f): Path { // [START android_compose_morph_clip_shape] class MorphPolygonShape( private val morph: Morph, - private val percentage: Float + private val percentage: State ) : Shape { private val matrix = Matrix() @@ -294,7 +295,7 @@ class MorphPolygonShape( matrix.scale(size.width / 2f, size.height / 2f) matrix.translate(1f, 1f) - val path = morph.toComposePath(progress = percentage) + val path = morph.toComposePath(progress = percentage.value) path.transform(matrix) return Outline.Generic(path) } @@ -333,7 +334,7 @@ private fun MorphOnClick() { modifier = Modifier .size(200.dp) .padding(8.dp) - .clip(MorphPolygonShape(morph, animatedProgress.value)) + .clip(MorphPolygonShape(morph, animatedProgress)) .background(Color(0xFF80DEEA)) .size(200.dp) .clickable(interactionSource = interactionSource, indication = null) { @@ -433,8 +434,8 @@ fun ApplyPolygonAsClipImage() { // [START android_compose_shapes_custom_rotating_morph_shape] class CustomRotatingMorphShape( private val morph: Morph, - private val percentage: Float, - private val rotation: Float + private val percentage: State, + private val rotation: State ) : Shape { private val matrix = Matrix() @@ -447,9 +448,9 @@ class CustomRotatingMorphShape( // By default this stretches the path to the size of the container, if you don't want stretching, use the same size.width for both x and y. matrix.scale(size.width / 2f, size.height / 2f) matrix.translate(1f, 1f) - matrix.rotateZ(rotation) + matrix.rotateZ(rotation.value) - val path = morph.toComposePath(progress = percentage) + val path = morph.toComposePath(progress = percentage.value) path.transform(matrix) return Outline.Generic(path) @@ -505,8 +506,8 @@ private fun RotatingScallopedProfilePic() { .clip( CustomRotatingMorphShape( morph, - animatedProgress.value, - animatedRotation.value + animatedProgress, + animatedRotation ) ) .size(200.dp) diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/interop/MigrationCommonScenariosSnippets.kt b/compose/snippets/src/main/java/com/example/compose/snippets/interop/MigrationCommonScenariosSnippets.kt index 07303c37..59ac0129 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/interop/MigrationCommonScenariosSnippets.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/interop/MigrationCommonScenariosSnippets.kt @@ -36,10 +36,10 @@ import androidx.compose.foundation.pager.rememberPagerState import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Add import androidx.compose.material.icons.filled.Image -import androidx.compose.material3.Divider import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.ExtendedFloatingActionButton import androidx.compose.material3.FloatingActionButton +import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.material3.ModalDrawerSheet import androidx.compose.material3.ModalNavigationDrawer @@ -106,13 +106,13 @@ class RVActivity : ComponentActivity() { } @Composable - fun commonUseCase2(data: List) { + fun CommonUseCase2(data: List) { // [START android_compose_interop_migration_common_scenarios_recyclerview_common_use_case_2] LazyColumn(Modifier.fillMaxSize()) { itemsIndexed(data) { index, d -> ListItem(d) if (index != data.size - 1) { - Divider() + HorizontalDivider() } } } @@ -271,7 +271,6 @@ class CoordinatorLayoutActivity : ComponentActivity() { // [END android_compose_interop_migration_common_scenarios_coordinatorlayout_step2] } - @OptIn(ExperimentalFoundationApi::class) private fun step3() { // [START android_compose_interop_migration_common_scenarios_coordinatorlayout_step3] composeView.setContent { @@ -326,7 +325,7 @@ class CoordinatorLayoutActivity : ComponentActivity() { @OptIn(ExperimentalMaterial3Api::class) @Composable - private fun commonUseCaseToolbars() { + private fun CommonUseCaseToolbars() { // [START android_compose_interop_migration_common_scenarios_coordinatorlayout_toolbars] // 1. Create the TopAppBarScrollBehavior val scrollBehavior = TopAppBarDefaults.enterAlwaysScrollBehavior() @@ -355,13 +354,13 @@ class CoordinatorLayoutActivity : ComponentActivity() { } @Composable - private fun commonUseCaseDrawers() { + private fun CommonUseCaseDrawers() { // [START android_compose_interop_migration_common_scenarios_coordinatorlayout_drawers] ModalNavigationDrawer( drawerContent = { ModalDrawerSheet { Text("Drawer title", modifier = Modifier.padding(16.dp)) - Divider() + HorizontalDivider() NavigationDrawerItem( label = { Text(text = "Drawer Item") }, selected = false, @@ -382,7 +381,7 @@ class CoordinatorLayoutActivity : ComponentActivity() { } @Composable - private fun commonUseCaseSnackbars() { + private fun CommonUseCaseSnackbars() { // [START android_compose_interop_migration_common_scenarios_coordinatorlayout_snackbars] val scope = rememberCoroutineScope() val snackbarHostState = remember { SnackbarHostState() } diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/kotlin/KotlinSnippets.kt b/compose/snippets/src/main/java/com/example/compose/snippets/kotlin/KotlinSnippets.kt index 9edd96be..345ca664 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/kotlin/KotlinSnippets.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/kotlin/KotlinSnippets.kt @@ -43,7 +43,6 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.draw.drawBehind import androidx.compose.ui.focus.FocusRequester.Companion.createRefs @@ -220,7 +219,6 @@ fun destructuring() { // [END android_compose_kotlin_destructuring] } -@OptIn(ExperimentalComposeUiApi::class) @Composable fun DestructuringCompose() { // [START android_compose_kotlin_destructuring_compose] diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/landing/LandingScreen.kt b/compose/snippets/src/main/java/com/example/compose/snippets/landing/LandingScreen.kt index 0fcfbf07..79083bd3 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/landing/LandingScreen.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/landing/LandingScreen.kt @@ -26,7 +26,7 @@ import androidx.compose.foundation.layout.heightIn import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items -import androidx.compose.material3.Divider +import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment @@ -92,6 +92,6 @@ fun NavigationItem(destination: Destination, onClick: () -> Unit) { } ) { Text(destination.title) - Divider(modifier = Modifier.align(Alignment.BottomCenter)) + HorizontalDivider(modifier = Modifier.align(Alignment.BottomCenter)) } } diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/layouts/AdaptiveLayoutSnippets.kt b/compose/snippets/src/main/java/com/example/compose/snippets/layouts/AdaptiveLayoutSnippets.kt index c66253cd..7980eae0 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/layouts/AdaptiveLayoutSnippets.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/layouts/AdaptiveLayoutSnippets.kt @@ -21,7 +21,6 @@ package com.example.compose.snippets.layouts import androidx.compose.foundation.layout.BoxWithConstraints import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row -import androidx.compose.material3.adaptive.ExperimentalMaterial3AdaptiveApi import androidx.compose.material3.adaptive.currentWindowAdaptiveInfo import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -48,7 +47,6 @@ import androidx.window.core.layout.WindowSizeClass * limitations under the License. */ // [START android_compose_adaptive_layouts_basic] -@OptIn(ExperimentalMaterial3AdaptiveApi::class) @Composable fun MyApp( windowSizeClass: WindowSizeClass = currentWindowAdaptiveInfo().windowSizeClass diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/layouts/CommonLayoutExamples.kt b/compose/snippets/src/main/java/com/example/compose/snippets/layouts/CommonLayoutExamples.kt index fd3b257b..98f5b03a 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/layouts/CommonLayoutExamples.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/layouts/CommonLayoutExamples.kt @@ -19,7 +19,6 @@ package com.example.compose.snippets.layouts import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.ExperimentalLayoutApi import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.aspectRatio @@ -53,7 +52,6 @@ import kotlin.random.Random * See the License for the specific language governing permissions and * limitations under the License. */ -@OptIn(ExperimentalLayoutApi::class) @Composable @Preview fun Layout_Graph_Vertical() { @@ -80,7 +78,6 @@ fun Layout_Graph_Vertical() { // [END android_compose_layout_vertical_graph] } -@OptIn(ExperimentalLayoutApi::class) @Composable @Preview fun Layout_Graph_Horizontal() { diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/layouts/InsetsSnippets.kt b/compose/snippets/src/main/java/com/example/compose/snippets/layouts/InsetsSnippets.kt index 2bbf276b..4599fd39 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/layouts/InsetsSnippets.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/layouts/InsetsSnippets.kt @@ -25,7 +25,6 @@ import androidx.activity.enableEdgeToEdge import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.ExperimentalLayoutApi import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.WindowInsets @@ -115,7 +114,6 @@ fun ConsumedFromSiblingsSnippet() { @Composable fun ConsumedFromPaddingSnippet() { // [START android_compose_insets_consumed_from_padding] - @OptIn(ExperimentalLayoutApi::class) Column(Modifier.padding(16.dp).consumeWindowInsets(PaddingValues(16.dp))) { // content Spacer(Modifier.windowInsetsBottomHeight(WindowInsets.ime)) @@ -123,7 +121,6 @@ fun ConsumedFromPaddingSnippet() { // [END android_compose_insets_consumed_from_padding] } -@OptIn(ExperimentalLayoutApi::class) @Preview @Composable fun M3SupportScaffoldSnippet() { diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/layouts/MaterialLayoutSnippets.kt b/compose/snippets/src/main/java/com/example/compose/snippets/layouts/MaterialLayoutSnippets.kt index 9c7f9d4d..b027c6ea 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/layouts/MaterialLayoutSnippets.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/layouts/MaterialLayoutSnippets.kt @@ -28,12 +28,12 @@ import androidx.compose.material.icons.filled.Image import androidx.compose.material3.BottomAppBar import androidx.compose.material3.Button import androidx.compose.material3.ButtonDefaults -import androidx.compose.material3.Divider import androidx.compose.material3.DrawerValue import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.ExtendedFloatingActionButton import androidx.compose.material3.FabPosition import androidx.compose.material3.FloatingActionButton +import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.ModalBottomSheet @@ -291,7 +291,7 @@ fun DrawerDemo() { drawerContent = { ModalDrawerSheet { Text("Drawer title", modifier = Modifier.padding(16.dp)) - Divider() + HorizontalDivider() NavigationDrawerItem( label = { Text(text = "Drawer Item") }, selected = false, diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/layouts/PagerSnippets.kt b/compose/snippets/src/main/java/com/example/compose/snippets/layouts/PagerSnippets.kt index e2bf4c43..ec8e84cb 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/layouts/PagerSnippets.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/layouts/PagerSnippets.kt @@ -14,15 +14,11 @@ * limitations under the License. */ -@file:OptIn( - ExperimentalFoundationApi::class -) @file:Suppress("unused") package com.example.compose.snippets.layouts import android.util.Log -import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement @@ -123,7 +119,6 @@ fun VerticalPagerSample() { // [END android_compose_layouts_pager_vertical_basic] } -@OptIn(ExperimentalFoundationApi::class) @Preview @Composable fun PagerScrollToItem() { @@ -214,7 +209,6 @@ fun PageChangesSample() { // [END android_compose_layouts_pager_notify_page_changes] } -@OptIn(ExperimentalFoundationApi::class) @Composable @Preview fun PagerWithTabsExample() { @@ -358,7 +352,6 @@ fun PagerWithTabs() { } // [END android_compose_layouts_pager_with_tabs] } -@OptIn(ExperimentalFoundationApi::class) @Preview @Composable fun PagerIndicator() { @@ -410,7 +403,6 @@ private val threePagesPerViewport = object : PageSize { } // [END android_compose_pager_custom_page_size] -@OptIn(ExperimentalFoundationApi::class) @Preview @Composable private fun CustomSnapDistance() { diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/lists/LazyListSnippets.kt b/compose/snippets/src/main/java/com/example/compose/snippets/lists/LazyListSnippets.kt index b5a7d037..c8864f12 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/lists/LazyListSnippets.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/lists/LazyListSnippets.kt @@ -19,7 +19,6 @@ package com.example.compose.snippets.lists import androidx.compose.animation.AnimatedVisibility -import androidx.compose.animation.ExperimentalAnimationApi import androidx.compose.animation.core.Spring import androidx.compose.animation.core.spring import androidx.compose.animation.core.tween @@ -265,7 +264,6 @@ private object ListsSnippetsReactingScrollPosition1 { private object ListsSnippetsReactingScrollPosition2 { // [START android_compose_layouts_lazy_column_scroll_to_top] - @OptIn(ExperimentalAnimationApi::class) @Composable fun MessageList(messages: List) { Box { @@ -427,7 +425,6 @@ private fun LazyColumnRememberSaveable() { // [END android_compose_layouts_lazy_column_any_key_saveable] } -@OptIn(ExperimentalFoundationApi::class) @Composable private fun LazyItemAnimations() { val books = remember { @@ -445,7 +442,6 @@ private fun LazyItemAnimations() { // [END android_compose_layouts_lazy_column_item_animation] } -@OptIn(ExperimentalFoundationApi::class) @Composable private fun LazyItemAnimationWithSpec() { val books = remember { @@ -635,7 +631,6 @@ private fun ContentTypeExample() { } @Preview -@OptIn(ExperimentalFoundationApi::class) @Composable fun LazyStaggeredGridSnippet() { // [START android_compose_layouts_lazy_staggered_grid_adaptive] @@ -658,7 +653,6 @@ fun LazyStaggeredGridSnippet() { // [END android_compose_layouts_lazy_staggered_grid_adaptive] } @Preview -@OptIn(ExperimentalFoundationApi::class) @Composable fun LazyStaggeredGridSnippetFixed() { // [START android_compose_layouts_lazy_staggered_grid_fixed] diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/resources/ResourcesSnippets.kt b/compose/snippets/src/main/java/com/example/compose/snippets/resources/ResourcesSnippets.kt index b6b225a0..09c0bef1 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/resources/ResourcesSnippets.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/resources/ResourcesSnippets.kt @@ -34,7 +34,6 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.res.colorResource import androidx.compose.ui.res.dimensionResource @@ -47,7 +46,6 @@ import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontWeight import com.example.compose.snippets.R -@OptIn(ExperimentalComposeUiApi::class) @Composable fun Strings() { // [START android_compose_resources_strings] diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/sideeffects/SideEffectsSnippets.kt b/compose/snippets/src/main/java/com/example/compose/snippets/sideeffects/SideEffectsSnippets.kt index c68791a0..976d7ac7 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/sideeffects/SideEffectsSnippets.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/sideeffects/SideEffectsSnippets.kt @@ -43,10 +43,10 @@ import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.rememberUpdatedState import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier -import androidx.compose.ui.platform.LocalLifecycleOwner import androidx.lifecycle.Lifecycle import androidx.lifecycle.LifecycleEventObserver import androidx.lifecycle.LifecycleOwner +import androidx.lifecycle.compose.LocalLifecycleOwner import com.example.compose.snippets.interop.FirebaseAnalytics import com.example.compose.snippets.interop.User import com.example.compose.snippets.kotlin.Message diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/state/StateOverviewSnippets.kt b/compose/snippets/src/main/java/com/example/compose/snippets/state/StateOverviewSnippets.kt index 503732ad..5ac1e71b 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/state/StateOverviewSnippets.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/state/StateOverviewSnippets.kt @@ -16,6 +16,8 @@ @file:Suppress("unused") +package com.example.compose.snippets.state + import android.content.res.Resources import android.graphics.BitmapShader import android.graphics.Shader @@ -244,7 +246,7 @@ private fun RememberKeysSnippet3() { } /** - * Add fake Parcelize and Parcelable to avoid adding dependency on + * Add fake com.example.compose.snippets.state.Parcelize and com.example.compose.snippets.state.Parcelable to avoid adding dependency on * kotlin-parcelize just for snippets */ private annotation class Parcelize diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/touchinput/focus/FocusSnippets.kt b/compose/snippets/src/main/java/com/example/compose/snippets/touchinput/focus/FocusSnippets.kt index 2391d48b..82b5b2d1 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/touchinput/focus/FocusSnippets.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/touchinput/focus/FocusSnippets.kt @@ -18,7 +18,6 @@ package com.example.compose.snippets.touchinput.focus -import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.Indication import androidx.compose.foundation.IndicationInstance import androidx.compose.foundation.background @@ -113,7 +112,6 @@ private fun BasicSample2() { } } -@OptIn(ExperimentalComposeUiApi::class) @Preview @Composable fun OverrideDefaultOrder() { @@ -177,7 +175,6 @@ fun OverrideDefaultOrder() { // [END android_compose_touchinput_focus_override_use] } -@OptIn(ExperimentalComposeUiApi::class) @Preview @Composable fun OverrideTwoDimensionalOrder() { @@ -197,7 +194,6 @@ fun OverrideTwoDimensionalOrder() { // [END android_compose_touchinput_focus_override_2d] } -@OptIn(ExperimentalFoundationApi::class) @Composable private fun FocusGroup() { @@ -319,7 +315,6 @@ private fun Capture() { // [END android_compose_touchinput_focus_capture] } -@OptIn(ExperimentalComposeUiApi::class) @Composable private fun ModifierOrder() { @@ -403,7 +398,6 @@ private fun RedirectFocus() { // [END android_compose_touchinput_focus_redirect] } -@OptIn(ExperimentalComposeUiApi::class) @Composable private fun FocusAdvancing() { // [START android_compose_touchinput_focus_advancing] diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/touchinput/gestures/GesturesSnippets.kt b/compose/snippets/src/main/java/com/example/compose/snippets/touchinput/gestures/GesturesSnippets.kt index dcddc073..d5f7fffe 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/touchinput/gestures/GesturesSnippets.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/touchinput/gestures/GesturesSnippets.kt @@ -56,7 +56,6 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.geometry.Offset import androidx.compose.ui.graphics.Brush @@ -208,7 +207,6 @@ private fun AutomaticNestedScroll() { private object NestedScrollInterop { // [START android_compose_touchinput_gestures_nested_scroll_interop_activity] open class MainActivity : ComponentActivity() { - @OptIn(ExperimentalComposeUiApi::class) override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/touchinput/pointerinput/TapAndPress.kt b/compose/snippets/src/main/java/com/example/compose/snippets/touchinput/pointerinput/TapAndPress.kt index fbfa95cd..dbe22282 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/touchinput/pointerinput/TapAndPress.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/touchinput/pointerinput/TapAndPress.kt @@ -60,7 +60,6 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.geometry.Offset @@ -291,7 +290,6 @@ private fun FullScreenImage( } // [START android_compose_touchinput_pointerinput_scrim] -@OptIn(ExperimentalComposeUiApi::class) @Composable private fun Scrim(onClose: () -> Unit, modifier: Modifier = Modifier) { val strClose = stringResource(R.string.close) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 530c1296..70130dd4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,46 +1,45 @@ [versions] -accompanist = "0.32.0" -androidGradlePlugin = "8.4.0" -androidx-activity-compose = "1.9.0" -androidx-appcompat = "1.6.1" -androidx-compose-bom = "2024.05.00" +accompanist = "0.34.0" +androidGradlePlugin = "8.4.2" +androidx-activity-compose = "1.9.1" +androidx-appcompat = "1.7.0" +androidx-compose-bom = "2024.06.00" androidx-compose-ui-test = "1.7.0-alpha08" androidx-constraintlayout = "2.1.4" androidx-constraintlayout-compose = "1.0.1" androidx-coordinator-layout = "1.2.0" -androidx-corektx = "1.9.0" +androidx-corektx = "1.13.1" androidx-emoji2-views = "1.4.0" -androidx-fragment-ktx = "1.6.2" -androidx-glance-appwidget = "1.0.0" -androidx-lifecycle-compose = "2.8.0-rc01" -androidx-lifecycle-runtime-compose = "2.8.0-rc01" +androidx-fragment-ktx = "1.8.2" +androidx-glance-appwidget = "1.1.0" +androidx-lifecycle-compose = "2.8.4" +androidx-lifecycle-runtime-compose = "2.8.4" androidx-navigation = "2.8.0-rc01" androidx-paging = "3.2.1" androidx-test = "1.5.0" androidx-test-espresso = "3.5.1" -androidx-window = "1.3.0-beta02" +androidx-window = "1.3.0" androidxHiltNavigationCompose = "1.2.0" -coil = "2.5.0" +coil = "2.6.0" # @keep compileSdk = "34" -compose-compiler = "1.5.4" coreSplashscreen = "1.0.1" -compose-latest = "1.7.0-beta05" +compose-latest = "1.7.0-beta06" coroutines = "1.7.3" google-maps = "18.2.0" gradle-versions = "0.51.0" hilt = "2.50" horologist = "0.5.24" junit = "4.13.2" -# @pin Update in conjuction with Compose Compiler -kotlin = "1.9.20" +kotlin = "2.0.0" kotlinxSerializationJson = "1.6.3" + ksp = "1.8.0-1.0.9" maps-compose = "4.3.2" material = "1.4.0-beta01" -material3-adaptive = "1.0.0-alpha12" +material3-adaptive = "1.0.0-beta04" material3-adaptive-navigation-suite = "1.0.0-alpha07" -media3 = "1.2.1" +media3 = "1.3.1" # @keep minSdk = "21" playServicesWearable = "18.2.0" @@ -48,8 +47,8 @@ recyclerview = "1.3.2" # @keep targetSdk = "34" version-catalog-update = "0.8.3" -wearComposeFoundation = "1.3.0" -wearComposeMaterial = "1.3.0" +wearComposeFoundation = "1.3.1" +wearComposeMaterial = "1.3.1" composeUiTooling = "1.3.1" [libraries] @@ -76,7 +75,7 @@ androidx-compose-runtime = { module = "androidx.compose.runtime:runtime" } androidx-compose-runtime-livedata = { module = "androidx.compose.runtime:runtime-livedata" } androidx-compose-ui = { module = "androidx.compose.ui:ui", version.ref = "compose-latest" } androidx-compose-ui-googlefonts = { module = "androidx.compose.ui:ui-text-google-fonts" } -androidx-graphics-shapes = "androidx.graphics:graphics-shapes:1.0.0-beta01" +androidx-graphics-shapes = "androidx.graphics:graphics-shapes:1.0.0-rc01" androidx-compose-ui-graphics = { module = "androidx.compose.ui:ui-graphics" } androidx-compose-ui-test = { module = "androidx.compose.ui:ui-test" } androidx-compose-ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4" } @@ -131,6 +130,7 @@ androidx-material-icons-core = { module = "androidx.compose.material:material-ic [plugins] android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" } android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" } +compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } gradle-versions = { id = "com.github.ben-manes.versions", version.ref = "gradle-versions" } hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" } kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" } diff --git a/kotlin/src/test/kotlin/com/example/android/coroutines/testing/DispatchersOutsideTests.kt b/kotlin/src/test/kotlin/com/example/android/coroutines/testing/DispatchersOutsideTests.kt index 9f8c6c75..2f3228cc 100644 --- a/kotlin/src/test/kotlin/com/example/android/coroutines/testing/DispatchersOutsideTests.kt +++ b/kotlin/src/test/kotlin/com/example/android/coroutines/testing/DispatchersOutsideTests.kt @@ -14,26 +14,30 @@ * limitations under the License. */ -package com.example.android.coroutines.testing.repo +@file:OptIn(ExperimentalCoroutinesApi::class) + +package com.example.android.coroutines.testing -import com.example.android.coroutines.testing.MainDispatcherRule import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.StandardTestDispatcher import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.runTest import org.junit.Rule import org.junit.Test +import org.junit.experimental.runners.Enclosed +import org.junit.runner.RunWith // Helper function to let code below compile -private fun Repository(): Repository = Repository(Dispatchers.IO) +private fun ExampleRepository(): Repository = Repository(Dispatchers.IO) + -private // [START coroutine_test_repo_with_rule_blank] -class Repository(private val ioDispatcher: CoroutineDispatcher) { /* ... */ } +class ExampleRepository(private val ioDispatcher: CoroutineDispatcher) { /* ... */ } class RepositoryTestWithRule { - private val repository = Repository(/* What TestDispatcher? */) + private val repository = ExampleRepository(/* What TestDispatcher? */) @get:Rule val mainDispatcherRule = MainDispatcherRule() @@ -48,13 +52,14 @@ class RepositoryTestWithRule { } // [END coroutine_test_repo_with_rule_blank] +@RunWith(Enclosed::class) class DispatchersOutsideTests { // [START coroutine_test_repo_with_rule] class RepositoryTestWithRule { @get:Rule val mainDispatcherRule = MainDispatcherRule() - private val repository = Repository(mainDispatcherRule.testDispatcher) + private val repository = ExampleRepository(mainDispatcherRule.testDispatcher) @Test fun someRepositoryTest() = runTest { // Takes scheduler from Main @@ -70,7 +75,7 @@ class DispatchersOutsideTests { class RepositoryTest { // Creates the single test scheduler private val testDispatcher = UnconfinedTestDispatcher() - private val repository = Repository(testDispatcher) + private val repository = ExampleRepository(testDispatcher) @Test fun someRepositoryTest() = runTest(testDispatcher.scheduler) { @@ -84,3 +89,5 @@ class DispatchersOutsideTests { } // [END coroutine_test_repo_without_rule] } + + diff --git a/kotlin/src/test/kotlin/com/example/android/coroutines/testing/HomeViewModelTestUsingRule.kt b/kotlin/src/test/kotlin/com/example/android/coroutines/testing/HomeViewModelTestUsingRule.kt index 882488f8..54a5a9bd 100644 --- a/kotlin/src/test/kotlin/com/example/android/coroutines/testing/HomeViewModelTestUsingRule.kt +++ b/kotlin/src/test/kotlin/com/example/android/coroutines/testing/HomeViewModelTestUsingRule.kt @@ -22,7 +22,6 @@ import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.resetMain import kotlinx.coroutines.test.runTest import kotlinx.coroutines.test.setMain -import org.junit.Assert import org.junit.Assert.assertEquals import org.junit.Rule import org.junit.Test diff --git a/kotlin/src/test/kotlin/com/example/android/coroutines/testing/UserStateTest.kt b/kotlin/src/test/kotlin/com/example/android/coroutines/testing/UserStateTest.kt index 9620ccbe..e2c625e4 100644 --- a/kotlin/src/test/kotlin/com/example/android/coroutines/testing/UserStateTest.kt +++ b/kotlin/src/test/kotlin/com/example/android/coroutines/testing/UserStateTest.kt @@ -5,10 +5,9 @@ package com.example.android.coroutines.testing import com.example.android.coroutines.testing.scope.FakeUserRepository import com.example.android.coroutines.testing.scope.UserState import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.advanceUntilIdle import kotlinx.coroutines.test.runTest -import org.junit.Assert.* +import org.junit.Assert.assertEquals import org.junit.Test // [START android_coroutine_test_user_state_test] diff --git a/shared/src/main/res/layout/activity_main.xml b/shared/src/main/res/layout/activity_main.xml deleted file mode 100644 index 0a8e972d..00000000 --- a/shared/src/main/res/layout/activity_main.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/wear/build.gradle.kts b/wear/build.gradle.kts index b8ca7edd..9725e539 100644 --- a/wear/build.gradle.kts +++ b/wear/build.gradle.kts @@ -1,6 +1,7 @@ plugins { alias(libs.plugins.android.application) alias(libs.plugins.kotlin.android) + alias(libs.plugins.compose.compiler) } android { @@ -39,9 +40,7 @@ android { buildFeatures { compose = true } - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get() - } + packaging { resources { excludes += "/META-INF/{AL2.0,LGPL2.1}"