文件夹样式可与书架样式分开设置
This commit is contained in:
@@ -259,6 +259,12 @@ object PreferKey {
|
||||
const val bookshelfLayoutGridPortrait = "bookshelfLayoutGridPortrait"
|
||||
const val bookshelfLayoutListLandscape = "bookshelfLayoutListLandscape"
|
||||
const val bookshelfLayoutListPortrait = "bookshelfLayoutListPortrait"
|
||||
const val bookshelfFolderLayoutModePortrait = "bookshelfFolderLayoutModePortrait"
|
||||
const val bookshelfFolderLayoutModeLandscape = "bookshelfFolderLayoutModeLandscape"
|
||||
const val bookshelfFolderLayoutGridPortrait = "bookshelfFolderLayoutGridPortrait"
|
||||
const val bookshelfFolderLayoutGridLandscape = "bookshelfFolderLayoutGridLandscape"
|
||||
const val bookshelfFolderLayoutListPortrait = "bookshelfFolderLayoutListPortrait"
|
||||
const val bookshelfFolderLayoutListLandscape = "bookshelfFolderLayoutListLandscape"
|
||||
const val bookshelfTitleSmallFont = "bookshelfTitleSmallFont"
|
||||
const val bookshelfTitleCenter = "bookshelfTitleCenter"
|
||||
const val bookshelfTitleMaxLines = "bookshelfTitleMaxLines"
|
||||
|
||||
@@ -123,6 +123,36 @@ object BookshelfConfig {
|
||||
*/
|
||||
var bookshelfLayoutListLandscape by prefDelegate(PreferKey.bookshelfLayoutListLandscape, 1)
|
||||
|
||||
/**
|
||||
* 文件夹竖屏布局模式: 0:列表, 1:网格
|
||||
*/
|
||||
var bookshelfFolderLayoutModePortrait by prefDelegate(PreferKey.bookshelfFolderLayoutModePortrait, 1)
|
||||
|
||||
/**
|
||||
* 文件夹竖屏网格列数
|
||||
*/
|
||||
var bookshelfFolderLayoutGridPortrait by prefDelegate(PreferKey.bookshelfFolderLayoutGridPortrait, 3)
|
||||
|
||||
/**
|
||||
* 文件夹横屏布局模式: 0:列表, 1:网格
|
||||
*/
|
||||
var bookshelfFolderLayoutModeLandscape by prefDelegate(PreferKey.bookshelfFolderLayoutModeLandscape, 1)
|
||||
|
||||
/**
|
||||
* 文件夹横屏网格列数
|
||||
*/
|
||||
var bookshelfFolderLayoutGridLandscape by prefDelegate(PreferKey.bookshelfFolderLayoutGridLandscape, 7)
|
||||
|
||||
/**
|
||||
* 文件夹竖屏列表列数
|
||||
*/
|
||||
var bookshelfFolderLayoutListPortrait by prefDelegate(PreferKey.bookshelfFolderLayoutListPortrait, 1)
|
||||
|
||||
/**
|
||||
* 文件夹横屏列表列数
|
||||
*/
|
||||
var bookshelfFolderLayoutListLandscape by prefDelegate(PreferKey.bookshelfFolderLayoutListLandscape, 1)
|
||||
|
||||
/**
|
||||
* 网格模式布局样式: 0:标准, 1:紧凑, 2:仅封面
|
||||
*/
|
||||
|
||||
@@ -91,10 +91,13 @@ fun BookshelfConfigSheet(
|
||||
onValueChange = { BookshelfConfig.bookshelfSortOrder = it.toInt() }
|
||||
)
|
||||
|
||||
// Layout Mode
|
||||
// Layout Mode (non-folder)
|
||||
val layoutMode =
|
||||
if (isLandscape) BookshelfConfig.bookshelfLayoutModeLandscape
|
||||
else BookshelfConfig.bookshelfLayoutModePortrait
|
||||
val folderLayoutMode =
|
||||
if (isLandscape) BookshelfConfig.bookshelfFolderLayoutModeLandscape
|
||||
else BookshelfConfig.bookshelfFolderLayoutModePortrait
|
||||
|
||||
CompactDropdownSettingItem(
|
||||
title = stringResource(R.string.layout_mode),
|
||||
@@ -108,8 +111,57 @@ fun BookshelfConfigSheet(
|
||||
}
|
||||
)
|
||||
|
||||
// Folder Layout Mode
|
||||
AnimatedVisibility(visible = BookshelfConfig.bookGroupStyle == 2) {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
CompactDropdownSettingItem(
|
||||
title = "文件夹布局模式",
|
||||
description = stringResource(if (isLandscape) R.string.screen_landscape else R.string.screen_portrait),
|
||||
selectedValue = folderLayoutMode.toString(),
|
||||
displayEntries = arrayOf(stringResource(R.string.layout_mode_list), stringResource(R.string.layout_mode_grid)),
|
||||
entryValues = arrayOf("0", "1"),
|
||||
onValueChange = {
|
||||
if (isLandscape) BookshelfConfig.bookshelfFolderLayoutModeLandscape = it.toInt()
|
||||
else BookshelfConfig.bookshelfFolderLayoutModePortrait = it.toInt()
|
||||
}
|
||||
)
|
||||
|
||||
AnimatedVisibility(visible = folderLayoutMode == 1) {
|
||||
val folderGridCount =
|
||||
if (isLandscape) BookshelfConfig.bookshelfFolderLayoutGridLandscape
|
||||
else BookshelfConfig.bookshelfFolderLayoutGridPortrait
|
||||
CompactSliderSettingItem(
|
||||
title = stringResource(R.string.number_rows_columns),
|
||||
value = folderGridCount.toFloat(),
|
||||
valueRange = 1f..15f,
|
||||
steps = 14,
|
||||
onValueChange = {
|
||||
if (isLandscape) BookshelfConfig.bookshelfFolderLayoutGridLandscape = it.toInt()
|
||||
else BookshelfConfig.bookshelfFolderLayoutGridPortrait = it.toInt()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
AnimatedVisibility(visible = folderLayoutMode != 1) {
|
||||
val folderListCount =
|
||||
if (isLandscape) BookshelfConfig.bookshelfFolderLayoutListLandscape
|
||||
else BookshelfConfig.bookshelfFolderLayoutListPortrait
|
||||
CompactSliderSettingItem(
|
||||
title = stringResource(R.string.number_rows_columns),
|
||||
value = folderListCount.toFloat(),
|
||||
valueRange = 1f..5f,
|
||||
steps = 4,
|
||||
onValueChange = {
|
||||
if (isLandscape) BookshelfConfig.bookshelfFolderLayoutListLandscape = it.toInt()
|
||||
else BookshelfConfig.bookshelfFolderLayoutListPortrait = it.toInt()
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AnimatedVisibility(
|
||||
visible = BookshelfConfig.bookGroupStyle == 2 && layoutMode == 0
|
||||
visible = BookshelfConfig.bookGroupStyle == 2 && folderLayoutMode == 0
|
||||
) {
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp)
|
||||
|
||||
@@ -333,6 +333,21 @@ fun BookshelfScreen(
|
||||
if (isLandscape) BookshelfConfig.bookshelfLayoutListLandscape else BookshelfConfig.bookshelfLayoutListPortrait
|
||||
}
|
||||
}
|
||||
val bookshelfFolderLayoutMode by remember {
|
||||
derivedStateOf {
|
||||
if (isLandscape) BookshelfConfig.bookshelfFolderLayoutModeLandscape else BookshelfConfig.bookshelfFolderLayoutModePortrait
|
||||
}
|
||||
}
|
||||
val bookshelfFolderLayoutGrid by remember {
|
||||
derivedStateOf {
|
||||
if (isLandscape) BookshelfConfig.bookshelfFolderLayoutGridLandscape else BookshelfConfig.bookshelfFolderLayoutGridPortrait
|
||||
}
|
||||
}
|
||||
val bookshelfFolderLayoutList by remember {
|
||||
derivedStateOf {
|
||||
if (isLandscape) BookshelfConfig.bookshelfFolderLayoutListLandscape else BookshelfConfig.bookshelfFolderLayoutListPortrait
|
||||
}
|
||||
}
|
||||
val currentMenuGroupId by remember {
|
||||
derivedStateOf { if (uiState.isSearch) uiState.selectedGroupId else currentTabGroupId }
|
||||
}
|
||||
@@ -682,8 +697,8 @@ fun BookshelfScreen(
|
||||
) { isRoot ->
|
||||
if (bookGroupStyle == 2 && isRoot && !isUsingStandaloneSearchGroup) {
|
||||
val folderColumns =
|
||||
if (bookshelfLayoutMode == 0) bookshelfLayoutList else bookshelfLayoutGrid
|
||||
val isGridMode = bookshelfLayoutMode != 0
|
||||
if (bookshelfFolderLayoutMode == 0) bookshelfFolderLayoutList else bookshelfFolderLayoutGrid
|
||||
val isGridMode = bookshelfFolderLayoutMode != 0
|
||||
FastScrollLazyVerticalGrid(
|
||||
columns = GridCells.Fixed(folderColumns.coerceAtLeast(1)),
|
||||
modifier = Modifier
|
||||
@@ -712,7 +727,7 @@ fun BookshelfScreen(
|
||||
} else {
|
||||
null
|
||||
}
|
||||
if (bookshelfLayoutMode == 0) {
|
||||
if (bookshelfFolderLayoutMode == 0) {
|
||||
BookGroupItemList(
|
||||
group = group,
|
||||
previewBooks = uiState.groupPreviews[group.groupId]
|
||||
|
||||
Reference in New Issue
Block a user