diff --git a/app/src/main/java/io/legado/app/ui/book/read/sheet/HeaderFooterPage.kt b/app/src/main/java/io/legado/app/ui/book/read/sheet/HeaderFooterPage.kt index 2ab8c1dc5..0919bcdba 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/sheet/HeaderFooterPage.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/sheet/HeaderFooterPage.kt @@ -2,7 +2,6 @@ package io.legado.app.ui.book.read.sheet import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.core.FastOutSlowInEasing -import androidx.compose.animation.core.LinearEasing import androidx.compose.animation.core.tween import androidx.compose.animation.expandVertically import androidx.compose.animation.fadeIn @@ -65,10 +64,8 @@ import io.legado.app.ui.widget.components.settingItem.TinySliderSettingItem import io.legado.app.ui.widget.components.settingItem.TinySwitchSettingItem import io.legado.app.ui.widget.components.tabRow.CardTabRow import io.legado.app.utils.getCompatColor -import kotlinx.coroutines.delay import kotlinx.coroutines.launch import org.koin.compose.koinInject -import kotlin.time.Duration.Companion.milliseconds // Color picker IDs private const val COLOR_HEADER = 7 @@ -124,25 +121,15 @@ internal fun HeaderFooterPage( val headerScrollState = rememberScrollState() val footerScrollState = rememberScrollState() - LaunchedEffect(expandHeaderPadding) { + LaunchedEffect(expandHeaderPadding, headerScrollState.maxValue) { if (expandHeaderPadding) { - //等动画结束后再滚动到底部,否则maxValue值不是最新 - delay(300.milliseconds) - headerScrollState.animateScrollTo( - headerScrollState.maxValue, - animationSpec = tween(durationMillis = 200, easing = LinearEasing) - ) + headerScrollState.scrollTo(headerScrollState.maxValue) } } - LaunchedEffect(expandFooterPadding) { + LaunchedEffect(expandFooterPadding, footerScrollState.maxValue) { if (expandFooterPadding) { - //等动画结束后再滚动到底部,否则maxValue值不是最新 - delay(300.milliseconds) - footerScrollState.animateScrollTo( - footerScrollState.maxValue, - animationSpec = tween(durationMillis = 200, easing = LinearEasing) - ) + footerScrollState.scrollTo(footerScrollState.maxValue) } } @@ -313,7 +300,13 @@ internal fun HeaderFooterPage( Spacer(Modifier.height(8.dp)) TinyClickableSettingItem( title = stringResource(R.string.padding), - description = "上: ${headerPaddingTop.toInt()} 下: ${headerPaddingBottom.toInt()} 左: ${headerPaddingLeft.toInt()} 右: ${headerPaddingRight.toInt()}", + description = stringResource( + R.string.padding_format, + headerPaddingTop.toInt(), + headerPaddingBottom.toInt(), + headerPaddingLeft.toInt(), + headerPaddingRight.toInt(), + ), trailingContent = { Icon( imageVector = if (expandHeaderPadding) Icons.Default.ExpandMore else Icons.Default.ChevronRight, @@ -437,7 +430,13 @@ internal fun HeaderFooterPage( Spacer(Modifier.height(8.dp)) TinyClickableSettingItem( title = stringResource(R.string.padding), - description = "上: ${footerPaddingTop.toInt()} 下: ${footerPaddingBottom.toInt()} 左: ${footerPaddingLeft.toInt()} 右: ${footerPaddingRight.toInt()}", + description = stringResource( + R.string.padding_format, + footerPaddingTop.toInt(), + footerPaddingBottom.toInt(), + footerPaddingLeft.toInt(), + footerPaddingRight.toInt(), + ), trailingContent = { Icon( imageVector = if (expandFooterPadding) Icons.Default.ExpandMore else Icons.Default.ChevronRight, diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 2364dff3a..073d0ae09 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -352,6 +352,7 @@ 下边距 左边距 右边距 + 上: %1$d 下: %2$d 左: %3$d 右: %4$d 校验书源 校验所选 %1$s 进度 %2$d/%3$d diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index a362ecf2a..663a98f39 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -299,6 +299,7 @@ 下邊距 左邊距 右邊距 + 上: %1$d 下: %2$d 左: %3$d 右: %4$d 校驗書源 校驗所選 %1$s 進度 %2$d/%3$d diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index dacc5b224..13fa803b2 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -301,6 +301,7 @@ 下邊距 左邊距 右邊距 + 上: %1$d 下: %2$d 左: %3$d 右: %4$d 校驗書源 校驗所選 %1$s 進度 %2$d/%3$d diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index eb0394a28..bd7822aa7 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -373,6 +373,7 @@ Bottom Left Right + Top: %1$d Bottom: %2$d Left: %3$d Right: %4$d Check book sources Check the selected source %1$s Progress %2$d/%3$d