Skip to content

Commit

Permalink
Latest beta06 updates for Compose (#300)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
riggaroo and riggaroo authored Aug 28, 2024
1 parent c5d4717 commit 74aaf25
Show file tree
Hide file tree
Showing 43 changed files with 92 additions and 262 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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() {

Expand Down
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
4 changes: 1 addition & 3 deletions compose/recomposehighlighter/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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()
Expand Down Expand Up @@ -40,9 +41,6 @@ android {
viewBinding = true
}

composeOptions {
kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get()
}
}
dependencies {
val composeBom = platform(libs.androidx.compose.bom)
Expand Down
5 changes: 1 addition & 4 deletions compose/snippets/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
* limitations under the License.
*/

@file:OptIn(ExperimentalMaterial3AdaptiveNavigationSuiteApi::class)

package com.example.compose.snippets.adaptivelayouts

import androidx.annotation.StringRes
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -720,7 +719,6 @@ private fun LoadingScreen() {
}
}

@OptIn(ExperimentalComposeUiApi::class)
@Preview
@Composable
fun AnimationLayout() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -190,7 +191,6 @@ private fun AnimatedVisibilityMutable() {
// [END android_compose_animations_animated_visibility_mutable]
}

@OptIn(ExperimentalAnimationApi::class)
@Composable
@Preview
private fun AnimatedVisibilityAnimateEnterExitChildren() {
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -259,7 +258,6 @@ private fun AnimateAsStateSimple() {
// [END android_compose_animations_animate_as_state]
}

@OptIn(ExperimentalAnimationApi::class)
@Preview
@Composable
private fun AnimatedContentSimple() {
Expand All @@ -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]
Expand All @@ -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
Expand All @@ -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) {
Expand Down Expand Up @@ -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]
}
Expand Down Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand All @@ -87,7 +88,7 @@ private object ArchitectureSnippets3 {
navigationIcon = {
IconButton(onClick = onBackPressed) {
Icon(
Icons.Filled.ArrowBack,
Icons.AutoMirrored.Filled.ArrowBack,
contentDescription = localizedString
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -55,7 +54,6 @@ fun CardExamples() {
}
}

@OptIn(ExperimentalMaterial3Api::class)
// [START android_compose_components_customcard]
@Composable
fun CustomCardExample(event: () -> Unit) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -86,7 +85,6 @@ fun AssistChipExample() {
}
// [END android_compose_components_assistchip]

@OptIn(ExperimentalMaterial3Api::class)
@Preview
// [START android_compose_components_filterchip]
@Composable
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -220,7 +219,6 @@ fun DialogWithImage(
// [END android_compose_components_dialogwithimage]

// [START android_compose_components_alertdialog]
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun AlertDialogExample(
onDismissRequest: () -> Unit,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 74aaf25

Please sign in to comment.