From e44dbc6d90a2953597c6fd2d76b47103cdf42b4c Mon Sep 17 00:00:00 2001 From: Android Dev Date: Wed, 12 Nov 2025 00:00:00 +0700 Subject: [PATCH] M3 migration (#11) --- app/build.gradle | 28 +-- app/src/main/AndroidManifest.xml | 11 +- app/src/main/ic_launcher-playstore.png | Bin 32784 -> 31082 bytes .../com/example/superheroes/HeroesScreen.kt | 32 +-- .../com/example/superheroes/MainActivity.kt | 107 +++++----- .../com/example/superheroes/model/Hero.kt | 8 +- .../superheroes/model/HeroesDataSource.kt | 5 +- .../com/example/superheroes/ui/theme/Color.kt | 72 +++++-- .../com/example/superheroes/ui/theme/Shape.kt | 9 +- .../com/example/superheroes/ui/theme/Theme.kt | 126 ++++++++--- .../com/example/superheroes/ui/theme/Type.kt | 34 +-- .../main/res/drawable/android_superhero1.xml | 197 ++++++++++++------ .../main/res/drawable/android_superhero2.xml | 7 +- .../main/res/drawable/android_superhero3.xml | 7 +- .../main/res/drawable/android_superhero4.xml | 7 +- .../main/res/drawable/android_superhero5.xml | 7 +- .../main/res/drawable/android_superhero6.xml | 7 +- .../res/drawable/ic_launcher_background.xml | 20 +- .../res/drawable/ic_launcher_foreground.xml | 19 +- .../res/mipmap-anydpi-v26/ic_launcher.xml | 8 +- .../mipmap-anydpi-v26/ic_launcher_round.xml | 8 +- app/src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 2987 bytes .../res/mipmap-hdpi/ic_launcher_round.png | Bin 0 -> 5016 bytes app/src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 2119 bytes .../res/mipmap-mdpi/ic_launcher_round.png | Bin 0 -> 3179 bytes app/src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 3946 bytes .../res/mipmap-xhdpi/ic_launcher_round.png | Bin 0 -> 7173 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 6286 bytes .../res/mipmap-xxhdpi/ic_launcher_round.png | Bin 0 -> 11499 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 8710 bytes .../res/mipmap-xxxhdpi/ic_launcher_round.png | Bin 0 -> 16432 bytes app/src/main/res/values-night-v23/themes.xml | 22 -- app/src/main/res/values-night/themes.xml | 22 -- app/src/main/res/values-v23/themes.xml | 23 -- app/src/main/res/values/colors.xml | 10 +- app/src/main/res/values/strings.xml | 7 +- app/src/main/res/values/themes.xml | 12 +- build.gradle | 21 +- gradle.properties | 10 +- gradle/wrapper/gradle-wrapper.properties | 20 +- settings.gradle | 8 +- 41 files changed, 492 insertions(+), 382 deletions(-) create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png delete mode 100644 app/src/main/res/values-night-v23/themes.xml delete mode 100644 app/src/main/res/values-night/themes.xml delete mode 100644 app/src/main/res/values-v23/themes.xml diff --git a/app/build.gradle b/app/build.gradle index ef2b5e9..e6c8a29 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,10 +1,10 @@ /* - * Copyright (c) 2022 The Android Open Source Project + * Copyright (C) 2023 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 * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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, @@ -19,15 +19,17 @@ plugins { } android { + namespace 'com.example.superheroes' compileSdk 33 defaultConfig { applicationId "com.example.superheroes" - minSdk 21 + minSdk 24 targetSdk 33 versionCode 1 versionName "1.0" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { useSupportLibrary true } @@ -45,29 +47,29 @@ android { } kotlinOptions { jvmTarget = '1.8' + freeCompilerArgs += "-opt-in=androidx.compose.material3.ExperimentalMaterial3Api" } buildFeatures { compose true } composeOptions { - kotlinCompilerExtensionVersion compose_version + kotlinCompilerExtensionVersion '1.4.3' } packagingOptions { resources { excludes += '/META-INF/{AL2.0,LGPL2.1}' } } - namespace 'com.example.superheroes' } dependencies { - // Import the Compose BOM - implementation platform('androidx.compose:compose-bom:2023.01.00') - + implementation platform('androidx.compose:compose-bom:2022.10.00') implementation 'androidx.activity:activity-compose:1.6.1' - implementation "androidx.compose.material:material" - implementation "androidx.compose.ui:ui" - implementation "androidx.compose.ui:ui-tooling-preview" + implementation 'androidx.compose.material3:material3' + implementation 'androidx.compose.ui:ui' + implementation 'androidx.compose.ui:ui-tooling-preview' implementation 'androidx.core:core-ktx:1.9.0' - debugImplementation "androidx.compose.ui:ui-tooling" -} \ No newline at end of file + + androidTestImplementation platform('androidx.compose:compose-bom:2022.10.00') + debugImplementation 'androidx.compose.ui:ui-tooling' +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f59ae6c..a0d6c33 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,11 +1,12 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml deleted file mode 100644 index a512787..0000000 --- a/app/src/main/res/values-night/themes.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - diff --git a/app/src/main/res/values-v23/themes.xml b/app/src/main/res/values-v23/themes.xml deleted file mode 100644 index 904de90..0000000 --- a/app/src/main/res/values-v23/themes.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 7bc3d6e..4bb7d46 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,11 +1,12 @@ - - #FFFDFCF4 - #FF1B1C18 - \ No newline at end of file + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d5f3a7f..c55931f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,10 +1,11 @@