Skip to content

Commit 95c5bed

Browse files
authored
Merge pull request #399 from android/riggaroo/anim-codelab-update
Update animation codelab
2 parents 34f67ca + 9d58445 commit 95c5bed

File tree

12 files changed

+322
-268
lines changed

12 files changed

+322
-268
lines changed

AnimationCodelab/finished/build.gradle

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ plugins {
2121

2222
android {
2323
namespace "com.example.android.codelab.animation"
24-
compileSdkVersion 34
24+
compileSdk 34
2525
defaultConfig {
2626
applicationId 'com.example.android.codelab.animation'
2727
minSdkVersion 21
28-
targetSdkVersion 33
28+
targetSdk 34
2929
versionCode 1
3030
versionName '1.0'
3131
}
@@ -51,17 +51,7 @@ dependencies {
5151
implementation 'androidx.activity:activity-compose:1.8.1'
5252
implementation 'androidx.core:core-ktx:1.12.0'
5353
implementation "androidx.compose.ui:ui"
54-
implementation "androidx.compose.material:material"
54+
implementation "androidx.compose.material3:material3"
5555
implementation "androidx.compose.ui:ui-tooling-preview"
5656
debugImplementation "androidx.compose.ui:ui-tooling"
5757
}
58-
59-
// Compiler flag to use experimental Compose APIs
60-
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
61-
kotlinOptions {
62-
jvmTarget = "1.8"
63-
freeCompilerArgs += [
64-
"-opt-in=kotlin.RequiresOptIn"
65-
]
66-
}
67-
}

AnimationCodelab/finished/src/main/java/com/example/android/codelab/animation/MainActivity.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@ package com.example.android.codelab.animation
1919
import android.os.Bundle
2020
import androidx.activity.ComponentActivity
2121
import androidx.activity.compose.setContent
22+
import androidx.activity.enableEdgeToEdge
2223
import com.example.android.codelab.animation.ui.AnimationCodelabTheme
2324
import com.example.android.codelab.animation.ui.home.Home
2425

2526
class MainActivity : ComponentActivity() {
2627

2728
override fun onCreate(savedInstanceState: Bundle?) {
2829
super.onCreate(savedInstanceState)
30+
enableEdgeToEdge()
2931
setContent {
3032
AnimationCodelabTheme {
3133
Home()

AnimationCodelab/finished/src/main/java/com/example/android/codelab/animation/ui/Color.kt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ package com.example.android.codelab.animation.ui
1818

1919
import androidx.compose.ui.graphics.Color
2020

21-
val Purple100 = Color(0xFFE1BEE7)
22-
val Purple500 = Color(0xFF6200EE)
23-
val Purple700 = Color(0xFF3700B3)
24-
val Teal200 = Color(0xFF03DAC5)
25-
val Green300 = Color(0xFF81C784)
26-
val Green800 = Color(0xFF2E7D32)
2721
val Amber600 = Color(0xFFFFB300)
22+
23+
val Melon = Color(0xFFfec5bb)
24+
val PaleDogwood = Color(0xFFfcd5ce)
25+
val Seashell = Color(0xFFf8edeb)
26+
val Peach = Color(0xFFfec89a)
27+
val Green = Color(0xFFd8e2dc)
28+
val GreenLight = Color(0xFFEBF1EE)

AnimationCodelab/finished/src/main/java/com/example/android/codelab/animation/ui/Theme.kt

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,22 @@
1616

1717
package com.example.android.codelab.animation.ui
1818

19-
import androidx.compose.material.MaterialTheme
20-
import androidx.compose.material.lightColors
19+
import androidx.compose.material3.MaterialTheme
20+
import androidx.compose.material3.lightColorScheme
2121
import androidx.compose.runtime.Composable
22+
import androidx.compose.ui.graphics.Color
2223

2324
@Composable
2425
fun AnimationCodelabTheme(content: @Composable () -> Unit) {
25-
val colors = lightColors(
26-
primary = Purple500,
27-
primaryVariant = Purple700,
28-
secondary = Teal200
26+
val colors = lightColorScheme(
27+
primary = Melon,
28+
primaryContainer = PaleDogwood,
29+
onPrimary = Color.Black,
30+
secondary = Peach,
31+
onSecondary = Color.Black
2932
)
3033
MaterialTheme(
31-
colors = colors,
34+
colorScheme = colors,
3235
content = content
3336
)
34-
}
37+
}

0 commit comments

Comments
 (0)