Skip to content

Commit

Permalink
Update dependencies for codelabs branch (#94)
Browse files Browse the repository at this point in the history
* Deduplicate lifecycle runtime compose

* kotlin 2.0 and compose gradle plugin

* update compose bom and navigation suite

* Update various UI libs

* update test & other versions

* run spotlessApply
  • Loading branch information
jdkoren authored Oct 2, 2024
1 parent e741b2e commit 3c74551
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 48 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@
.externalNativeBuild
.cxx
local.properties
.kotlin
18 changes: 4 additions & 14 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,20 @@
* limitations under the License.
*/

@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed
plugins {
alias(libs.plugins.androidApplication)
alias(libs.plugins.baselineprofile)
alias(libs.plugins.compose)
alias(libs.plugins.hilt)
alias(libs.plugins.kotlinAndroid)
alias(libs.plugins.ksp)
}

kotlin {
jvmToolchain(17)
compilerOptions {
freeCompilerArgs = listOf("-Xcontext-receivers")
}
}

android {
Expand All @@ -47,20 +50,9 @@ android {
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
freeCompilerArgs = listOf("-Xcontext-receivers")
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get()
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
Expand All @@ -85,7 +77,6 @@ dependencies {
val composeBom = platform(libs.compose.bom)
implementation(composeBom)
androidTestImplementation(composeBom)
implementation(libs.compose.foundation)
implementation(libs.compose.ui)
implementation(libs.compose.ui.graphics)
implementation(libs.compose.ui.text.google.fonts)
Expand All @@ -106,7 +97,6 @@ dependencies {
implementation(libs.graphics.shapes)

implementation(libs.lifecycle.ktx)
implementation(libs.lifecycle.compose)
implementation(libs.lifecycle.runtime.compose)

ksp(libs.room.compiler)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import android.os.Bundle
import android.view.WindowInsetsController
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.core.content.pm.ShortcutManagerCompat
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
Expand All @@ -36,7 +35,6 @@ class MainActivity : ComponentActivity() {
installSplashScreen()
super.onCreate(savedInstanceState)
setContent {

// setSystemBarAppearance can be removed after calling enableEdgeToEdge()
setSystemBarAppearance(isSystemInDarkTheme())

Expand All @@ -55,16 +53,17 @@ class MainActivity : ComponentActivity() {
return ShortcutParams(shortcutId, text)
}

private fun setSystemBarAppearance(isSystemInDarkTheme : Boolean) {
private fun setSystemBarAppearance(isSystemInDarkTheme: Boolean) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
if (isSystemInDarkTheme) {
window?.insetsController?.setSystemBarsAppearance(
0, WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS
0,
WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS,
)
} else {
window?.insetsController?.setSystemBarsAppearance(
WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS,
WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS
WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,11 @@ import android.app.Activity
import android.content.Intent
import android.content.pm.ActivityInfo
import android.os.Bundle
import androidx.compose.animation.core.CubicBezierEasing
import androidx.compose.animation.core.FastOutLinearInEasing
import androidx.compose.animation.core.FastOutSlowInEasing
import androidx.compose.animation.core.tween
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.scaleIn
import androidx.compose.animation.scaleOut
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
Expand Down
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ plugins {
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.androidTest) apply false
alias(libs.plugins.baselineprofile) apply false
alias(libs.plugins.compose) apply false
alias(libs.plugins.kotlinAndroid) apply false
alias(libs.plugins.spotless) apply false
alias(libs.plugins.hilt) apply false
Expand Down
49 changes: 23 additions & 26 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,40 +13,38 @@
# limitations under the License.

[versions]
accompanist = "0.32.0"
activity = "1.9.0"
accompanist = "0.34.0"
activity = "1.9.1"
agp = "8.2.2"
benchmarkMacroJunit4 = "1.2.4"
baselineprofile = "1.2.4"
camera = "1.3.3"
coil = "2.4.0"
compose_bom = "2024.05.00"
composeCompiler = "1.5.4" # Used in app/build.gradle.kts
compose-foundation = "1.6.0-beta03"
concurrent = "1.1.0"
benchmarkMacroJunit4 = "1.3.0"
baselineprofile = "1.3.0"
camera = "1.3.4"
coil = "2.6.0"
compose_bom = "2024.08.00"
concurrent = "1.2.0"
core = "1.13.1"
core-splashscreen = "1.2.0-alpha01"
espresso = "3.5.1"
graphics = "1.0.0-beta01"
hilt = "2.48.1"
hiltNavigationCompose = "1.1.0"
espresso = "3.6.1"
graphics = "1.0.0"
hilt = "2.51.1"
hiltNavigationCompose = "1.2.0"
junit = "4.13.2"
kotlin = "1.9.20"
ksp = "1.9.20-1.0.14"
lifecycle = "2.7.0"
kotlin = "2.0.0"
ksp = "2.0.0-1.0.21"
lifecycle = "2.8.4"
material3 = "1.2.1"
media3 = "1.3.1"
media3 = "1.4.1"
navigation = "2.7.7"
profileinstaller = "1.3.1"
room = "2.6.1"
spotless = "6.24.0"
test = "1.1.5"
truth = "1.1.3"
test = "1.2.1"
truth = "1.4.4"
turbine = "1.0.0"
uiautomator = "2.3.0"
window = "1.2.0"
material3-adaptive-navigation-suite = "1.0.0-alpha05"
glance = "1.1.0-beta02"
window = "1.3.0"
material3-adaptive-navigation-suite = "1.3.0-rc01"
glance = "1.1.0"

[libraries]
accompanist-painter = { group = "com.google.accompanist", name = "accompanist-drawablepainter", version.ref = "accompanist" }
Expand All @@ -65,7 +63,6 @@ compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref =
compose-material-icons = { group = "androidx.compose.material", name = "material-icons-extended" }
compose-material3 = { group = "androidx.compose.material3", name = "material3", version.ref = "material3" }
compose-material3-adaptive = { group = "androidx.compose.material3", name = "material3-adaptive-navigation-suite", version.ref = "material3-adaptive-navigation-suite"}
compose-foundation = { group = "androidx.compose.foundation", name = "foundation" }
compose-ui = { group = "androidx.compose.ui", name = "ui" }
compose-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
compose-ui-test = { group = "androidx.compose.ui", name = "ui-test-junit4" }
Expand All @@ -84,9 +81,8 @@ hilt-android = { group = "com.google.dagger", name = "hilt-android", version.ref
hilt-compiler = { group = "com.google.dagger", name = "hilt-android-compiler", version.ref = "hilt" }
hilt-navigation-compose = { group = "androidx.hilt", name = "hilt-navigation-compose", version.ref = "hiltNavigationCompose" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
lifecycle-compose = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "lifecycle" }
lifecycle-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycle" }
lifecycle-runtime-compose = { module = "androidx.lifecycle:lifecycle-runtime-compose", version.ref = "lifecycle" }
lifecycle-runtime-compose = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "lifecycle" }
media3-common = { group = "androidx.media3", name = "media3-common", version.ref = "media3" }
media3-effect = { group = "androidx.media3", name = "media3-effect", version.ref = "media3" }
media3-exoplayer = { group = "androidx.media3", name = "media3-exoplayer", version.ref = "media3" }
Expand All @@ -108,6 +104,7 @@ ktlint = "com.pinterest.ktlint:ktlint-cli:1.1.1" # Used in build.gradle.kts
androidApplication = { id = "com.android.application", version.ref = "agp" }
androidTest = { id = "com.android.test", version.ref = "agp" }
baselineprofile = { id = "androidx.baselineprofile", version.ref = "baselineprofile" }
compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" }
kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
Expand Down

0 comments on commit 3c74551

Please sign in to comment.