From 28b718da0f43d8f4240113d7e4fd129875e875dd Mon Sep 17 00:00:00 2001 From: Maxr1998 Date: Thu, 13 May 2021 17:39:57 +0200 Subject: [PATCH] Setup compose build environment and dependencies --- app/build.gradle.kts | 13 ++++++++++++- build.gradle.kts | 2 ++ gradle/libs.versions.toml | 31 +++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 5a6eeb89..71975f28 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -6,6 +6,7 @@ plugins { id("com.android.application") kotlin("android") kotlin("kapt") + id("androidx.navigation.safeargs.kotlin") id("kotlin-parcelize") id(Plugins.detekt) version Plugins.Versions.detekt id(Plugins.androidJunit5) @@ -27,7 +28,7 @@ detekt { } android { - compileSdk = 30 + compileSdk = 31 defaultConfig { applicationId = "org.jellyfin.mobile" minSdk = 21 @@ -86,11 +87,15 @@ android { @Suppress("UnstableApiUsage") buildFeatures { viewBinding = true + compose = true } kotlinOptions { @Suppress("SuspiciousCollectionReassignment") freeCompilerArgs += listOf("-Xopt-in=kotlin.RequiresOptIn") } + composeOptions { + kotlinCompilerExtensionVersion = libs.versions.compose.get() + } compileOptions { isCoreLibraryDesugaringEnabled = true } @@ -123,8 +128,14 @@ dependencies { implementation(libs.google.material) implementation(libs.androidx.constraintlayout) implementation(libs.androidx.webkit) + implementation(libs.androidx.palette) implementation(libs.modernandroidpreferences) + // Jetpack Compose + implementation(libs.bundles.compose) + implementation(libs.navigation.compose) + implementation(libs.bundles.accompanist) + // Network val sdkVersion = findProperty("sdk.version")?.toString() implementation(libs.jellyfin.sdk) { diff --git a/build.gradle.kts b/build.gradle.kts index 5f26a585..ed855bd4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,6 +9,7 @@ buildscript { val kotlinVersion: String by project classpath("com.android.tools.build:gradle:7.0.1") classpath(kotlin("gradle-plugin", kotlinVersion)) + classpath("androidx.navigation:navigation-safe-args-gradle-plugin:2.3.5") classpath("de.mannodermaus.gradle.plugins:android-junit5:1.7.1.1") } } @@ -28,6 +29,7 @@ allprojects { includeVersionByRegex(JellyfinSdk.GROUP, ".*", JellyfinSdk.SNAPSHOT_UNSTABLE) } } + maven { setUrl("https://jitpack.io") } } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e063164d..855cb54a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -8,6 +8,7 @@ androidx-core = "1.6.0" androidx-appcompat = "1.3.1" androidx-activity = "1.3.0" androidx-fragment = "1.3.6" +navigation = "2.4.0-alpha07" androiddesugarlibs = "1.1.5" # Lifecycle extensions @@ -17,8 +18,13 @@ androidx-lifecycle = "2.3.1" androidx-constraintlayout = "2.1.0" google-material = "1.4.0" androidx-webkit = "1.4.0" +androidx-palette = "1.0.0" modernandroidpreferences = "2.1.0" +# Compose +compose = "1.0.1" +accompanist = "0.10.0" + # Network jellyfin-sdk = "1.0.2" okhttp = "4.9.1" @@ -69,8 +75,22 @@ androidx-lifecycle-process = { group = "androidx.lifecycle", name = "lifecycle-p google-material = { group = "com.google.android.material", name = "material", version.ref = "google-material" } androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "androidx-constraintlayout" } androidx-webkit = { group = "androidx.webkit", name = "webkit", version.ref = "androidx-webkit" } +androidx-palette = { group = "androidx.palette", name = "palette", version.ref = "androidx-palette" } modernandroidpreferences = { group = "de.maxr1998", name = "modernandroidpreferences", version.ref = "modernandroidpreferences" } +# Compose +compose-runtime = { group = "androidx.compose.runtime", name = "runtime", version.ref = "compose" } +compose-ui = { group = "androidx.compose.ui", name = "ui", version.ref = "compose" } +compose-foundation = { group = "androidx.compose.foundation", name = "foundation", version.ref = "compose" } +compose-animation = { group = "androidx.compose.animation", name = "animation", version.ref = "compose" } +compose-material = { group = "androidx.compose.material", name = "material", version.ref = "compose" } +compose-material-icons = { group = "androidx.compose.material", name = "material-icons-core", version.ref = "compose" } +compose-material-icons-extended = { group = "androidx.compose.material", name = "material-icons-extended", version.ref = "compose" } +compose-runtime-livedata = { group = "androidx.compose.runtime", name = "runtime-livedata", version.ref = "compose" } +navigation-compose = { group = "androidx.navigation", name = "navigation-compose", version.ref = "navigation" } +accompanist-coil = { group = "com.google.accompanist", name = "accompanist-coil", version.ref = "accompanist" } +accompanist-pager = { group = "com.google.accompanist", name = "accompanist-pager", version.ref = "accompanist" } + # Network jellyfin-sdk = { group = "org.jellyfin.sdk", name = "jellyfin-platform-android", version.ref = "jellyfin-sdk" } okhttp = { group = "com.squareup.okhttp3", name = "okhttp", version.ref = "okhttp" } @@ -117,6 +137,17 @@ androidx-lifecycle = [ "androidx-lifecycle-common", "androidx-lifecycle-process", ] +compose = [ + "compose-runtime", + "compose-ui", + "compose-foundation", + "compose-animation", + "compose-material", + "compose-material-icons", + "compose-material-icons-extended", + "compose-runtime-livedata", +] +accompanist = ["accompanist-coil", "accompanist-pager"] exoplayer = [ "exoplayer-core", "exoplayer-ui",