From 962bbf4665bf914ec53aa90dab8099cdd280074a Mon Sep 17 00:00:00 2001 From: Minecon724 Date: Thu, 8 May 2025 10:37:21 +0200 Subject: [PATCH] Update dependencies --- .../settings/screen/content/ContentScreen.kt | 57 +++++++++++-------- gradle/libs.versions.toml | 34 +++++------ 2 files changed, 50 insertions(+), 41 deletions(-) diff --git a/app/src/main/java/eu/m724/pojavbackup/settings/screen/content/ContentScreen.kt b/app/src/main/java/eu/m724/pojavbackup/settings/screen/content/ContentScreen.kt index 6d72c43..148aada 100644 --- a/app/src/main/java/eu/m724/pojavbackup/settings/screen/content/ContentScreen.kt +++ b/app/src/main/java/eu/m724/pojavbackup/settings/screen/content/ContentScreen.kt @@ -3,18 +3,22 @@ package eu.m724.pojavbackup.settings.screen.content import android.graphics.Bitmap import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items +import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.material3.CardDefaults import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.ElevatedCard +import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -34,15 +38,14 @@ import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import eu.m724.pojavbackup.R -import org.burnoutcrew.reorderable.ReorderableItem -import org.burnoutcrew.reorderable.detectReorderAfterLongPress -import org.burnoutcrew.reorderable.rememberReorderableLazyListState -import org.burnoutcrew.reorderable.reorderable +import sh.calvin.reorderable.ReorderableItem +import sh.calvin.reorderable.rememberReorderableLazyListState import java.time.ZonedDateTime import java.time.format.DateTimeFormatter import java.time.format.FormatStyle +@OptIn(ExperimentalMaterial3Api::class) @Composable fun ContentScreen() { val viewModel: ContentScreenViewModel = hiltViewModel() @@ -62,35 +65,41 @@ fun ContentScreen() { modifier = Modifier.padding(top = 50.dp) ) } else { - val state = rememberReorderableLazyListState(onMove = { from, to -> + val lazyListState = rememberLazyListState() + val reorderableLazyListState = rememberReorderableLazyListState(lazyListState) { from, to -> viewModel.moveWorld(from.index, to.index) - }) + } LazyColumn( - modifier = Modifier - .reorderable(state) - .detectReorderAfterLongPress(state), - state = state.listState, + modifier = Modifier.fillMaxSize(), + state = lazyListState, horizontalAlignment = Alignment.CenterHorizontally ) { items( items = uiState.worldList, key = { it?.id ?: "" } ) { world -> - ReorderableItem(state, key = world?.id ?: "" ) { isDragging -> - if (world != null) { - WorldInfoCard( - bitmap = world.icon, - id = world.id, - displayName = world.displayName, - lastPlayed = world.lastPlayed - ) - } else { - Text( - text = "↑ " + stringResource(R.string.worlds_separator) + " ↑", - modifier = Modifier.fillMaxWidth().padding(vertical = 5.dp), - textAlign = TextAlign.Center - ) + ReorderableItem( + state = reorderableLazyListState, + key = world?.id ?: "" + ) { isDragging -> + Box( + modifier = Modifier.draggableHandle() + ) { + if (world != null) { + WorldInfoCard( + bitmap = world.icon, + id = world.id, + displayName = world.displayName, + lastPlayed = world.lastPlayed + ) + } else { + Text( + text = "↑ " + stringResource(R.string.worlds_separator) + " ↑", + modifier = Modifier.fillMaxWidth().padding(vertical = 5.dp), + textAlign = TextAlign.Center + ) + } } } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 088fc5e..3d24c1e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -agp = "8.9.1" +agp = "8.9.2" kotlin = "2.1.20" coreKtx = "1.16.0" junit = "4.13.2" @@ -7,23 +7,23 @@ junitVersion = "1.2.1" espressoCore = "3.6.1" appcompat = "1.7.0" material = "1.12.0" -lifecycleRuntimeKtx = "2.8.7" +lifecycle = "2.9.0" activityCompose = "1.10.1" -composeBom = "2025.04.00" -lifecycleViewmodelCompose = "2.8.7" +composeBom = "2025.05.00" knbt = "0.11.8" -reorderable = "0.9.6" -navigation = "2.8.9" +reorderable = "2.4.3" +navigation = "2.9.0" hilt = "2.56.1" ksp = "2.1.20-2.0.0" hiltNavigationCompose = "1.2.0" -datastore = "1.1.4" +datastore = "1.1.6" protobufJavalite = "4.30.2" protobuf = "0.9.5" commonsCompress = "1.27.1" -work = "2.10.0" +work = "2.10.1" androidxHilt = "1.2.0" zstdJni = "1.5.7-2" +ui = "1.9.0-alpha02" [libraries] androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" } @@ -32,19 +32,19 @@ androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "j androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" } androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" } material = { group = "com.google.android.material", name = "material", version.ref = "material" } -androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" } +androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycle" } androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" } androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" } -androidx-ui = { group = "androidx.compose.ui", name = "ui" } -androidx-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" } -androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" } -androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" } -androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" } -androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" } +androidx-ui = { group = "androidx.compose.ui", name = "ui", version.ref = "ui" } +androidx-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics", version.ref = "ui" } +androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling", version.ref = "ui" } +androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview", version.ref = "ui" } +androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest", version.ref = "ui" } +androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4", version.ref = "ui" } androidx-material3 = { group = "androidx.compose.material3", name = "material3" } -androidx-lifecycle-viewmodel-compose = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-compose", version.ref = "lifecycleViewmodelCompose" } +androidx-lifecycle-viewmodel-compose = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-compose", version.ref = "lifecycle" } knbt = { group = "net.benwoodworth.knbt", name = "knbt", version.ref = "knbt" } -reorderable = { group = "org.burnoutcrew.composereorderable", name = "reorderable", version.ref = "reorderable" } +reorderable = { module = "sh.calvin.reorderable:reorderable", version.ref = "reorderable" } androidx-navigation-compose = { group = "androidx.navigation", name = "navigation-compose", version.ref = "navigation" } hilt-android = { group = "com.google.dagger", name = "hilt-android", version.ref = "hilt" } hilt-compiler = { group = "com.google.dagger", name = "hilt-compiler", version.ref = "hilt" }