Skip to content

Commit 74aaf25

Browse files
authored
Latest beta06 updates for Compose (#300)
* Do latest 1.7.0-beta06 version updates * Apply Spotless * Code cleanup * Apply Spotless * Fix broken test * Fix tests --------- Co-authored-by: riggaroo <[email protected]>
1 parent c5d4717 commit 74aaf25

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+92
-262
lines changed

bluetoothle/src/main/java/com/sample/android/bluetoothle/kotlin/MainActivity.kt

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import android.content.Context
66
import android.content.Intent
77
import android.os.Bundle
88
import androidx.appcompat.app.AppCompatActivity
9-
import com.sample.android.bluetoothle.java.MainActivity
109

1110
class MainActivity : AppCompatActivity() {
1211

build.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ plugins {
88
alias(libs.plugins.kapt) apply false
99
alias(libs.plugins.hilt) apply false
1010
alias(libs.plugins.kotlin.parcelize) apply false
11+
alias(libs.plugins.compose.compiler) apply false
1112
alias(libs.plugins.kotlin.serialization) apply false
1213
}
1314

compose/recomposehighlighter/build.gradle.kts

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
plugins {
22
alias(libs.plugins.android.application)
33
alias(libs.plugins.kotlin.android)
4+
alias(libs.plugins.compose.compiler)
45
}
56
android {
67
compileSdk = libs.versions.compileSdk.get().toInt()
@@ -40,9 +41,6 @@ android {
4041
viewBinding = true
4142
}
4243

43-
composeOptions {
44-
kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get()
45-
}
4644
}
4745
dependencies {
4846
val composeBom = platform(libs.androidx.compose.bom)

compose/snippets/build.gradle.kts

+1-4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ plugins {
2020
alias(libs.plugins.kapt)
2121
alias(libs.plugins.hilt)
2222
alias(libs.plugins.kotlin.parcelize)
23+
alias(libs.plugins.compose.compiler)
2324
alias(libs.plugins.kotlin.serialization)
2425
}
2526

@@ -63,10 +64,6 @@ android {
6364
viewBinding = true
6465
}
6566

66-
composeOptions {
67-
kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get()
68-
}
69-
7067
packaging.resources {
7168
// Multiple dependency bring these files in. Exclude them to enable
7269
// our test APK to build (has no effect on our AARs)

compose/snippets/src/main/java/com/example/compose/snippets/SnippetsActivity.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import com.example.compose.snippets.animations.sharedelement.PlaceholderSizeAnim
3232
import com.example.compose.snippets.components.AppBarExamples
3333
import com.example.compose.snippets.components.BadgeExamples
3434
import com.example.compose.snippets.components.ButtonExamples
35+
import com.example.compose.snippets.components.CardExamples
3536
import com.example.compose.snippets.components.CheckboxExamples
3637
import com.example.compose.snippets.components.ChipExamples
3738
import com.example.compose.snippets.components.ComponentsScreen
@@ -52,7 +53,6 @@ import com.example.compose.snippets.landing.LandingScreen
5253
import com.example.compose.snippets.navigation.Destination
5354
import com.example.compose.snippets.navigation.TopComponentsDestination
5455
import com.example.compose.snippets.ui.theme.SnippetsTheme
55-
import com.example.topcomponents.CardExamples
5656

5757
class SnippetsActivity : ComponentActivity() {
5858
override fun onCreate(savedInstanceState: Bundle?) {

compose/snippets/src/main/java/com/example/compose/snippets/adaptivelayouts/SampleListDetailPaneScaffold.kt

-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ import androidx.compose.material3.adaptive.layout.ListDetailPaneScaffold
3535
import androidx.compose.material3.adaptive.layout.ListDetailPaneScaffoldRole
3636
import androidx.compose.material3.adaptive.navigation.rememberListDetailPaneScaffoldNavigator
3737
import androidx.compose.runtime.Composable
38-
import androidx.compose.runtime.getValue
39-
import androidx.compose.runtime.setValue
4038
import androidx.compose.ui.Modifier
4139
import androidx.compose.ui.graphics.Color
4240
import androidx.compose.ui.tooling.preview.Preview

compose/snippets/src/main/java/com/example/compose/snippets/adaptivelayouts/SampleNavigationSuiteScaffold.kt

-3
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
@file:OptIn(ExperimentalMaterial3AdaptiveNavigationSuiteApi::class)
18-
1917
package com.example.compose.snippets.adaptivelayouts
2018

2119
import androidx.annotation.StringRes
@@ -29,7 +27,6 @@ import androidx.compose.material3.MaterialTheme
2927
import androidx.compose.material3.NavigationBarItemDefaults
3028
import androidx.compose.material3.Text
3129
import androidx.compose.material3.adaptive.currentWindowAdaptiveInfo
32-
import androidx.compose.material3.adaptive.navigationsuite.ExperimentalMaterial3AdaptiveNavigationSuiteApi
3330
import androidx.compose.material3.adaptive.navigationsuite.NavigationSuiteDefaults
3431
import androidx.compose.material3.adaptive.navigationsuite.NavigationSuiteScaffold
3532
import androidx.compose.material3.adaptive.navigationsuite.NavigationSuiteScaffoldDefaults

compose/snippets/src/main/java/com/example/compose/snippets/animations/AnimationQuickGuide.kt

-2
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ import androidx.compose.runtime.mutableStateOf
8787
import androidx.compose.runtime.remember
8888
import androidx.compose.runtime.setValue
8989
import androidx.compose.ui.Alignment
90-
import androidx.compose.ui.ExperimentalComposeUiApi
9190
import androidx.compose.ui.Modifier
9291
import androidx.compose.ui.draw.clip
9392
import androidx.compose.ui.draw.drawBehind
@@ -720,7 +719,6 @@ private fun LoadingScreen() {
720719
}
721720
}
722721

723-
@OptIn(ExperimentalComposeUiApi::class)
724722
@Preview
725723
@Composable
726724
fun AnimationLayout() {

compose/snippets/src/main/java/com/example/compose/snippets/animations/AnimationSnippets.kt

+8-11
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import androidx.compose.animation.core.createChildTransition
5050
import androidx.compose.animation.core.infiniteRepeatable
5151
import androidx.compose.animation.core.keyframes
5252
import androidx.compose.animation.core.rememberInfiniteTransition
53+
import androidx.compose.animation.core.rememberTransition
5354
import androidx.compose.animation.core.repeatable
5455
import androidx.compose.animation.core.snap
5556
import androidx.compose.animation.core.spring
@@ -65,7 +66,7 @@ import androidx.compose.animation.graphics.vector.AnimatedImageVector
6566
import androidx.compose.animation.shrinkVertically
6667
import androidx.compose.animation.slideInVertically
6768
import androidx.compose.animation.slideOutVertically
68-
import androidx.compose.animation.with
69+
import androidx.compose.animation.togetherWith
6970
import androidx.compose.foundation.BorderStroke
7071
import androidx.compose.foundation.Image
7172
import androidx.compose.foundation.background
@@ -190,7 +191,6 @@ private fun AnimatedVisibilityMutable() {
190191
// [END android_compose_animations_animated_visibility_mutable]
191192
}
192193

193-
@OptIn(ExperimentalAnimationApi::class)
194194
@Composable
195195
@Preview
196196
private fun AnimatedVisibilityAnimateEnterExitChildren() {
@@ -222,7 +222,6 @@ private fun AnimatedVisibilityAnimateEnterExitChildren() {
222222
// [END android_compose_animations_animated_visibility_animate_enter_exit_children]
223223
}
224224

225-
@OptIn(ExperimentalAnimationApi::class)
226225
@Preview
227226
@Composable
228227
private fun AnimatedVisibilityTransition() {
@@ -259,7 +258,6 @@ private fun AnimateAsStateSimple() {
259258
// [END android_compose_animations_animate_as_state]
260259
}
261260

262-
@OptIn(ExperimentalAnimationApi::class)
263261
@Preview
264262
@Composable
265263
private fun AnimatedContentSimple() {
@@ -277,7 +275,6 @@ private fun AnimatedContentSimple() {
277275
// [END android_compose_animations_animated_content_simple]
278276
}
279277

280-
@OptIn(ExperimentalAnimationApi::class)
281278
@Composable
282279
private fun AnimatedContentTransitionSpec(count: Int) {
283280
// [START android_compose_animations_animated_content_transition_spec]
@@ -288,12 +285,12 @@ private fun AnimatedContentTransitionSpec(count: Int) {
288285
if (targetState > initialState) {
289286
// If the target number is larger, it slides up and fades in
290287
// while the initial (smaller) number slides up and fades out.
291-
slideInVertically { height -> height } + fadeIn() with
288+
slideInVertically { height -> height } + fadeIn() togetherWith
292289
slideOutVertically { height -> -height } + fadeOut()
293290
} else {
294291
// If the target number is smaller, it slides down and fades in
295292
// while the initial number slides down and fades out.
296-
slideInVertically { height -> -height } + fadeIn() with
293+
slideInVertically { height -> -height } + fadeIn() togetherWith
297294
slideOutVertically { height -> height } + fadeOut()
298295
}.using(
299296
// Disable clipping since the faded slide-in/out should
@@ -318,7 +315,7 @@ private fun AnimatedContentSizeTransform() {
318315
AnimatedContent(
319316
targetState = expanded,
320317
transitionSpec = {
321-
fadeIn(animationSpec = tween(150, 150)) with
318+
fadeIn(animationSpec = tween(150, 150)) togetherWith
322319
fadeOut(animationSpec = tween(150)) using
323320
SizeTransform { initialSize, targetSize ->
324321
if (targetState) {
@@ -431,7 +428,7 @@ private object UpdateTransitionEnumState {
431428
// Start in collapsed state and immediately animate to expanded
432429
var currentState = remember { MutableTransitionState(BoxState.Collapsed) }
433430
currentState.targetState = BoxState.Expanded
434-
val transition = updateTransition(currentState, label = "box state")
431+
val transition = rememberTransition(currentState, label = "box state")
435432
// ……
436433
// [END android_compose_animations_transitions_state]
437434
}
@@ -663,8 +660,8 @@ private fun AnimationSpecKeyframe() {
663660
targetValue = 1f,
664661
animationSpec = keyframes {
665662
durationMillis = 375
666-
0.0f at 0 with LinearOutSlowInEasing // for 0-15 ms
667-
0.2f at 15 with FastOutLinearInEasing // for 15-75 ms
663+
0.0f at 0 using LinearOutSlowInEasing // for 0-15 ms
664+
0.2f at 15 using FastOutLinearInEasing // for 15-75 ms
668665
0.4f at 75 // ms
669666
0.4f at 225 // ms
670667
}

compose/snippets/src/main/java/com/example/compose/snippets/animations/sharedelement/SharedElementsWithNavigationSnippets.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ private fun DetailsScreen(
118118
painterResource(id = snack.image),
119119
contentDescription = snack.description,
120120
contentScale = ContentScale.Crop,
121-
modifier = Modifier.Companion
121+
modifier = Modifier
122122
.sharedElement(
123123
sharedTransitionScope.rememberSharedContentState(key = "image-$id"),
124124
animatedVisibilityScope = animatedContentScope
@@ -129,7 +129,7 @@ private fun DetailsScreen(
129129
Text(
130130
snack.name, fontSize = 18.sp,
131131
modifier =
132-
Modifier.Companion
132+
Modifier
133133
.sharedElement(
134134
sharedTransitionScope.rememberSharedContentState(key = "text-$id"),
135135
animatedVisibilityScope = animatedContentScope
@@ -164,7 +164,7 @@ private fun HomeScreen(
164164
painterResource(id = item.image),
165165
contentDescription = item.description,
166166
contentScale = ContentScale.Crop,
167-
modifier = Modifier.Companion
167+
modifier = Modifier
168168
.sharedElement(
169169
sharedTransitionScope.rememberSharedContentState(key = "image-$index"),
170170
animatedVisibilityScope = animatedContentScope

compose/snippets/src/main/java/com/example/compose/snippets/architecture/ArchitectureSnippets.kt

+9-8
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@ package com.example.compose.snippets.architecture
1818

1919
import androidx.compose.foundation.layout.fillMaxSize
2020
import androidx.compose.foundation.layout.wrapContentSize
21-
import androidx.compose.material.Icon
22-
import androidx.compose.material.IconButton
23-
import androidx.compose.material.OutlinedTextField
24-
import androidx.compose.material.Text
25-
import androidx.compose.material.TopAppBar
2621
import androidx.compose.material.icons.Icons
27-
import androidx.compose.material.icons.filled.ArrowBack
22+
import androidx.compose.material.icons.automirrored.filled.ArrowBack
23+
import androidx.compose.material3.ExperimentalMaterial3Api
24+
import androidx.compose.material3.Icon
25+
import androidx.compose.material3.IconButton
26+
import androidx.compose.material3.OutlinedTextField
27+
import androidx.compose.material3.Text
28+
import androidx.compose.material3.TopAppBar
2829
import androidx.compose.runtime.Composable
2930
import androidx.compose.runtime.State
3031
import androidx.compose.runtime.getValue
@@ -70,7 +71,7 @@ private object ArchitectureSnippets2 {
7071

7172
private object ArchitectureSnippets3 {
7273
val localizedString = ""
73-
74+
@OptIn(ExperimentalMaterial3Api::class)
7475
// [START android_compose_architecture_architecture3]
7576
@Composable
7677
fun MyAppTopAppBar(topAppBarText: String, onBackPressed: () -> Unit) {
@@ -87,7 +88,7 @@ private object ArchitectureSnippets3 {
8788
navigationIcon = {
8889
IconButton(onClick = onBackPressed) {
8990
Icon(
90-
Icons.Filled.ArrowBack,
91+
Icons.AutoMirrored.Filled.ArrowBack,
9192
contentDescription = localizedString
9293
)
9394
}

compose/snippets/src/main/java/com/example/compose/snippets/components/Card.kt

+1-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.example.topcomponents
17+
package com.example.compose.snippets.components
1818

1919
import android.util.Log
2020
import androidx.compose.foundation.BorderStroke
@@ -27,7 +27,6 @@ import androidx.compose.foundation.shape.RoundedCornerShape
2727
import androidx.compose.material3.Card
2828
import androidx.compose.material3.CardDefaults
2929
import androidx.compose.material3.ElevatedCard
30-
import androidx.compose.material3.ExperimentalMaterial3Api
3130
import androidx.compose.material3.MaterialTheme
3231
import androidx.compose.material3.OutlinedCard
3332
import androidx.compose.material3.Text
@@ -55,7 +54,6 @@ fun CardExamples() {
5554
}
5655
}
5756

58-
@OptIn(ExperimentalMaterial3Api::class)
5957
// [START android_compose_components_customcard]
6058
@Composable
6159
fun CustomCardExample(event: () -> Unit) {

compose/snippets/src/main/java/com/example/compose/snippets/components/Chip.kt

-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import androidx.compose.material.icons.filled.Person
2929
import androidx.compose.material.icons.filled.Settings
3030
import androidx.compose.material3.AssistChip
3131
import androidx.compose.material3.AssistChipDefaults
32-
import androidx.compose.material3.ExperimentalMaterial3Api
3332
import androidx.compose.material3.FilterChip
3433
import androidx.compose.material3.FilterChipDefaults
3534
import androidx.compose.material3.Icon
@@ -86,7 +85,6 @@ fun AssistChipExample() {
8685
}
8786
// [END android_compose_components_assistchip]
8887

89-
@OptIn(ExperimentalMaterial3Api::class)
9088
@Preview
9189
// [START android_compose_components_filterchip]
9290
@Composable
@@ -116,7 +114,6 @@ fun FilterChipExample() {
116114

117115
// You could set this up similarly to the filter chip above and have it toggleable, but this is
118116
// an example of a chip that can dismiss with a click.
119-
@OptIn(ExperimentalMaterial3Api::class)
120117
// [START android_compose_components_inputchip]
121118
@Composable
122119
fun InputChipExample(

compose/snippets/src/main/java/com/example/compose/snippets/components/Dialog.kt

-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import androidx.compose.material.icons.filled.Info
3232
import androidx.compose.material3.AlertDialog
3333
import androidx.compose.material3.Button
3434
import androidx.compose.material3.Card
35-
import androidx.compose.material3.ExperimentalMaterial3Api
3635
import androidx.compose.material3.Icon
3736
import androidx.compose.material3.MaterialTheme
3837
import androidx.compose.material3.Surface
@@ -220,7 +219,6 @@ fun DialogWithImage(
220219
// [END android_compose_components_dialogwithimage]
221220

222221
// [START android_compose_components_alertdialog]
223-
@OptIn(ExperimentalMaterial3Api::class)
224222
@Composable
225223
fun AlertDialogExample(
226224
onDismissRequest: () -> Unit,

compose/snippets/src/main/java/com/example/compose/snippets/designsystems/AppCompatThemeSnippets.kt

-38
This file was deleted.

compose/snippets/src/main/java/com/example/compose/snippets/designsystems/CustomDesignSystem.kt

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import androidx.compose.ui.text.TextStyle
3838
import androidx.compose.ui.unit.Dp
3939
import androidx.compose.ui.unit.dp
4040
import androidx.compose.ui.unit.sp
41-
import com.example.compose.snippets.designsystems.FullyCustomDesignSystem.CustomTheme.elevation
4241

4342
/*
4443
* Copyright 2022 The Android Open Source Project

0 commit comments

Comments
 (0)