一些界面优化

This commit is contained in:
HapeLee
2026-05-29 01:27:56 +08:00
parent 562af402d9
commit a512ad0b4a
6 changed files with 60 additions and 21 deletions
@@ -398,12 +398,18 @@ private fun BookInfoTransparentTopAppBar(
TopBarNavigationButton(onClick = onBackPressed) TopBarNavigationButton(onClick = onBackPressed)
}, },
actions = { actions = {
Box(modifier = Modifier.padding(end = 12.dp)) {
Row(
horizontalArrangement = Arrangement.spacedBy(8.dp)
) {
BookInfoTopBarActions( BookInfoTopBarActions(
state = state, state = state,
showMenu = showMenu, showMenu = showMenu,
onShowMenuChange = onShowMenuChange, onShowMenuChange = onShowMenuChange,
onMenuAction = onMenuAction, onMenuAction = onMenuAction,
) )
}
}
}, },
scrollBehavior = (scrollBehavior as? M3GlassScrollBehavior)?.m3Behavior, scrollBehavior = (scrollBehavior as? M3GlassScrollBehavior)?.m3Behavior,
colors = topBarColors, colors = topBarColors,
@@ -8,6 +8,7 @@ import androidx.compose.animation.core.FastOutSlowInEasing
import androidx.compose.animation.core.tween import androidx.compose.animation.core.tween
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ExperimentalLayoutApi import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
@@ -187,6 +188,7 @@ private fun BookshelfManageScreen(
var deleteOriginalBookFile by remember { mutableStateOf(state.deleteBookOriginal) } var deleteOriginalBookFile by remember { mutableStateOf(state.deleteBookOriginal) }
val exportBookPathKey = remember { "exportBookPath" } val exportBookPathKey = remember { "exportBookPath" }
val exportTypes = remember { arrayListOf("txt", "epub") } val exportTypes = remember { arrayListOf("txt", "epub") }
val commonCharsets = remember { listOf("UTF-8", "GBK", "GB2312", "GB18030", "Big5", "UTF-16") }
val focusRequester = remember { FocusRequester() } val focusRequester = remember { FocusRequester() }
val exportFolderText = stringResource(R.string.export_folder) val exportFolderText = stringResource(R.string.export_folder)
val exportAllText = stringResource(R.string.export_all) val exportAllText = stringResource(R.string.export_all)
@@ -496,6 +498,7 @@ private fun BookshelfManageScreen(
} }
}, },
dropDownMenuContent = { dismiss -> dropDownMenuContent = { dismiss ->
var showCharsetMenu by remember { mutableStateOf(false) }
RoundDropdownMenuItem( RoundDropdownMenuItem(
text = stringResource(R.string.download_all), text = stringResource(R.string.download_all),
onClick = { onClick = {
@@ -531,14 +534,37 @@ private fun BookshelfManageScreen(
showExportTypeDialog = true showExportTypeDialog = true
} }
) )
Box {
RoundDropdownMenuItem( RoundDropdownMenuItem(
text = "${stringResource(R.string.export_charset)} (${state.exportConfig.exportCharset})", text = "${stringResource(R.string.export_charset)} (${state.exportConfig.exportCharset})",
onClick = { showCharsetMenu = true }
)
RoundDropdownMenu(
expanded = showCharsetMenu,
onDismissRequest = { showCharsetMenu = false }
) { subDismiss ->
commonCharsets.forEach { charset ->
RoundDropdownMenuItem(
text = charset,
isSelected = state.exportConfig.exportCharset == charset,
onClick = { onClick = {
viewModel.dispatch(BookshelfManageScreenIntent.SetExportCharset(charset))
subDismiss()
dismiss() dismiss()
}
)
}
PillDivider()
RoundDropdownMenuItem(
text = "自定义...",
onClick = {
subDismiss()
exportCharsetInput = state.exportConfig.exportCharset exportCharsetInput = state.exportConfig.exportCharset
showCharsetDialog = true showCharsetDialog = true
} }
) )
}
}
PillDivider() PillDivider()
RoundDropdownMenuItem( RoundDropdownMenuItem(
text = "替换净化", text = "替换净化",
@@ -70,6 +70,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.Role import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.role import androidx.compose.ui.semantics.role
import androidx.compose.ui.semantics.semantics import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.viewinterop.AndroidView import androidx.compose.ui.viewinterop.AndroidView
import androidx.constraintlayout.compose.ConstraintLayout import androidx.constraintlayout.compose.ConstraintLayout
@@ -832,7 +833,9 @@ fun ThemeConfigScreen(
} }
} }
}, },
modifier = Modifier.fillMaxSize() modifier = Modifier
.fillMaxSize()
.padding(12.dp)
) )
} }
} }
@@ -889,7 +892,11 @@ fun ThemeModeSelector(
Spacer(Modifier.size(ToggleButtonDefaults.IconSpacing)) Spacer(Modifier.size(ToggleButtonDefaults.IconSpacing))
Text(text = label) Text(
text = label,
overflow = TextOverflow.Ellipsis,
maxLines = 1
)
} }
} }
} }
@@ -74,6 +74,7 @@ import io.legado.app.ui.main.homepage.modules.RankingModule
import io.legado.app.ui.main.homepage.modules.WaterfallItem import io.legado.app.ui.main.homepage.modules.WaterfallItem
import io.legado.app.ui.config.themeConfig.ThemeConfig import io.legado.app.ui.config.themeConfig.ThemeConfig
import io.legado.app.ui.theme.LegadoTheme import io.legado.app.ui.theme.LegadoTheme
import io.legado.app.ui.theme.adaptiveContentPadding
import io.legado.app.ui.theme.adaptiveContentPaddingBookshelf import io.legado.app.ui.theme.adaptiveContentPaddingBookshelf
import io.legado.app.ui.widget.components.AppPullToRefresh import io.legado.app.ui.widget.components.AppPullToRefresh
import io.legado.app.ui.widget.components.AppScaffold import io.legado.app.ui.widget.components.AppScaffold
@@ -386,10 +387,9 @@ private fun ModuleList(
modifier = modifier, modifier = modifier,
verticalItemSpacing = 16.dp, verticalItemSpacing = 16.dp,
horizontalArrangement = Arrangement.spacedBy(12.dp), horizontalArrangement = Arrangement.spacedBy(12.dp),
contentPadding = adaptiveContentPaddingBookshelf( contentPadding = adaptiveContentPadding(
top = paddingValues.calculateTopPadding(), top = paddingValues.calculateTopPadding(),
bottom = if (ThemeConfig.useFloatingBottomBar || ThemeConfig.enableBlur) 120.dp else 8.dp, bottom = if (ThemeConfig.useFloatingBottomBar || ThemeConfig.enableBlur) 120.dp else 8.dp
horizontal = 4.dp
), ),
) { ) {
processedModules.forEach { moduleUi -> processedModules.forEach { moduleUi ->
@@ -333,11 +333,11 @@ fun RssSourceGridItem(
leadingIcon = { leadingIcon = {
MenuItemIcon( MenuItemIcon(
Icons.Default.Delete, Icons.Default.Delete,
tint = MaterialTheme.colorScheme.error tint = LegadoTheme.colorScheme.error
) )
}, },
text = stringResource(R.string.delete), text = stringResource(R.string.delete),
color = MaterialTheme.colorScheme.error, color = LegadoTheme.colorScheme.error,
onClick = { onClick = {
onDelete() onDelete()
showMenu = false showMenu = false
@@ -122,7 +122,7 @@ fun RoundDropdownMenuItem(
} }
} else { } else {
val colorScheme = rememberOpaqueColorScheme() val colorScheme = rememberOpaqueColorScheme()
val selectedContentColor = colorScheme.onPrimaryContainer val selectedContentColor = colorScheme.primary
val defaultContentColor = colorScheme.onSurface val defaultContentColor = colorScheme.onSurface
val contentColor = if (enabled) { val contentColor = if (enabled) {
when { when {