diff --git a/app/build.gradle b/app/build.gradle index ef31eca..b65c43e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,10 +1,9 @@ plugins { - id 'com.android.application' - id 'org.jetbrains.kotlin.android' - id 'com.google.devtools.ksp' - id 'kotlin-parcelize' - id 'dev.shreyaspatil.compose-compiler-report-generator' - id 'androidx.baselineprofile' + alias(libs.plugins.android.application) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.ksp) + alias(libs.plugins.kotlin.parcelize) + alias(libs.plugins.androidx.baselineprofile) } def final debugAppSuffix = ".debug" @@ -65,6 +64,7 @@ android { } buildFeatures { compose true + buildConfig true } composeOptions { kotlinCompilerExtensionVersion = "1.5.4" @@ -83,69 +83,62 @@ baselineProfile { baselineProfileOutputDir = "../../src/main/baselineProfiles" } -def rootConfiguration = rootProject.ext - dependencies { - implementation 'androidx.core:core-ktx:1.12.0' - implementation platform("androidx.compose:compose-bom:${rootConfiguration.compose_bom_version}") - implementation "androidx.compose.ui:ui" - implementation "androidx.compose.material:material" - implementation "androidx.compose.ui:ui-tooling-preview" - implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.2' - implementation 'androidx.activity:activity-compose:1.8.0' - testImplementation 'junit:junit:4.13.2' - - androidTestImplementation 'androidx.test.ext:junit:1.1.5' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' + implementation libs.androidx.core.ktx + implementation platform(libs.compose.bom) + implementation libs.compose.ui + implementation libs.androidx.compose.material + implementation libs.androidx.compose.ui.tooling.preview + implementation libs.androidx.lifecycle.runtime.ktx + implementation libs.androidx.activity.compose + testImplementation libs.junit + + androidTestImplementation libs.androidx.junit + androidTestImplementation libs.androidx.espresso.core baselineProfile project(':baselineprofile') - debugImplementation "androidx.compose.ui:ui-tooling" - debugImplementation "androidx.compose.ui:ui-test-manifest" - implementation "androidx.navigation:navigation-compose:${rootConfiguration.nav_version}" - implementation "androidx.compose.material:material-icons-extended" - implementation "androidx.compose.material3:material3" - implementation "androidx.compose.runtime:runtime-tracing:$compose_tracing" - - implementation "androidx.lifecycle:lifecycle-viewmodel-compose:${rootConfiguration.compose_viewmodel}" - implementation "androidx.constraintlayout:constraintlayout-compose:1.0.1" - - implementation "io.coil-kt:coil:${rootConfiguration.coil_version}" - implementation "io.coil-kt:coil-compose:${rootConfiguration.coil_version}" - - implementation "com.squareup.moshi:moshi-kotlin:${rootConfiguration.moshi_version}" - ksp "com.squareup.moshi:moshi-kotlin-codegen:${rootConfiguration.moshi_version}" - - implementation "org.orbit-mvi:orbit-viewmodel:${rootConfiguration.orbit_version}" - implementation("org.orbit-mvi:orbit-compose:${rootConfiguration.orbit_version}") - - implementation "com.squareup.retrofit2:retrofit:${rootConfiguration.retrofit_version}" - implementation "com.squareup.retrofit2:converter-moshi:2.9.0" - implementation "com.squareup.okhttp3:logging-interceptor:4.9.1" - - implementation "org.jetbrains.kotlinx:kotlinx-datetime:${date_time_version}" - - implementation "androidx.room:room-runtime:${rootConfiguration.room_version}" - ksp "androidx.room:room-compiler:${rootConfiguration.room_version}" - implementation("androidx.room:room-ktx:${rootConfiguration.room_version}") - - implementation "io.insert-koin:koin-android:$koin_android_version" - implementation "io.insert-koin:koin-androidx-compose:$koin_android_version" - - implementation "androidx.work:work-runtime-ktx:$work_version" - - implementation "androidx.browser:browser:${rootConfiguration.browser}" - - implementation "androidx.profileinstaller:profileinstaller:${rootConfiguration.profile_installer}" - - implementation "androidx.startup:startup-runtime:${rootConfiguration.startup_runtime}" - - debugImplementation "com.plutolib:pluto:${rootConfiguration.pluto}" - benchmarkImplementation "com.plutolib:pluto-no-op:${rootConfiguration.pluto}" - releaseImplementation "com.plutolib:pluto-no-op:${rootConfiguration.pluto}" - - debugImplementation "com.plutolib.plugins:bundle-core:${rootConfiguration.pluto}" - benchmarkImplementation "com.plutolib.plugins:bundle-core-no-op:${rootConfiguration.pluto}" - releaseImplementation "com.plutolib.plugins:bundle-core-no-op:${rootConfiguration.pluto}" - - implementation "androidx.datastore:datastore-preferences:1.0.0" + debugImplementation libs.androidx.compose.ui.tooling + debugImplementation libs.androidx.compose.ui.test.manifest + implementation libs.androidx.navigation.compose + implementation libs.androidx.compose.material.icons.extended + implementation libs.androidx.compose.material3 + implementation libs.androidx.lifecycle.viewmodel.compose + implementation libs.androidx.constraintlayout.compose + + implementation libs.androidx.work.runtime.ktx + implementation libs.androidx.browser + implementation libs.androidx.profileinstaller + implementation libs.androidx.startup.runtime + implementation libs.androidx.datastore.preferences + implementation libs.androidx.runtime.tracing + + implementation libs.coil + implementation libs.coil.compose + + implementation libs.moshi.kotlin + ksp libs.moshi.codegen + + implementation libs.orbit.viewmodel + implementation libs.orbit.compose + + implementation libs.retrofit + implementation libs.converter.moshi + implementation libs.logging.interceptor + + implementation libs.kotlinx.datetime + + implementation libs.androidx.room.runtime + ksp libs.androidx.room.compiler + implementation libs.androidx.room.ktx + + implementation libs.koin.android + implementation libs.koin.androidx.compose + + debugImplementation libs.pluto + benchmarkImplementation libs.pluto.no.op + releaseImplementation libs.pluto.no.op + + debugImplementation libs.bundle.core + benchmarkImplementation libs.bundle.core.no.op + releaseImplementation libs.bundle.core.no.op } \ No newline at end of file diff --git a/app/src/main/java/com/rob729/newsfeed/ui/components/NewsSourceBottomSheetContent.kt b/app/src/main/java/com/rob729/newsfeed/ui/components/NewsSourceBottomSheetContent.kt index b888599..acbf67d 100644 --- a/app/src/main/java/com/rob729/newsfeed/ui/components/NewsSourceBottomSheetContent.kt +++ b/app/src/main/java/com/rob729/newsfeed/ui/components/NewsSourceBottomSheetContent.kt @@ -11,13 +11,10 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyRow import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalConfiguration import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.testTag -import androidx.compose.ui.semantics.semantics -import androidx.compose.ui.semantics.testTagsAsResourceId import androidx.compose.ui.unit.dp import com.rob729.newsfeed.utils.Constants @@ -37,7 +34,12 @@ fun NewsSourceBottomSheetContent( contentAlignment = Alignment.Center ) { Column { - LazyRow(modifier = Modifier.testTag("news_source_list").padding(top = 12.dp, bottom = 6.dp), horizontalArrangement = Arrangement.spacedBy(itemSpacing.dp)) { + LazyRow( + modifier = Modifier + .testTag("news_source_list") + .padding(top = 12.dp, bottom = 6.dp), + horizontalArrangement = Arrangement.spacedBy(itemSpacing.dp) + ) { items(Constants.newsSourceUiDataLists.size, { index: Int -> newsSourceList[index].domain }) { index -> NewsSourcePill( diff --git a/baselineprofile/build.gradle b/baselineprofile/build.gradle index 4bfa940..624e844 100644 --- a/baselineprofile/build.gradle +++ b/baselineprofile/build.gradle @@ -1,7 +1,7 @@ plugins { - id 'com.android.test' - id 'org.jetbrains.kotlin.android' - id 'androidx.baselineprofile' + alias(libs.plugins.android.test) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.androidx.baselineprofile) } android { @@ -35,9 +35,9 @@ baselineProfile { } dependencies { - implementation 'androidx.test.ext:junit:1.1.5' - implementation 'androidx.test.espresso:espresso-core:3.5.1' - implementation 'androidx.test.uiautomator:uiautomator:2.2.0' - implementation 'androidx.benchmark:benchmark-macro-junit4:1.2.0' - implementation 'androidx.test:rules:1.5.0' + implementation libs.androidx.junit + implementation libs.androidx.espresso.core + implementation libs.androidx.uiautomator + implementation libs.androidx.benchmark.macro.junit4 + implementation libs.androidx.rules } \ No newline at end of file diff --git a/build.gradle b/build.gradle index b561cb2..70dea0a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,33 +1,11 @@ -buildscript { - ext { - kotlin_version = '1.9.20' - compose_bom_version = '2023.10.01' - ksp_version = '1.9.20-1.0.14' - coil_version = '2.4.0' - moshi_version = '1.15.0' - compose_tracing = '1.0.0-alpha03' - compose_viewmodel = '2.6.2' - orbit_version = '6.1.0' - retrofit_version = '2.9.0' - nav_version = '2.7.5' - date_time_version = '0.4.1' - room_version = '2.6.0' - koin_android_version= '3.5.0' - work_version = '2.8.1' - browser = '1.7.0-rc01' - profile_installer = '1.3.1' - startup_runtime = "1.1.1" - pluto = "2.1.9" - } -}// Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { - id 'com.android.application' version '8.3.0-alpha13' apply false - id 'com.android.library' version '8.3.0-alpha13' apply false - id 'org.jetbrains.kotlin.android' version "$kotlin_version" apply false - id 'com.google.devtools.ksp' version "$ksp_version" - id 'com.android.test' version '8.3.0-alpha13' apply false - id 'dev.shreyaspatil.compose-compiler-report-generator' version "1.1.0" apply false - id 'androidx.baselineprofile' version '1.2.1' apply false + alias(libs.plugins.android.application) apply false + alias(libs.plugins.android.library) apply false + alias(libs.plugins.kotlin.android) apply false + alias(libs.plugins.ksp) + alias(libs.plugins.android.test) apply false + alias(libs.plugins.androidx.baselineprofile) apply false + alias(libs.plugins.kotlin.parcelize) apply false } task clean(type: Delete) { diff --git a/gradle.properties b/gradle.properties index 752b108..9d22d93 100644 --- a/gradle.properties +++ b/gradle.properties @@ -22,7 +22,6 @@ kotlin.code.style=official # thereby reducing the size of the R class for that library android.nonTransitiveRClass=true NEWS_FEED_API_KEY="4663b6001744472eaac1f5aa16076a7a" -android.defaults.buildfeatures.buildconfig=true android.nonFinalResIds=false org.gradle.unsafe.configuration-cache=true android.suppressUnsupportedCompileSdk=34 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..75e5eb5 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,87 @@ +[versions] +activityCompose = "1.8.0" +androidGradlePlugin = "8.3.0-alpha13" +baselineProfile = "1.2.1" +benchmarkMacroJunit4 = "1.2.0" +browser = "1.7.0-rc01" +coil = "2.4.0" +constraintlayoutCompose = "1.0.1" +coreKtx = "1.12.0" +datastorePreferences = "1.0.0" +espressoCore = "3.5.1" +junit = "4.13.2" +junitVersion = "1.1.5" +koinAndroid = "3.5.0" +kotlin = "1.9.20" +kotlinx-datetime = "0.4.1" +ksp = "1.9.20-1.0.14" +lifecycleViewmodelCompose = "2.6.2" +loggingInterceptor = "4.9.1" +moshiKotlin = "1.15.0" +navigationCompose = "2.7.5" +orbitViewmodel = "6.1.0" +pluto = "2.1.9" +profileinstaller = "1.3.1" +retrofit = "2.9.0" +roomRuntime = "2.6.0" +rules = "1.5.0" +runtimeTracing = "1.0.0-alpha03" +startupRuntime = "1.1.1" +uiautomator = "2.2.0" +workRuntimeKtx = "2.8.1" + +[libraries] +androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "activityCompose" } +androidx-benchmark-macro-junit4 = { module = "androidx.benchmark:benchmark-macro-junit4", version.ref = "benchmarkMacroJunit4" } +androidx-browser = { module = "androidx.browser:browser", version.ref = "browser" } +androidx-compose-material = { module = "androidx.compose.material:material" } +androidx-compose-material3 = { module = "androidx.compose.material3:material3" } +androidx-compose-material-icons-extended = { module = "androidx.compose.material:material-icons-extended" } +androidx-compose-ui-test-manifest = { module = "androidx.compose.ui:ui-test-manifest" } +androidx-compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling" } +androidx-compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview" } +androidx-constraintlayout-compose = { module = "androidx.constraintlayout:constraintlayout-compose", version.ref = "constraintlayoutCompose" } +androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "coreKtx" } +androidx-datastore-preferences = { module = "androidx.datastore:datastore-preferences", version.ref = "datastorePreferences" } +androidx-espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "espressoCore" } +androidx-junit = { module = "androidx.test.ext:junit", version.ref = "junitVersion" } +androidx-lifecycle-runtime-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "lifecycleViewmodelCompose" } +androidx-lifecycle-viewmodel-compose = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "lifecycleViewmodelCompose" } +androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "navigationCompose" } +androidx-profileinstaller = { module = "androidx.profileinstaller:profileinstaller", version.ref = "profileinstaller" } +androidx-room-ktx = { module = "androidx.room:room-ktx", version.ref = "roomRuntime" } +androidx-room-runtime = { module = "androidx.room:room-runtime", version.ref = "roomRuntime" } +androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "roomRuntime" } +androidx-rules = { module = "androidx.test:rules", version.ref = "rules" } +androidx-runtime-tracing = { module = "androidx.compose.runtime:runtime-tracing", version.ref = "runtimeTracing" } +androidx-startup-runtime = { module = "androidx.startup:startup-runtime", version.ref = "startupRuntime" } +androidx-uiautomator = { module = "androidx.test.uiautomator:uiautomator", version.ref = "uiautomator" } +androidx-work-runtime-ktx = { module = "androidx.work:work-runtime-ktx", version.ref = "workRuntimeKtx" } +bundle-core = { module = "com.plutolib.plugins:bundle-core", version.ref = "pluto" } +bundle-core-no-op = { module = "com.plutolib.plugins:bundle-core-no-op", version.ref = "pluto" } +coil = { module = "io.coil-kt:coil", version.ref = "coil" } +coil-compose = { module = "io.coil-kt:coil-compose", version.ref = "coil" } +compose-bom = "androidx.compose:compose-bom:2023.10.01" +compose-ui = { module = "androidx.compose.ui:ui" } +converter-moshi = { module = "com.squareup.retrofit2:converter-moshi", version.ref = "retrofit" } +junit = { module = "junit:junit", version.ref = "junit" } +koin-android = { module = "io.insert-koin:koin-android", version.ref = "koinAndroid" } +koin-androidx-compose = { module = "io.insert-koin:koin-androidx-compose", version.ref = "koinAndroid" } +logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "loggingInterceptor" } +moshi-kotlin = { module = "com.squareup.moshi:moshi-kotlin", version.ref = "moshiKotlin" } +moshi-codegen = { module = "com.squareup.moshi:moshi-kotlin-codegen", version.ref = "moshiKotlin" } +orbit-compose = { module = "org.orbit-mvi:orbit-compose", version.ref = "orbitViewmodel" } +orbit-viewmodel = { module = "org.orbit-mvi:orbit-viewmodel", version.ref = "orbitViewmodel" } +kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinx-datetime" } +pluto = { module = "com.plutolib:pluto", version.ref = "pluto" } +pluto-no-op = { module = "com.plutolib:pluto-no-op", version.ref = "pluto" } +retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" } + +[plugins] +android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" } +android-test = { id = "com.android.test", version.ref = "androidGradlePlugin" } +android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" } +kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } +kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" } +androidx-baselineprofile = { id = "androidx.baselineprofile", version.ref = "baselineProfile" } \ No newline at end of file