Fixes to pass relevant testing

This commit is contained in:
imkunet 2024-03-05 04:12:05 -05:00 committed by imkunet
parent 05fc1d7b4f
commit 5c690cc6c2
No known key found for this signature in database
GPG Key ID: 32E0ECFB90A68C42
2 changed files with 4 additions and 5 deletions

View File

@ -5,7 +5,6 @@ import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut import androidx.compose.animation.fadeOut
import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.WindowInsetsSides import androidx.compose.foundation.layout.WindowInsetsSides
import androidx.compose.foundation.layout.consumeWindowInsets
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.imePadding import androidx.compose.foundation.layout.imePadding
import androidx.compose.foundation.layout.navigationBars import androidx.compose.foundation.layout.navigationBars

View File

@ -22,7 +22,7 @@ import androidx.compose.ui.text.TextRange
import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.text.input.TextFieldValue
import eu.kanade.tachiyomi.ui.manga.notes.MangaNotesScreenState import eu.kanade.tachiyomi.ui.manga.notes.MangaNotesScreenState
private const val MAX_LENGTH = 10_000 private const val MaxLength = 10_000
@Composable @Composable
fun MangaNotesTextArea( fun MangaNotesTextArea(
@ -41,12 +41,12 @@ fun MangaNotesTextArea(
) { ) {
OutlinedTextField( OutlinedTextField(
value = text, value = text,
onValueChange = { if (it.text.length <= MAX_LENGTH) text = it }, onValueChange = { if (it.text.length <= MaxLength) text = it },
modifier = Modifier modifier = Modifier
.fillMaxSize() .fillMaxSize()
.focusRequester(focusRequester), .focusRequester(focusRequester),
supportingText = { supportingText = {
val displayWarning = text.text.length > MAX_LENGTH / 10 * 9 val displayWarning = text.text.length > MaxLength / 10 * 9
if (!displayWarning) { if (!displayWarning) {
Text( Text(
text = "0", text = "0",
@ -59,7 +59,7 @@ fun MangaNotesTextArea(
exit = fadeOut(), exit = fadeOut(),
) { ) {
Text( Text(
text = "${text.text.length} / $MAX_LENGTH", text = "${text.text.length} / $MaxLength",
) )
} }
}, },