书籍详情代码优化

This commit is contained in:
HapeLee committed 2026-05-14 00:13:42 +08:00
1 parent 8598cca9b3
commit 1c7a37d542
3 files changed
+22 -17

No files matched your search

@@ -166,7 +166,7 @@ object BookshelfConfig {
} }
/** /**
* 文件夹在列表模式下的样式: 0: 默认, 1: 横排封面 * 文件夹在列表模式下的样式: 0: 默认, 2: 横排封面
*/ */
var bookshelfGroupListStyle by prefDelegate(PreferKey.bookshelfGroupListStyle, 0) var bookshelfGroupListStyle by prefDelegate(PreferKey.bookshelfGroupListStyle, 0)
@@ -180,7 +180,23 @@ fun BookshelfConfigSheet(
AnimatedVisibility( AnimatedVisibility(
visible = layoutMode != 1 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) { AnimatedVisibility(visible = !isHorizontalCovers) {
Column( 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 = val listColCount =
if (isLandscape) BookshelfConfig.bookshelfLayoutListLandscape else BookshelfConfig.bookshelfLayoutListPortrait if (isLandscape) BookshelfConfig.bookshelfLayoutListLandscape else BookshelfConfig.bookshelfLayoutListPortrait
CompactSliderSettingItem( CompactSliderSettingItem(
@@ -216,12 +225,6 @@ fun BookshelfConfigSheet(
} }
) )
CompactClickableSettingItem(
title = "卡片背景颜色",
color = LegadoTheme.colorScheme.surface,
onClick = { showColorPicker = true }
)
CompactSwitchSettingItem( CompactSwitchSettingItem(
title = "显示更多信息", title = "显示更多信息",
checked = BookshelfConfig.showBookIntro, checked = BookshelfConfig.showBookIntro,
@@ -282,7 +285,7 @@ fun BookshelfConfigSheet(
} }
} }
} }
}
} }
CompactSliderSettingItem( CompactSliderSettingItem(
@@ -75,7 +75,9 @@ fun CoilBookCover(
} }
val hasCustomDefault = !randomPath.isNullOrBlank() val hasCustomDefault = !randomPath.isNullOrBlank()
var isOnlineCoverLoaded by remember(path) { mutableStateOf(false) } var isOnlineCoverLoaded by remember(path) {
mutableStateOf(sharedCoverKey != null && finalPath != null)
}
Box( Box(
modifier = modifier modifier = modifier