[优化] 一些界面优化

This commit is contained in:
HapeLee
2025-12-28 04:36:31 +08:00
parent 57173d4148
commit 8ee5ddcc8e
3 changed files with 31 additions and 24 deletions
@@ -22,12 +22,15 @@ import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.MaterialTheme.colorScheme
import androidx.compose.material3.MediumTopAppBar
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
@@ -43,23 +46,6 @@ import io.legado.app.ui.widget.components.SettingItem
import io.legado.app.ui.widget.components.SplicedColumnGroup
import io.legado.app.ui.widget.components.TextCard
@Preview(showBackground = true, name = "Light Mode")
@Preview(showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_YES, name = "Dark Mode")
@Composable
fun PreviewAboutScreen() {
AppTheme {
AboutScreen(
versionName = "1.0",
onCheckUpdate = {},
onOpenUrl = {},
onShowMdFile = { _, _ -> },
onSaveLog = {},
onCreateHeapDump = {},
onShowCrashLogs = {}
)
}
}
@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class)
@Composable
fun AboutScreen(
@@ -74,9 +60,12 @@ fun AboutScreen(
) {
LocalContext.current
val scrollBehavior = TopAppBarDefaults.exitUntilCollapsedScrollBehavior()
Scaffold(
modifier = Modifier.nestedScroll(scrollBehavior.nestedScrollConnection),
topBar = {
TopAppBar(
MediumTopAppBar(
title = { Text(stringResource(R.string.about)) },
navigationIcon = {
IconButton(onClick = onNavigateBack) {
@@ -85,7 +74,8 @@ fun AboutScreen(
contentDescription = stringResource(R.string.back)
)
}
}
},
scrollBehavior = scrollBehavior
)
}
) { padding ->
@@ -529,7 +529,7 @@ fun ExploreBookItem(
Cover(
path = book.coverUrl,
modifier = Modifier.width(70.dp),
modifier = Modifier.width(72.dp),
badgeContent = badge)
Spacer(modifier = Modifier.width(8.dp))
@@ -556,14 +556,14 @@ fun ExploreBookItem(
if (!latestChapter.isNullOrEmpty()) {
Text(
text = "",
style = MaterialTheme.typography.bodySmall,
style = MaterialTheme.typography.labelSmall,
color = Color.Gray,
maxLines = 1
)
Text(
text = "最新: $latestChapter",
style = MaterialTheme.typography.bodySmall,
style = MaterialTheme.typography.labelSmall,
color = Color.Gray,
maxLines = 1,
overflow = TextOverflow.Ellipsis
@@ -575,7 +575,7 @@ fun ExploreBookItem(
if (intro.isNotEmpty()) {
Text(
text = intro,
style = MaterialTheme.typography.bodySmall,
style = MaterialTheme.typography.labelSmall,
color = Color.Gray,
maxLines = 2,
minLines = 2,
@@ -8,6 +8,7 @@ import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.animateColorAsState
import androidx.compose.animation.animateContentSize
import androidx.compose.animation.core.FastOutSlowInEasing
import androidx.compose.animation.core.animateDpAsState
import androidx.compose.animation.core.tween
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
@@ -34,6 +35,7 @@ import androidx.compose.runtime.*
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.shadow
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.hapticfeedback.HapticFeedback
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
@@ -47,6 +49,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import androidx.compose.ui.zIndex
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.google.gson.Gson
import io.legado.app.R
@@ -500,13 +503,27 @@ fun ReplaceRuleScreen(
ReorderableItem(
state = reorderableState,
key = ui.id
) { _ ->
) { isDragging ->
val elevation by animateDpAsState(if (isDragging) 8.dp else 0.dp)
ReplaceRuleItem(
modifier = Modifier
.padding(horizontal = 12.dp)
.zIndex(if (isDragging) 1f else 0f)
.shadow(
elevation = elevation,
shape = MaterialTheme.shapes.medium,
clip = false
)
.then(
if (canReorder) {
Modifier.longPressDraggableHandle(
onDragStarted = {
hapticFeedback.performHapticFeedback(HapticFeedbackType.GestureThresholdActivate)
},
onDragStopped = {
hapticFeedback.performHapticFeedback(HapticFeedbackType.GestureEnd)
},
interactionSource = remember { MutableInteractionSource() }
)
} else {