diff --git a/app/build.gradle.kts b/app/build.gradle.kts index e7cb9cbd..00421800 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,5 +1,6 @@ plugins { id("yello.android.application") + id("yello.android.application.compose") id("yello.android.androidHilt") alias(libs.plugins.androidKotlin) } @@ -8,7 +9,4 @@ dependencies { implementation(project(":core-ui")) implementation(project(":data")) implementation(project(":domain")) - implementation(libs.androidx.appCompat) - implementation(libs.materialDesign) - implementation(libs.androidx.constraintLayout) } diff --git a/app/src/main/java/com/el/yello/util/extension/ImageViewExt.kt b/app/src/main/java/com/el/yello/util/extension/ImageViewExt.kt index 8cccfb80..fe2a8bb2 100644 --- a/app/src/main/java/com/el/yello/util/extension/ImageViewExt.kt +++ b/app/src/main/java/com/el/yello/util/extension/ImageViewExt.kt @@ -10,9 +10,10 @@ import com.el.yello.R fun ImageView.loadUrl(url: String) { if (url.endsWith(".svg")) { - val imageLoader = ImageLoader.Builder(this.context) - .componentRegistry { add(SvgDecoder(this@loadUrl.context)) } - .build() + val imageLoader = ImageLoader.Builder(context) + .components { + add(SvgDecoder.Factory()) + }.build() val request = ImageRequest.Builder(this.context) .crossfade(true) @@ -36,9 +37,11 @@ fun ImageView.loadUrlWithCircleCrop(url: String) { return } - val imageLoader = ImageLoader.Builder(this.context) - .componentRegistry { add(SvgDecoder(this@loadUrlWithCircleCrop.context)) } - .build() + val imageLoader = ImageLoader.Builder(context) + .components { + add(SvgDecoder.Factory()) + }.build() + val request = ImageRequest.Builder(this.context) .crossfade(true) diff --git a/build-logic/convention/build.gradle.kts b/build-logic/convention/build.gradle.kts index 6a9d309a..9a21353d 100644 --- a/build-logic/convention/build.gradle.kts +++ b/build-logic/convention/build.gradle.kts @@ -18,6 +18,10 @@ gradlePlugin { id = "yello.android.application" implementationClass = "plugins.AndroidApplicationPlugin" } + register("androidApplicationCompose") { + id = "yello.android.application.compose" + implementationClass = "plugins.AndroidApplicationComposePlugin" + } register("androidLibrary") { id = "yello.android.library" implementationClass = "plugins.AndroidLibraryPlugin" diff --git a/build-logic/convention/src/main/kotlin/plugins/AndroidApplicationComposePlugin.kt b/build-logic/convention/src/main/kotlin/plugins/AndroidApplicationComposePlugin.kt new file mode 100644 index 00000000..08cbb654 --- /dev/null +++ b/build-logic/convention/src/main/kotlin/plugins/AndroidApplicationComposePlugin.kt @@ -0,0 +1,45 @@ +package plugins + +import com.android.build.api.dsl.ApplicationExtension +import ext.androidTestImplementation +import ext.debugImplementation +import ext.getBundle +import ext.getLibrary +import ext.getVersionCatalog +import ext.implementation +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.api.artifacts.VersionCatalogsExtension +import org.gradle.kotlin.dsl.dependencies +import org.gradle.kotlin.dsl.getByType + +/** + * Android Application 모듈에 compose를 사용할 경우 적용할 Plugin + * + * plugin id : [yello.android.application.compose] + */ +class AndroidApplicationComposePlugin : Plugin { + override fun apply(target: Project) { + with(target) { + extensions.getByType().apply { + buildFeatures { + compose = true + } + + composeOptions { + kotlinCompilerExtensionVersion = "1.5.11" + } + } + val libs = extensions.getVersionCatalog() + dependencies { + val composeBom = platform(libs.getLibrary("compose-bom")) + implementation(composeBom) + androidTestImplementation(composeBom) + implementation(libs.getBundle("compose-bom-bundle")) + debugImplementation(libs.getLibrary("compose-bom-debug-ui-tooling")) + androidTestImplementation(libs.getLibrary("compose-bom-debug-ui-test-manifest")) + implementation(libs.getBundle("compose")) + } + } + } +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b60fe7ee..fb637728 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,7 +1,7 @@ [versions] buildToolsVersion = "34.0.0" ## Kotlin -kotlinVersion = "1.8.20" +kotlinVersion = "1.9.23" kotlinSerializationJsonVersion = "1.5.1" coroutinesAndroidVersion = "1.7.1" kotlinDateTimeVersion = "0.4.0" @@ -23,16 +23,27 @@ pagingVersion = "3.1.1" lifecycleVersion = "2.6.1" ossVersion = "17.0.0" splashVersion = "1.0.0-beta01" -composeVersion = "1.4.3" workManagerVersion = "2.8.1" billingVersion = "6.0.1" admobVersion = "21.5.0" +## Compose +composeActivityVersion = "1.9.0" +composeAnimationVersion = "1.6.8" +composeViewModelVersion = "2.7.0" +composeBom = "2024.06.00" +composeCoil = "2.6.0" +composeConstraintLayoutVersion = "1.0.1" +composeLottieVersion = "6.0.1" +composeCompilerVersion = "1.5.11" +composeNavigation = "2.7.7" +composeHiltVersion= "1.2.0" + ## Firebase firebaseVersion = "30.4.0" ## Third-party -coilVersion = "1.2.0" +coilVersion = "2.6.0" retrofitVersion = "2.11.0" kotlinSerializationConverterVersion = "1.0.0" okHttpVersion = "4.12.0" @@ -148,20 +159,28 @@ firebase-crashlytics = { group = "com.google.firebase", name = "firebase-crashly firebase-analytics = { group = "com.google.firebase", name = "firebase-analytics-ktx"} firebase-remoteConfig = { group = "com.google.firebase", name = "firebase-config-ktx"} -compose-activity = { group = "androidx.activity", name = "activity-compose", version.ref = "activityKtxVersion" } -compose-material = { group = "androidx.compose.material", name = "material", version.ref = "composeVersion" } -compose-animation = { group = "androidx.compose.animation", name = "animation", version.ref = "composeVersion" } -compose-ui = { group = "androidx.compose.ui", name = "ui", version.ref = "composeVersion" } -compose-ui-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview", version.ref = "composeVersion" } -compose-foundation = { group = "androidx.compose.foundation", name = "foundation", version.ref = "composeVersion" } -compose-material-core = { group = "androidx.compose.material", name = "material-icons-core", version.ref = "composeVersion" } -compose-material-extended = { group = "androidx.compose.material", name = "material-icons-extended", version.ref = "composeVersion" } -compose-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout-compose", version.ref = "composeVersion" } -compose-lifecycle = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-compose", version.ref = "composeVersion" } -compose-hilt= { group = "androidx.hilt", name = "hilt-navigation-compose", version.ref = "composeVersion" } -compose-paging = { group = "androidx.paging", name = "paging-compose", version.ref = "composeVersion" } -compose-coil = { group = "io.coil-kt", name = "coil-compose", version.ref = "composeVersion" } -compose-lottie = { group = "com.airbnb.android", name = "lottie-compose", version.ref = "lottieVersion" } +## Compose +compose-activity = { group = "androidx.activity", name = "activity-compose", version.ref = "composeActivityVersion" } +compose-animation = { group = "androidx.compose.animation", name = "animation", version.ref = "composeAnimationVersion" } +compose-viewModel = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-compose", version.ref = "composeViewModelVersion" } +compose-coil = {group = "io.coil-kt", name = "coil-compose", version.ref = "composeCoil"} +compose-constraintLayout = { group = "androidx.constraintlayout", name = "constraintlayout-compose", version.ref = "composeConstraintLayoutVersion"} +compose-lottie = { group = "com.airbnb.android", name = "lottie-compose", version.ref = "composeLottieVersion"} +compose-navigation = { group = "androidx.navigation", name = "navigation-compose", version.ref = "composeNavigation"} +compose-hilt= { group = "androidx.hilt", name = "hilt-navigation-compose", version.ref = "composeHiltVersion" } +compose-compiler-extension = { module = "org.jetbrains.kotlin:compose-compiler-gradle-plugin", version.ref = "kotlinVersion" } + +## Compose Bom +compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" } +compose-bom-material3 = {group = "androidx.compose.material3", name = "material3"} +compose-bom-material2 = {group = "androidx.compose.material", name = "material"} +compose-bom-ui = {group = "androidx.compose.ui", name = "ui"} +compose-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" } +compose-bom-preview = {group = "androidx.compose.ui", name = "ui-tooling-preview"} +compose-bom-debug-ui-tooling = {group = "androidx.compose.ui", name = "ui-tooling"} +compose-bom-ui-test = {group = "androidx.compose.ui", name = "ui-test-junit4"} +compose-bom-debug-ui-test-manifest = {group = "androidx.compose.ui", name="ui-test-manifest"} +compose-runtime = {group = "androidx.compose.runtime", name="runtime"} ## Test @@ -200,21 +219,25 @@ androidx = [ "admob" ] +## Compose compose = [ "compose-activity", "compose-animation", - "compose-foundation", - "compose-material", - "compose-material-core", - "compose-material-extended", - "compose-ui", - "compose-ui-preview", - "compose-constraintlayout", - "compose-hilt", - "compose-lifecycle", - "compose-paging", + "compose-viewModel", "compose-coil", - "compose-lottie" + "compose-hilt", + "compose-constraintLayout", + "compose-lottie", + "compose-navigation"] + +## Compose Bom +compose-bom-bundle = [ + "compose-bom-material3", + "compose-bom-material2", + "compose-ui-graphics", + "compose-bom-ui", + "compose-bom-preview", + "compose-runtime" ] kakao = [