Skip to content

Commit

Permalink
Merge pull request #83 from TimPushkin/updates
Browse files Browse the repository at this point in the history
Upgrade dependencies
  • Loading branch information
TimPushkin authored May 17, 2024
2 parents 4ce6f0e + 71d6a09 commit f6dab17
Show file tree
Hide file tree
Showing 12 changed files with 191 additions and 162 deletions.
105 changes: 0 additions & 105 deletions app/build.gradle

This file was deleted.

116 changes: 116 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import java.util.Properties

plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.jetbrains.kotlin.android)
alias(libs.plugins.androidx.room)
alias(libs.plugins.google.dagger.hilt.android)
alias(libs.plugins.google.devtools.ksp)
}

object Version {
private const val MAJOR = 1
private const val MINOR = 4
private const val PATCH = 0

const val CODE = MAJOR * 10000 + MINOR * 100 + PATCH
const val NAME = "$MAJOR.$MINOR.$PATCH"
}

kotlin {
jvmToolchain(17)
compilerOptions {
freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn")
}
}

android {
namespace = "ru.spbu.depnav"
compileSdk = 34

defaultConfig {
applicationId = "ru.spbu.depnav"
minSdk = 21
targetSdk = 34
versionCode = Version.CODE
versionName = Version.NAME

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

signingConfigs {
val keystorePropertiesFile = rootProject.file("keystore.properties")
if (keystorePropertiesFile.exists()) {
val keystoreProperties = Properties().apply {
load(keystorePropertiesFile.inputStream())
}
create("release") {
storeFile = file(keystoreProperties.getProperty("storeFile"))
storePassword = keystoreProperties.getProperty("storePassword")
keyAlias = keystoreProperties.getProperty("keyAlias")
keyPassword = keystoreProperties.getProperty("keyPassword")
}
}
}

buildTypes {
release {
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
signingConfig = signingConfigs.findByName("release")
}
}

buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get()
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}

dependencies {
implementation(libs.androidx.lifecycle.runtimeKtx)
implementation(libs.androidx.lifecycle.runtimeCompose)
implementation(libs.androidx.lifecycle.viewmodelCompose)

implementation(libs.androidx.room.runtime)
implementation(libs.androidx.room.ktx)
annotationProcessor(libs.androidx.room.compiler)
ksp(libs.androidx.room.compiler)

implementation(libs.google.dagger.hilt)
ksp(libs.google.dagger.hiltCompiler)

implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.compose.material3)
implementation(libs.androidx.compose.ui)
implementation(libs.androidx.compose.ui.tooling.preview)
debugImplementation(libs.androidx.compose.ui.tooling)

implementation(libs.androidx.core.ktx)
implementation(libs.androidx.activity.compose)
implementation(libs.plrapps.mapcompose)

testImplementation(libs.junit)
androidTestImplementation(libs.androidx.test.runner)
androidTestImplementation(libs.androidx.test.rules)
androidTestImplementation(libs.androidx.test.extJunit)
}

ksp {
arg("room.incremental", "true")
arg("room.generateKotlin", "true")
}

room {
schemaDirectory("$projectDir/schemas")
}
2 changes: 1 addition & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
# proguardFiles setting in build.gradle.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
Expand Down
31 changes: 20 additions & 11 deletions app/src/main/java/ru/spbu/depnav/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import androidx.activity.SystemBarStyle
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.lifecycle.compose.collectAsStateWithLifecycle
Expand All @@ -46,19 +47,27 @@ class MainActivity : ComponentActivity() {
super.onCreate(savedInstanceState)

setContent {
val themeMode by prefs.themeModeFlow.collectAsStateWithLifecycle()
val darkTheme = when (themeMode) {
ThemeMode.LIGHT -> false
ThemeMode.DARK -> true
ThemeMode.SYSTEM -> isSystemInDarkTheme()
}
CompositionLocalProvider(
// Fix for https://issuetracker.google.com/issues/336842920 -- should be removed as
// soon as Compose UI 1.7.0 becomes stable
androidx.lifecycle.compose.LocalLifecycleOwner provides
androidx.compose.ui.platform.LocalLifecycleOwner.current
) {
val themeMode by prefs.themeModeFlow.collectAsStateWithLifecycle()
val darkTheme = when (themeMode) {
ThemeMode.LIGHT -> false
ThemeMode.DARK -> true
ThemeMode.SYSTEM -> isSystemInDarkTheme()
}

LaunchedEffect(darkTheme) {
val style = SystemBarStyle.auto(Color.TRANSPARENT, Color.TRANSPARENT) { darkTheme }
enableEdgeToEdge(style, style)
}
LaunchedEffect(darkTheme) {
val style =
SystemBarStyle.auto(Color.TRANSPARENT, Color.TRANSPARENT) { darkTheme }
enableEdgeToEdge(style, style)
}

DepNavTheme(darkTheme = darkTheme) { MapScreen(prefs) }
DepNavTheme(darkTheme = darkTheme) { MapScreen(prefs) }
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import androidx.compose.foundation.layout.size
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.Info
import androidx.compose.material.icons.rounded.Settings
import androidx.compose.material3.Divider
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ModalDrawerSheet
Expand Down Expand Up @@ -65,7 +65,7 @@ fun MainMenuSheet(

MapItems(selectedMapId, availableMaps, onMapSelected)

Divider(
HorizontalDivider(
modifier = Modifier.padding(
horizontal = ITEM_HORIZONTAL_PADDING,
vertical = DIVIDER_VERTICAL_PADDING
Expand Down
7 changes: 3 additions & 4 deletions app/src/main/java/ru/spbu/depnav/ui/component/MapSearchBar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.systemBars
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.ArrowBack
import androidx.compose.material.icons.automirrored.rounded.ArrowBack
import androidx.compose.material.icons.rounded.Clear
import androidx.compose.material.icons.rounded.Menu
import androidx.compose.material3.ExperimentalMaterial3Api
Expand All @@ -47,7 +47,6 @@ import androidx.compose.material3.Text
import androidx.compose.material3.minimumInteractiveComponentSize
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.platform.LocalLayoutDirection
Expand Down Expand Up @@ -78,7 +77,7 @@ private val ACTIVATION_EXIT_SPEC = tween<Float>(
"LongMethod", // No point in further shrinking
"LongParameterList" // Considered OK for a composable
)
@OptIn(ExperimentalMaterial3Api::class, ExperimentalComposeUiApi::class)
@OptIn(ExperimentalMaterial3Api::class)
fun MapSearchBar(
query: String,
onQueryChange: (String) -> Unit,
Expand Down Expand Up @@ -181,7 +180,7 @@ private fun AnimatedLeadingIcon(
if (active) {
IconButton(onClick = onNavigateBackClick) {
Icon(
Icons.Rounded.ArrowBack,
Icons.AutoMirrored.Rounded.ArrowBack,
contentDescription = stringResource(R.string.label_navigate_back)
)
}
Expand Down
9 changes: 0 additions & 9 deletions build.gradle

This file was deleted.

9 changes: 9 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.jetbrains.kotlin.android) apply false

// Must be declared in the same scope as AGP to fix https://github.com/google/dagger/issues/3068
alias(libs.plugins.google.dagger.hilt.android) apply false
// Must be declared in the same scope as Hilt
alias(libs.plugins.google.devtools.ksp) apply false
}
24 changes: 14 additions & 10 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[versions]

kotlin = "1.9.21"
kspPlugin = "1.9.21-1.0.15"
composeCompiler = "1.5.6"
hilt = "2.49"
lifecycle = "2.6.2"
kotlin = "1.9.24"
kspPlugin = "1.9.24-1.0.20"
composeCompiler = "1.5.14"
hilt = "2.51.1"
lifecycle = "2.8.0"
room = "2.6.1"


Expand All @@ -21,11 +21,15 @@ androidx-room-compiler = { group = "androidx.room", name = "room-compiler", vers
google-dagger-hilt = { group = "com.google.dagger", name = "hilt-android", version.ref = "hilt" }
google-dagger-hiltCompiler = { group = "com.google.dagger", name = "hilt-compiler", version.ref = "hilt" }

androidx-compose-bom = "androidx.compose:compose-bom:2023.10.01"
androidx-compose-bom = "androidx.compose:compose-bom:2024.05.00"
androidx-compose-material3 = { module = "androidx.compose.material3:material3" }
androidx-compose-ui = { module = "androidx.compose.ui:ui" }
androidx-compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling" }
androidx-compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview" }

androidx-core-ktx = "androidx.core:core-ktx:1.12.0"
androidx-activity-compose = "androidx.activity:activity-compose:1.8.1"
plrapps-mapcompose = "ovh.plrapps:mapcompose:2.9.8"
androidx-core-ktx = "androidx.core:core-ktx:1.13.1"
androidx-activity-compose = "androidx.activity:activity-compose:1.9.0"
plrapps-mapcompose = "ovh.plrapps:mapcompose:2.12.4"

junit = "junit:junit:4.13.2"
androidx-test-runner = "androidx.test:runner:1.5.2"
Expand All @@ -35,7 +39,7 @@ androidx-test-extJunit = "androidx.test.ext:junit:1.1.5"

[plugins]

android-application = "com.android.application:8.2.0"
android-application = { id = "com.android.application", version = "8.4.0" }
jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
google-dagger-hilt-android = { id = "com.google.dagger.hilt.android", version.ref = "hilt" }
google-devtools-ksp = { id = "com.google.devtools.ksp", version.ref = "kspPlugin" }
Expand Down
Loading

0 comments on commit f6dab17

Please sign in to comment.