[优化] 一些界面优化

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.IconButton
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.MaterialTheme.colorScheme import androidx.compose.material3.MaterialTheme.colorScheme
import androidx.compose.material3.MediumTopAppBar
import androidx.compose.material3.Scaffold import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource 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.SplicedColumnGroup
import io.legado.app.ui.widget.components.TextCard 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) @OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class)
@Composable @Composable
fun AboutScreen( fun AboutScreen(
@@ -74,9 +60,12 @@ fun AboutScreen(
) { ) {
LocalContext.current LocalContext.current
val scrollBehavior = TopAppBarDefaults.exitUntilCollapsedScrollBehavior()
Scaffold( Scaffold(
modifier = Modifier.nestedScroll(scrollBehavior.nestedScrollConnection),
topBar = { topBar = {
TopAppBar( MediumTopAppBar(
title = { Text(stringResource(R.string.about)) }, title = { Text(stringResource(R.string.about)) },
navigationIcon = { navigationIcon = {
IconButton(onClick = onNavigateBack) { IconButton(onClick = onNavigateBack) {
@@ -85,7 +74,8 @@ fun AboutScreen(
contentDescription = stringResource(R.string.back) contentDescription = stringResource(R.string.back)
) )
} }
} },
scrollBehavior = scrollBehavior
) )
} }
) { padding -> ) { padding ->
@@ -529,7 +529,7 @@ fun ExploreBookItem(
Cover( Cover(
path = book.coverUrl, path = book.coverUrl,
modifier = Modifier.width(70.dp), modifier = Modifier.width(72.dp),
badgeContent = badge) badgeContent = badge)
Spacer(modifier = Modifier.width(8.dp)) Spacer(modifier = Modifier.width(8.dp))
@@ -556,14 +556,14 @@ fun ExploreBookItem(
if (!latestChapter.isNullOrEmpty()) { if (!latestChapter.isNullOrEmpty()) {
Text( Text(
text = "", text = "",
style = MaterialTheme.typography.bodySmall, style = MaterialTheme.typography.labelSmall,
color = Color.Gray, color = Color.Gray,
maxLines = 1 maxLines = 1
) )
Text( Text(
text = "最新: $latestChapter", text = "最新: $latestChapter",
style = MaterialTheme.typography.bodySmall, style = MaterialTheme.typography.labelSmall,
color = Color.Gray, color = Color.Gray,
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis overflow = TextOverflow.Ellipsis
@@ -575,7 +575,7 @@ fun ExploreBookItem(
if (intro.isNotEmpty()) { if (intro.isNotEmpty()) {
Text( Text(
text = intro, text = intro,
style = MaterialTheme.typography.bodySmall, style = MaterialTheme.typography.labelSmall,
color = Color.Gray, color = Color.Gray,
maxLines = 2, maxLines = 2,
minLines = 2, minLines = 2,
@@ -8,6 +8,7 @@ import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.animateColorAsState import androidx.compose.animation.animateColorAsState
import androidx.compose.animation.animateContentSize import androidx.compose.animation.animateContentSize
import androidx.compose.animation.core.FastOutSlowInEasing import androidx.compose.animation.core.FastOutSlowInEasing
import androidx.compose.animation.core.animateDpAsState
import androidx.compose.animation.core.tween import androidx.compose.animation.core.tween
import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut import androidx.compose.animation.fadeOut
@@ -34,6 +35,7 @@ import androidx.compose.runtime.*
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.shadow
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.hapticfeedback.HapticFeedback import androidx.compose.ui.hapticfeedback.HapticFeedback
import androidx.compose.ui.hapticfeedback.HapticFeedbackType 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.text.style.TextOverflow
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog import androidx.compose.ui.window.Dialog
import androidx.compose.ui.zIndex
import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.google.gson.Gson import com.google.gson.Gson
import io.legado.app.R import io.legado.app.R
@@ -500,13 +503,27 @@ fun ReplaceRuleScreen(
ReorderableItem( ReorderableItem(
state = reorderableState, state = reorderableState,
key = ui.id key = ui.id
) { _ -> ) { isDragging ->
val elevation by animateDpAsState(if (isDragging) 8.dp else 0.dp)
ReplaceRuleItem( ReplaceRuleItem(
modifier = Modifier modifier = Modifier
.padding(horizontal = 12.dp) .padding(horizontal = 12.dp)
.zIndex(if (isDragging) 1f else 0f)
.shadow(
elevation = elevation,
shape = MaterialTheme.shapes.medium,
clip = false
)
.then( .then(
if (canReorder) { if (canReorder) {
Modifier.longPressDraggableHandle( Modifier.longPressDraggableHandle(
onDragStarted = {
hapticFeedback.performHapticFeedback(HapticFeedbackType.GestureThresholdActivate)
},
onDragStopped = {
hapticFeedback.performHapticFeedback(HapticFeedbackType.GestureEnd)
},
interactionSource = remember { MutableInteractionSource() } interactionSource = remember { MutableInteractionSource() }
) )
} else { } else {