From 6c4dd8872f063e800edf6fef1d545382e0f62b2b Mon Sep 17 00:00:00 2001 From: Maary <24504742+Steve-Mr@users.noreply.github.com> Date: Fri, 4 Oct 2024 13:47:26 +0800 Subject: [PATCH] [fix]disable page indicator in ActionRow [fix]save state when delbuttonlongclick --- .../java/top/maary/oblivionis/ui/ActionComponents.kt | 9 +++++---- .../top/maary/oblivionis/viewmodel/ActionViewModel.kt | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/top/maary/oblivionis/ui/ActionComponents.kt b/app/src/main/java/top/maary/oblivionis/ui/ActionComponents.kt index 3ac2d4b..853de7b 100644 --- a/app/src/main/java/top/maary/oblivionis/ui/ActionComponents.kt +++ b/app/src/main/java/top/maary/oblivionis/ui/ActionComponents.kt @@ -2,6 +2,7 @@ package top.maary.oblivionis.ui import android.net.Uri import android.provider.MediaStore +import android.util.Log import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.clickable import androidx.compose.foundation.combinedClickable @@ -221,14 +222,14 @@ fun ActionRow( ) { OutlinedButton( onClick = {}, - modifier = Modifier - .height(48.dp) + modifier = Modifier.height(48.dp), + enabled = (pagesCount != 0) ) { Text( modifier = Modifier.padding(start = 8.dp, end = 32.dp), - text = stringResource(R.string.pager_count, currentPage, pagesCount) + text = stringResource(R.string.pager_count, + if (pagesCount == 0) 0 else currentPage, pagesCount) ) - } if (loading) { LinearProgressIndicator( diff --git a/app/src/main/java/top/maary/oblivionis/viewmodel/ActionViewModel.kt b/app/src/main/java/top/maary/oblivionis/viewmodel/ActionViewModel.kt index ab1f42c..180a686 100644 --- a/app/src/main/java/top/maary/oblivionis/viewmodel/ActionViewModel.kt +++ b/app/src/main/java/top/maary/oblivionis/viewmodel/ActionViewModel.kt @@ -465,7 +465,7 @@ class ActionViewModel( private fun databaseMarkAll(images: List) = viewModelScope.launch { images.forEach { if (it.isExcluded) return@forEach - imageRepository.mark(it.copy(isMarked = false)) + imageRepository.mark(it.copy(isMarked = true)) } }