Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ plugins {
object Version {
private const val MAJOR = 1
private const val MINOR = 4
private const val PATCH = 3
private const val PATCH = 4

const val CODE = MAJOR * 10000 + MINOR * 100 + PATCH
const val NAME = "$MAJOR.$MINOR.$PATCH"
Expand All @@ -27,12 +27,12 @@ kotlin {

android {
namespace = "ru.spbu.depnav"
compileSdk = 35
compileSdk = 36

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package ru.spbu.depnav.ui.component

import android.annotation.SuppressLint
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
Expand All @@ -44,6 +45,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import ru.spbu.depnav.R
import ru.spbu.depnav.ui.viewmodel.AvailableMap
import androidx.compose.ui.platform.LocalResources

// https://m3.material.io/components/navigation-drawer/specs#368147de-9661-4a28-9fc1-ce2f8c9eac40
private val ITEM_HEIGHT = 56.dp
Expand Down Expand Up @@ -136,7 +138,8 @@ private fun ColumnScope.MapItems(

@Composable
private fun MapLogo(internalMapName: String, contentDescription: String) {
val logoId = LocalContext.current.resources.getIdentifier(
@SuppressLint("DiscouragedApi")
val logoId = LocalResources.current.getIdentifier(
"logo_${internalMapName.replace('-', '_')}", "drawable", LocalContext.current.packageName
)
Icon(
Expand Down
5 changes: 2 additions & 3 deletions app/src/main/java/ru/spbu/depnav/ui/viewmodel/MapViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ class MapViewModel @Inject constructor(
} while (state.value.language != language)

val mapState = with(mapInfo) {
MapState(levelsNum, floorWidth, floorHeight, tileSize) { scale(0f) }
MapState(levelsNum, floorWidth, floorHeight, tileSize) { scale(0.0) }
}.apply {
setScrollOffsetRatio(0.5f, 0.5f)
addClusterers(markerAlpha)
Expand Down Expand Up @@ -275,8 +275,7 @@ class MapViewModel @Inject constructor(
x = marker.x,
y = marker.y,
zIndex = 1f,
clickable = false,
clipShape = null
clickable = false
) { Pin() }
}

Expand Down
13 changes: 6 additions & 7 deletions app/src/main/java/ru/spbu/depnav/utils/map/Markers.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@ import ru.spbu.depnav.data.model.Marker
import ru.spbu.depnav.data.model.MarkerText
import ru.spbu.depnav.ui.component.MarkerView

private const val INVISIBLE_UNTIL_SCALE_PORTION = 0.2f
private const val OPAQUE_SINCE_SCALE_PORTION = 0.5f
private const val INVISIBLE_UNTIL_SCALED_BY = 0.1f
private const val OPAQUE_SINCE_SCALED_BY = 0.5f
private const val INVISIBLE_UNTIL_SCALE_PORTION = 0.2
private const val OPAQUE_SINCE_SCALE_PORTION = 0.5
private const val INVISIBLE_UNTIL_SCALED_BY = 0.1
private const val OPAQUE_SINCE_SCALED_BY = 0.5

/** Returns alpha value to use for map markers calculated based on the current map scale. */
fun getMarkerAlpha(minScale: Float, scale: Float, maxScale: Float) = if (minScale < maxScale) {
fun getMarkerAlpha(minScale: Double, scale: Double, maxScale: Double) = if (minScale < maxScale) {
val invisibleUntil = minScale + ((maxScale - minScale) * INVISIBLE_UNTIL_SCALE_PORTION)
.coerceAtMost(INVISIBLE_UNTIL_SCALED_BY)
val opaqueFrom = minScale + ((maxScale - minScale) * OPAQUE_SINCE_SCALE_PORTION)
.coerceAtMost(OPAQUE_SINCE_SCALED_BY)
val coercedScale = scale.coerceIn(invisibleUntil, opaqueFrom)
(coercedScale - invisibleUntil) / (opaqueFrom - invisibleUntil)
((coercedScale - invisibleUntil) / (opaqueFrom - invisibleUntil)).toFloat()
} else {
1f // minScale >= maxScale, so zooming is impossible, i.e. the scale cannot be changed
}
Expand All @@ -63,7 +63,6 @@ fun MapState.addMarker(
y = marker.y,
clickable = markerText.run { !title.isNullOrBlank() || !description.isNullOrBlank() },
relativeOffset = Offset(-0.5f, -0.5f),
clipShape = null,
renderingStrategy = RenderingStrategy.Clustering(getClustererId(marker.type))
) {
val alpha by alphaFlow.collectAsStateWithLifecycle()
Expand Down
43 changes: 0 additions & 43 deletions app/src/main/java/ru/spbu/depnav/utils/ranking/TfIdf.kt

This file was deleted.

26 changes: 13 additions & 13 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[versions]

kotlin = "2.1.20"
kspPlugin = "2.1.20-2.0.0"
hilt = "2.56.2"
lifecycle = "2.8.7"
room = "2.7.0"
kotlin = "2.2.20"
kspPlugin = "2.2.20-2.0.3"
hilt = "2.57.1"
lifecycle = "2.9.4"
room = "2.7.2" # 2.8.0+ requires minSdk 23, without giving much yet


[libraries]
Expand All @@ -20,25 +20,25 @@ 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:2025.04.00"
androidx-compose-bom = "androidx.compose:compose-bom:2025.09.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.16.0"
androidx-activity-compose = "androidx.activity:activity-compose:1.10.1"
plrapps-mapcompose = "ovh.plrapps:mapcompose:2.16.2"
androidx-core-ktx = "androidx.core:core-ktx:1.17.0"
androidx-activity-compose = "androidx.activity:activity-compose:1.11.0"
plrapps-mapcompose = "ovh.plrapps:mapcompose:3.2.1"

junit = "junit:junit:4.13.2"
androidx-test-runner = "androidx.test:runner:1.6.2"
androidx-test-rules = "androidx.test:rules:1.6.1"
androidx-test-extJunit = "androidx.test.ext:junit:1.2.1"
androidx-test-runner = "androidx.test:runner:1.7.0"
androidx-test-rules = "androidx.test:rules:1.7.0"
androidx-test-extJunit = "androidx.test.ext:junit:1.3.0"


[plugins]

android-application = { id = "com.android.application", version = "8.9.1" }
android-application = { id = "com.android.application", version = "8.13.0" }
jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
jetbrains-kotlin-plugin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
google-dagger-hilt-android = { id = "com.google.dagger.hilt.android", version.ref = "hilt" }
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Aug 27 22:36:14 CEST 2024
#Fri Sep 19 18:54:02 CEST 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading