|
|
@@ -17,6 +17,7 @@ import androidx.compose.runtime.mutableStateOf
|
|
|
import androidx.compose.runtime.remember
|
|
|
import androidx.compose.runtime.setValue
|
|
|
import androidx.compose.ui.Modifier
|
|
|
+import androidx.compose.ui.graphics.toArgb
|
|
|
import androidx.compose.ui.platform.LocalConfiguration
|
|
|
import androidx.compose.ui.res.stringArrayResource
|
|
|
import androidx.compose.ui.res.stringResource
|
|
|
@@ -25,7 +26,9 @@ import io.legado.app.R
|
|
|
import io.legado.app.ui.config.bookshelfConfig.BookshelfConfig
|
|
|
import io.legado.app.ui.config.themeConfig.LabelColorManageSheet
|
|
|
import io.legado.app.ui.config.themeConfig.ThemeConfig
|
|
|
+import io.legado.app.ui.theme.LegadoTheme
|
|
|
import io.legado.app.ui.widget.components.card.GlassCard
|
|
|
+import io.legado.app.ui.widget.components.dialog.ColorPickerSheet
|
|
|
import io.legado.app.ui.widget.components.modalBottomSheet.AppModalBottomSheet
|
|
|
import io.legado.app.ui.widget.components.settingItem.CompactClickableSettingItem
|
|
|
import io.legado.app.ui.widget.components.settingItem.CompactDropdownSettingItem
|
|
|
@@ -41,6 +44,7 @@ fun BookshelfConfigSheet(
|
|
|
val configuration = LocalConfiguration.current
|
|
|
val isLandscape = configuration.orientation == Configuration.ORIENTATION_LANDSCAPE
|
|
|
var showLabelColorManage by remember { mutableStateOf(false) }
|
|
|
+ var showColorPicker by remember { mutableStateOf(false) }
|
|
|
|
|
|
AppModalBottomSheet(
|
|
|
title = stringResource(R.string.bookshelf_layout),
|
|
|
@@ -135,14 +139,14 @@ fun BookshelfConfigSheet(
|
|
|
CompactSwitchSettingItem(
|
|
|
title = stringResource(R.string.compact_title_font),
|
|
|
checked = BookshelfConfig.bookshelfTitleSmallFont,
|
|
|
- color = MaterialTheme.colorScheme.surface,
|
|
|
+ color = LegadoTheme.colorScheme.surface,
|
|
|
onCheckedChange = { BookshelfConfig.bookshelfTitleSmallFont = it }
|
|
|
)
|
|
|
|
|
|
CompactSwitchSettingItem(
|
|
|
title = stringResource(R.string.center_aligned_title),
|
|
|
checked = BookshelfConfig.bookshelfTitleCenter,
|
|
|
- color = MaterialTheme.colorScheme.surface,
|
|
|
+ color = LegadoTheme.colorScheme.surface,
|
|
|
onCheckedChange = { BookshelfConfig.bookshelfTitleCenter = it }
|
|
|
)
|
|
|
}
|
|
|
@@ -157,14 +161,14 @@ fun BookshelfConfigSheet(
|
|
|
CompactSwitchSettingItem(
|
|
|
title = stringResource(R.string.compact_mode),
|
|
|
checked = BookshelfConfig.bookshelfLayoutCompact,
|
|
|
- color = MaterialTheme.colorScheme.surface,
|
|
|
+ color = LegadoTheme.colorScheme.surface,
|
|
|
onCheckedChange = { BookshelfConfig.bookshelfLayoutCompact = it }
|
|
|
)
|
|
|
|
|
|
CompactSwitchSettingItem(
|
|
|
title = stringResource(R.string.show_divider_line),
|
|
|
checked = BookshelfConfig.bookshelfShowDivider,
|
|
|
- color = MaterialTheme.colorScheme.surface,
|
|
|
+ color = LegadoTheme.colorScheme.surface,
|
|
|
onCheckedChange = { BookshelfConfig.bookshelfShowDivider = it }
|
|
|
)
|
|
|
|
|
|
@@ -181,6 +185,47 @@ fun BookshelfConfigSheet(
|
|
|
else BookshelfConfig.bookshelfLayoutListPortrait = it.toInt()
|
|
|
}
|
|
|
)
|
|
|
+
|
|
|
+ CompactClickableSettingItem(
|
|
|
+ title = "卡片背景颜色",
|
|
|
+ color = LegadoTheme.colorScheme.surface,
|
|
|
+ onClick = { showColorPicker = true }
|
|
|
+ )
|
|
|
+
|
|
|
+ CompactSwitchSettingItem(
|
|
|
+ title = "显示更多信息",
|
|
|
+ checked = BookshelfConfig.showBookIntro,
|
|
|
+ color = LegadoTheme.colorScheme.surface,
|
|
|
+ onCheckedChange = { BookshelfConfig.showBookIntro = it }
|
|
|
+ )
|
|
|
+
|
|
|
+ AnimatedVisibility(visible = BookshelfConfig.showBookIntro) {
|
|
|
+ Column(
|
|
|
+ verticalArrangement = Arrangement.spacedBy(8.dp)
|
|
|
+ ) {
|
|
|
+ CompactSliderSettingItem(
|
|
|
+ title = "简介行数",
|
|
|
+ description = if (BookshelfConfig.bookshelfIntroMaxLines == 0) "显示全部简介" else "显示 ${BookshelfConfig.bookshelfIntroMaxLines} 行简介",
|
|
|
+ value = BookshelfConfig.bookshelfIntroMaxLines.toFloat(),
|
|
|
+ valueRange = 0f..10f,
|
|
|
+ steps = 10,
|
|
|
+ onValueChange = { BookshelfConfig.bookshelfIntroMaxLines = it.toInt() }
|
|
|
+ )
|
|
|
+ CompactSwitchSettingItem(
|
|
|
+ title = "自定义标签颜色",
|
|
|
+ checked = ThemeConfig.enableCustomTagColors,
|
|
|
+ color = LegadoTheme.colorScheme.surface,
|
|
|
+ onCheckedChange = { ThemeConfig.enableCustomTagColors = it }
|
|
|
+ )
|
|
|
+ AnimatedVisibility(visible = ThemeConfig.enableCustomTagColors) {
|
|
|
+ CompactClickableSettingItem(
|
|
|
+ title = "管理标签颜色",
|
|
|
+ color = LegadoTheme.colorScheme.surface,
|
|
|
+ onClick = { showLabelColorManage = true }
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -195,14 +240,14 @@ fun BookshelfConfigSheet(
|
|
|
CompactSwitchSettingItem(
|
|
|
title = stringResource(R.string.cover_shadow),
|
|
|
checked = BookshelfConfig.bookshelfCoverShadow,
|
|
|
- color = MaterialTheme.colorScheme.surface,
|
|
|
+ color = LegadoTheme.colorScheme.surface,
|
|
|
onCheckedChange = { BookshelfConfig.bookshelfCoverShadow = it }
|
|
|
)
|
|
|
|
|
|
CompactSwitchSettingItem(
|
|
|
title = "搜索按钮优先打开筛选栏",
|
|
|
checked = BookshelfConfig.bookshelfSearchActionDirectToSearch,
|
|
|
- color = MaterialTheme.colorScheme.surface,
|
|
|
+ color = LegadoTheme.colorScheme.surface,
|
|
|
onCheckedChange = { BookshelfConfig.bookshelfSearchActionDirectToSearch = it }
|
|
|
)
|
|
|
|
|
|
@@ -210,88 +255,56 @@ fun BookshelfConfigSheet(
|
|
|
CompactSwitchSettingItem(
|
|
|
title = stringResource(R.string.show_unread),
|
|
|
checked = BookshelfConfig.showUnread,
|
|
|
- color = MaterialTheme.colorScheme.surface,
|
|
|
+ color = LegadoTheme.colorScheme.surface,
|
|
|
onCheckedChange = { BookshelfConfig.showUnread = it }
|
|
|
)
|
|
|
|
|
|
CompactSwitchSettingItem(
|
|
|
title = stringResource(R.string.show_unread_new),
|
|
|
checked = BookshelfConfig.showUnreadNew,
|
|
|
- color = MaterialTheme.colorScheme.surface,
|
|
|
+ color = LegadoTheme.colorScheme.surface,
|
|
|
onCheckedChange = { BookshelfConfig.showUnreadNew = it }
|
|
|
)
|
|
|
|
|
|
CompactSwitchSettingItem(
|
|
|
title = stringResource(R.string.show_tip),
|
|
|
checked = BookshelfConfig.showTip,
|
|
|
- color = MaterialTheme.colorScheme.surface,
|
|
|
+ color = LegadoTheme.colorScheme.surface,
|
|
|
onCheckedChange = { BookshelfConfig.showTip = it }
|
|
|
)
|
|
|
|
|
|
CompactSwitchSettingItem(
|
|
|
title = stringResource(R.string.show_book_count),
|
|
|
checked = BookshelfConfig.showBookCount,
|
|
|
- color = MaterialTheme.colorScheme.surface,
|
|
|
+ color = LegadoTheme.colorScheme.surface,
|
|
|
onCheckedChange = { BookshelfConfig.showBookCount = it }
|
|
|
)
|
|
|
|
|
|
CompactSwitchSettingItem(
|
|
|
title = stringResource(R.string.show_last_update_time),
|
|
|
checked = BookshelfConfig.showLastUpdateTime,
|
|
|
- color = MaterialTheme.colorScheme.surface,
|
|
|
+ color = LegadoTheme.colorScheme.surface,
|
|
|
onCheckedChange = { BookshelfConfig.showLastUpdateTime = it }
|
|
|
)
|
|
|
|
|
|
- CompactSwitchSettingItem(
|
|
|
- title = "列表模式显示更多",
|
|
|
- checked = BookshelfConfig.showBookIntro,
|
|
|
- color = MaterialTheme.colorScheme.surface,
|
|
|
- onCheckedChange = { BookshelfConfig.showBookIntro = it }
|
|
|
- )
|
|
|
-
|
|
|
- AnimatedVisibility(visible = BookshelfConfig.showBookIntro) {
|
|
|
- CompactSliderSettingItem(
|
|
|
- title = "简介行数",
|
|
|
- description = if (BookshelfConfig.bookshelfIntroMaxLines == 0) "显示全部简介" else "显示 ${BookshelfConfig.bookshelfIntroMaxLines} 行简介",
|
|
|
- value = BookshelfConfig.bookshelfIntroMaxLines.toFloat(),
|
|
|
- valueRange = 0f..10f,
|
|
|
- steps = 10,
|
|
|
- onValueChange = { BookshelfConfig.bookshelfIntroMaxLines = it.toInt() }
|
|
|
- )
|
|
|
- CompactSwitchSettingItem(
|
|
|
- title = "自定义标签颜色",
|
|
|
- checked = ThemeConfig.enableCustomTagColors,
|
|
|
- color = MaterialTheme.colorScheme.surface,
|
|
|
- onCheckedChange = { ThemeConfig.enableCustomTagColors = it }
|
|
|
- )
|
|
|
-
|
|
|
- AnimatedVisibility(visible = ThemeConfig.enableCustomTagColors) {
|
|
|
- CompactClickableSettingItem(
|
|
|
- title = "管理标签颜色",
|
|
|
- color = MaterialTheme.colorScheme.surface,
|
|
|
- onClick = { showLabelColorManage = true }
|
|
|
- )
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
CompactSwitchSettingItem(
|
|
|
title = stringResource(R.string.show_wait_up_count),
|
|
|
checked = BookshelfConfig.showWaitUpCount,
|
|
|
- color = MaterialTheme.colorScheme.surface,
|
|
|
+ color = LegadoTheme.colorScheme.surface,
|
|
|
onCheckedChange = { BookshelfConfig.showWaitUpCount = it }
|
|
|
)
|
|
|
|
|
|
CompactSwitchSettingItem(
|
|
|
title = stringResource(R.string.show_bookshelf_fast_scroller),
|
|
|
checked = BookshelfConfig.showBookshelfFastScroller,
|
|
|
- color = MaterialTheme.colorScheme.surface,
|
|
|
+ color = LegadoTheme.colorScheme.surface,
|
|
|
onCheckedChange = { BookshelfConfig.showBookshelfFastScroller = it }
|
|
|
)
|
|
|
|
|
|
CompactSwitchSettingItem(
|
|
|
title = stringResource(R.string.show_bookshelf_tab_menu),
|
|
|
checked = BookshelfConfig.shouldShowExpandButton,
|
|
|
- color = MaterialTheme.colorScheme.surface,
|
|
|
+ color = LegadoTheme.colorScheme.surface,
|
|
|
onCheckedChange = { BookshelfConfig.shouldShowExpandButton = it }
|
|
|
)
|
|
|
|
|
|
@@ -310,5 +323,12 @@ fun BookshelfConfigSheet(
|
|
|
show = showLabelColorManage,
|
|
|
onDismissRequest = { showLabelColorManage = false }
|
|
|
)
|
|
|
+
|
|
|
+ ColorPickerSheet(
|
|
|
+ show = showColorPicker,
|
|
|
+ initialColor = if (BookshelfConfig.bookshelfCardColor != 0) BookshelfConfig.bookshelfCardColor else LegadoTheme.colorScheme.surfaceVariant.toArgb(),
|
|
|
+ onDismissRequest = { showColorPicker = false },
|
|
|
+ onColorSelected = { BookshelfConfig.bookshelfCardColor = it }
|
|
|
+ )
|
|
|
}
|
|
|
}
|