书籍详情代码优化

This commit is contained in:
HapeLee
2026-05-14 00:13:42 +08:00
parent 8598cca9b3
commit 1c7a37d542
3 changed files with 22 additions and 17 deletions
@@ -166,7 +166,7 @@ object BookshelfConfig {
}
/**
* 文件夹在列表模式下的样式: 0: 默认, 1: 横排封面
* 文件夹在列表模式下的样式: 0: 默认, 2: 横排封面
*/
var bookshelfGroupListStyle by prefDelegate(PreferKey.bookshelfGroupListStyle, 0)
@@ -180,7 +180,23 @@ fun BookshelfConfigSheet(
AnimatedVisibility(
visible = layoutMode != 1
) {
val isHorizontalCovers = BookshelfConfig.bookGroupStyle == 2 && BookshelfConfig.bookshelfGroupListStyle == 2
Column(
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
CompactSwitchSettingItem(
title = stringResource(R.string.show_divider_line),
checked = BookshelfConfig.bookshelfShowDivider,
color = LegadoTheme.colorScheme.surface,
onCheckedChange = { BookshelfConfig.bookshelfShowDivider = it }
)
CompactClickableSettingItem(
title = "卡片背景颜色",
color = LegadoTheme.colorScheme.surface,
onClick = { showColorPicker = true }
)
val isHorizontalCovers = BookshelfConfig.bookGroupStyle == 2 && BookshelfConfig.bookshelfGroupListStyle == 2
AnimatedVisibility(visible = !isHorizontalCovers) {
Column(
@@ -195,13 +211,6 @@ fun BookshelfConfigSheet(
)
}
CompactSwitchSettingItem(
title = stringResource(R.string.show_divider_line),
checked = BookshelfConfig.bookshelfShowDivider,
color = LegadoTheme.colorScheme.surface,
onCheckedChange = { BookshelfConfig.bookshelfShowDivider = it }
)
val listColCount =
if (isLandscape) BookshelfConfig.bookshelfLayoutListLandscape else BookshelfConfig.bookshelfLayoutListPortrait
CompactSliderSettingItem(
@@ -216,12 +225,6 @@ fun BookshelfConfigSheet(
}
)
CompactClickableSettingItem(
title = "卡片背景颜色",
color = LegadoTheme.colorScheme.surface,
onClick = { showColorPicker = true }
)
CompactSwitchSettingItem(
title = "显示更多信息",
checked = BookshelfConfig.showBookIntro,
@@ -282,7 +285,7 @@ fun BookshelfConfigSheet(
}
}
}
}
}
CompactSliderSettingItem(
@@ -75,7 +75,9 @@ fun CoilBookCover(
}
val hasCustomDefault = !randomPath.isNullOrBlank()
var isOnlineCoverLoaded by remember(path) { mutableStateOf(false) }
var isOnlineCoverLoaded by remember(path) {
mutableStateOf(sharedCoverKey != null && finalPath != null)
}
Box(
modifier = modifier