[优化] 优化部分界面的模糊效果
This commit is contained in:
10 files changed
+221
-132
No files matched your search
@@ -49,6 +49,7 @@ import androidx.compose.ui.unit.dp
|
|||||||
import io.legado.app.data.entities.Bookmark
|
import io.legado.app.data.entities.Bookmark
|
||||||
import io.legado.app.ui.theme.LegadoTheme
|
import io.legado.app.ui.theme.LegadoTheme
|
||||||
import io.legado.app.ui.theme.ThemeResolver
|
import io.legado.app.ui.theme.ThemeResolver
|
||||||
|
import io.legado.app.ui.theme.adaptiveContentPaddingOnlyVertical
|
||||||
import io.legado.app.ui.theme.adaptiveHorizontalPadding
|
import io.legado.app.ui.theme.adaptiveHorizontalPadding
|
||||||
import io.legado.app.ui.widget.components.AppScaffold
|
import io.legado.app.ui.widget.components.AppScaffold
|
||||||
import io.legado.app.ui.widget.components.EmptyMessageView
|
import io.legado.app.ui.widget.components.EmptyMessageView
|
||||||
@@ -203,7 +204,6 @@ fun AllBookmarkScreen(
|
|||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.padding(paddingValues)
|
|
||||||
) {
|
) {
|
||||||
AnimatedContent(
|
AnimatedContent(
|
||||||
targetState = contentState,
|
targetState = contentState,
|
||||||
@@ -216,6 +216,10 @@ fun AllBookmarkScreen(
|
|||||||
isLoading = true,
|
isLoading = true,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
|
.padding(
|
||||||
|
top = paddingValues.calculateTopPadding(),
|
||||||
|
bottom = 120.dp
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,6 +228,10 @@ fun AllBookmarkScreen(
|
|||||||
message = "没有书签!",
|
message = "没有书签!",
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
|
.padding(
|
||||||
|
top = paddingValues.calculateTopPadding(),
|
||||||
|
bottom = 120.dp
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,7 +241,11 @@ fun AllBookmarkScreen(
|
|||||||
) {
|
) {
|
||||||
FastScrollLazyColumn(
|
FastScrollLazyColumn(
|
||||||
state = listState,
|
state = listState,
|
||||||
modifier = Modifier.fillMaxSize()
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
contentPadding = adaptiveContentPaddingOnlyVertical(
|
||||||
|
top = paddingValues.calculateTopPadding(),
|
||||||
|
bottom = 120.dp
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
items(
|
items(
|
||||||
items = bookmarkGroups,
|
items = bookmarkGroups,
|
||||||
@@ -245,7 +257,7 @@ fun AllBookmarkScreen(
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.animateItem()
|
.animateItem()
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(horizontal = 16.dp, vertical = 4.dp),
|
.padding(vertical = 4.dp),
|
||||||
shape = MaterialTheme.shapes.medium,
|
shape = MaterialTheme.shapes.medium,
|
||||||
containerColor = LegadoTheme.colorScheme.surfaceContainer
|
containerColor = LegadoTheme.colorScheme.surfaceContainer
|
||||||
) {
|
) {
|
||||||
@@ -288,7 +300,10 @@ fun AllBookmarkScreen(
|
|||||||
TopFloatingStickyItem(
|
TopFloatingStickyItem(
|
||||||
item = stickyGroup,
|
item = stickyGroup,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(top = 4.dp, start = 8.dp)
|
.padding(
|
||||||
|
top = paddingValues.calculateTopPadding() + 4.dp,
|
||||||
|
start = 8.dp
|
||||||
|
)
|
||||||
) { group ->
|
) { group ->
|
||||||
TextCard(
|
TextCard(
|
||||||
text = group.bookName,
|
text = group.bookName,
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ import io.legado.app.help.book.isLocal
|
|||||||
import io.legado.app.ui.book.toc.rule.TxtTocRuleActivity
|
import io.legado.app.ui.book.toc.rule.TxtTocRuleActivity
|
||||||
import io.legado.app.ui.replace.ReplaceEditRoute
|
import io.legado.app.ui.replace.ReplaceEditRoute
|
||||||
import io.legado.app.ui.theme.LegadoTheme
|
import io.legado.app.ui.theme.LegadoTheme
|
||||||
|
import io.legado.app.ui.theme.adaptiveContentPaddingOnlyVertical
|
||||||
import io.legado.app.ui.theme.adaptiveHorizontalPadding
|
import io.legado.app.ui.theme.adaptiveHorizontalPadding
|
||||||
import io.legado.app.ui.widget.CollapsibleHeader
|
import io.legado.app.ui.widget.CollapsibleHeader
|
||||||
import io.legado.app.ui.widget.components.ActionItem
|
import io.legado.app.ui.widget.components.ActionItem
|
||||||
@@ -103,9 +104,11 @@ import io.legado.app.ui.widget.components.SelectionBottomBar
|
|||||||
import io.legado.app.ui.widget.components.bookmark.BookmarkEditSheet
|
import io.legado.app.ui.widget.components.bookmark.BookmarkEditSheet
|
||||||
import io.legado.app.ui.widget.components.bookmark.BookmarkItem
|
import io.legado.app.ui.widget.components.bookmark.BookmarkItem
|
||||||
import io.legado.app.ui.widget.components.button.SmallOutlinedIconToggleButton
|
import io.legado.app.ui.widget.components.button.SmallOutlinedIconToggleButton
|
||||||
|
import io.legado.app.ui.widget.components.card.TextCard
|
||||||
import io.legado.app.ui.widget.components.divider.PillDivider
|
import io.legado.app.ui.widget.components.divider.PillDivider
|
||||||
import io.legado.app.ui.widget.components.divider.PillHeaderDivider
|
import io.legado.app.ui.widget.components.divider.PillHeaderDivider
|
||||||
import io.legado.app.ui.widget.components.lazylist.FastScrollLazyColumn
|
import io.legado.app.ui.widget.components.lazylist.FastScrollLazyColumn
|
||||||
|
import io.legado.app.ui.widget.components.list.TopFloatingStickyItem
|
||||||
import io.legado.app.ui.widget.components.menuItem.RoundDropdownMenu
|
import io.legado.app.ui.widget.components.menuItem.RoundDropdownMenu
|
||||||
import io.legado.app.ui.widget.components.menuItem.RoundDropdownMenuItem
|
import io.legado.app.ui.widget.components.menuItem.RoundDropdownMenuItem
|
||||||
import io.legado.app.ui.widget.components.tabRow.AppTabRow
|
import io.legado.app.ui.widget.components.tabRow.AppTabRow
|
||||||
@@ -193,6 +196,23 @@ fun TocScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val isOnTocPage = pagerState.currentPage == 0
|
val isOnTocPage = pagerState.currentPage == 0
|
||||||
|
val collapsedVolumes by viewModel.collapsedVolumes.collectAsStateWithLifecycle()
|
||||||
|
val stickyVolume by remember(state.items, collapsedVolumes, isOnTocPage, listState) {
|
||||||
|
derivedStateOf {
|
||||||
|
if (!isOnTocPage || state.items.isEmpty()) return@derivedStateOf null
|
||||||
|
val firstVisibleIndex = listState.firstVisibleItemIndex
|
||||||
|
if (firstVisibleIndex !in state.items.indices) return@derivedStateOf null
|
||||||
|
|
||||||
|
val volumeIndex = (firstVisibleIndex downTo 0)
|
||||||
|
.firstOrNull { state.items[it].isVolume } ?: return@derivedStateOf null
|
||||||
|
val volumeItem = state.items[volumeIndex]
|
||||||
|
val isCollapsed = collapsedVolumes.contains(volumeItem.id)
|
||||||
|
val shouldStick =
|
||||||
|
firstVisibleIndex > volumeIndex || listState.firstVisibleItemScrollOffset > 24
|
||||||
|
|
||||||
|
if (!isCollapsed && shouldStick) volumeItem else null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val fabItems = remember(state.items) {
|
val fabItems = remember(state.items) {
|
||||||
listOf(
|
listOf(
|
||||||
@@ -445,10 +465,7 @@ fun TocScreen(
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (pagerState.currentPage == 0 && hasVolumes) {
|
if (pagerState.currentPage == 0 && hasVolumes) {
|
||||||
Box(
|
Box {
|
||||||
modifier = Modifier
|
|
||||||
.padding(end = 16.dp)
|
|
||||||
) {
|
|
||||||
SmallOutlinedIconToggleButton(
|
SmallOutlinedIconToggleButton(
|
||||||
checked = showVolumeMenu,
|
checked = showVolumeMenu,
|
||||||
onCheckedChange = { showVolumeMenu = it },
|
onCheckedChange = { showVolumeMenu = it },
|
||||||
@@ -566,27 +583,56 @@ fun TocScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
Column(modifier = Modifier.padding(padding)) {
|
HorizontalPager(state = pagerState) { page ->
|
||||||
HorizontalPager(state = pagerState) { page ->
|
when (page) {
|
||||||
when (page) {
|
0 -> ChapterListContent(
|
||||||
0 -> ChapterListContent(
|
viewModel = viewModel,
|
||||||
viewModel = viewModel,
|
listState = listState,
|
||||||
listState = listState,
|
onChapterClick = onChapterClick,
|
||||||
onChapterClick = onChapterClick,
|
contentPadding = adaptiveContentPaddingOnlyVertical(
|
||||||
contentPadding = PaddingValues(bottom = if (isSelectionMode) 80.dp else 0.dp)
|
top = padding.calculateTopPadding(),
|
||||||
|
bottom = 120.dp
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
1 -> BookmarkListContent(
|
1 -> BookmarkListContent(
|
||||||
viewModel = viewModel,
|
viewModel = viewModel,
|
||||||
onBookmarkLongClick = onBookmarkClick,
|
onBookmarkLongClick = onBookmarkClick,
|
||||||
onBookmarkClick = { bookmark ->
|
onBookmarkClick = { bookmark ->
|
||||||
editingBookmark = bookmark
|
editingBookmark = bookmark
|
||||||
},
|
},
|
||||||
contentPadding = PaddingValues(bottom = if (isSelectionMode) 80.dp else 0.dp)
|
contentPadding = adaptiveContentPaddingOnlyVertical(
|
||||||
|
top = padding.calculateTopPadding(),
|
||||||
|
bottom = 120.dp
|
||||||
)
|
)
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TopFloatingStickyItem(
|
||||||
|
item = stickyVolume,
|
||||||
|
modifier = Modifier
|
||||||
|
.align(Alignment.TopStart)
|
||||||
|
.padding(top = padding.calculateTopPadding() + 4.dp, start = 8.dp)
|
||||||
|
) { volume ->
|
||||||
|
TextCard(
|
||||||
|
text = volume.title,
|
||||||
|
textStyle = LegadoTheme.typography.labelLarge,
|
||||||
|
backgroundColor = LegadoTheme.colorScheme.cardContainer,
|
||||||
|
contentColor = LegadoTheme.colorScheme.onCardContainer,
|
||||||
|
cornerRadius = 8.dp,
|
||||||
|
horizontalPadding = 8.dp,
|
||||||
|
verticalPadding = 6.dp,
|
||||||
|
onClick = {
|
||||||
|
scope.launch {
|
||||||
|
val index = state.items.indexOfFirst { it.id == volume.id }
|
||||||
|
if (index >= 0) {
|
||||||
|
listState.animateScrollToItem(index)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val bookmarkForSheet = editingBookmark ?: remember(editingBookmark == null) {
|
val bookmarkForSheet = editingBookmark ?: remember(editingBookmark == null) {
|
||||||
@@ -629,7 +675,7 @@ fun ChapterListContent(
|
|||||||
|
|
||||||
if (uiItem.isVolume) {
|
if (uiItem.isVolume) {
|
||||||
|
|
||||||
stickyHeader(key = "volume-${uiItem.id}") {
|
item(key = "volume-${uiItem.id}") {
|
||||||
CollapsibleHeader(
|
CollapsibleHeader(
|
||||||
modifier = Modifier.animateItem(),
|
modifier = Modifier.animateItem(),
|
||||||
title = uiItem.title,
|
title = uiItem.title,
|
||||||
@@ -711,7 +757,7 @@ fun ChapterItem(
|
|||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(horizontal = 16.dp, vertical = 16.dp),
|
.adaptiveHorizontalPadding(vertical = 16.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
Column(modifier = Modifier.weight(1f)) {
|
Column(modifier = Modifier.weight(1f)) {
|
||||||
@@ -810,7 +856,12 @@ fun BookmarkListContent(
|
|||||||
|
|
||||||
if (bookmarks.isEmpty()) {
|
if (bookmarks.isEmpty()) {
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.padding(
|
||||||
|
top = contentPadding.calculateTopPadding(),
|
||||||
|
bottom = contentPadding.calculateBottomPadding()
|
||||||
|
),
|
||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
EmptyMessageView(
|
EmptyMessageView(
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
package io.legado.app.ui.config
|
package io.legado.app.ui.config
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Column
|
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.rememberScrollState
|
|
||||||
import androidx.compose.foundation.verticalScroll
|
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
@@ -12,6 +9,7 @@ import androidx.compose.ui.input.nestedscroll.nestedScroll
|
|||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import io.legado.app.R
|
import io.legado.app.R
|
||||||
|
import io.legado.app.ui.theme.adaptiveContentPadding
|
||||||
import io.legado.app.ui.widget.components.AppScaffold
|
import io.legado.app.ui.widget.components.AppScaffold
|
||||||
import io.legado.app.ui.widget.components.SplicedColumnGroup
|
import io.legado.app.ui.widget.components.SplicedColumnGroup
|
||||||
import io.legado.app.ui.widget.components.button.TopBarNavigationButton
|
import io.legado.app.ui.widget.components.button.TopBarNavigationButton
|
||||||
@@ -43,34 +41,36 @@ fun ConfigNavScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
) { paddingValues ->
|
) { paddingValues ->
|
||||||
Column(
|
LazyColumn(
|
||||||
modifier = Modifier
|
modifier = Modifier.fillMaxSize(),
|
||||||
.fillMaxSize()
|
contentPadding = adaptiveContentPadding(
|
||||||
.padding(paddingValues)
|
top = paddingValues.calculateTopPadding(),
|
||||||
.verticalScroll(rememberScrollState())
|
bottom = 120.dp
|
||||||
.padding(16.dp)
|
)
|
||||||
) {
|
) {
|
||||||
SplicedColumnGroup {
|
item {
|
||||||
ClickableSettingItem(
|
SplicedColumnGroup {
|
||||||
title = stringResource(R.string.theme_setting),
|
ClickableSettingItem(
|
||||||
onClick = onNavigateToTheme
|
title = stringResource(R.string.theme_setting),
|
||||||
)
|
onClick = onNavigateToTheme
|
||||||
ClickableSettingItem(
|
)
|
||||||
title = stringResource(R.string.other_setting),
|
ClickableSettingItem(
|
||||||
onClick = onNavigateToOther
|
title = stringResource(R.string.other_setting),
|
||||||
)
|
onClick = onNavigateToOther
|
||||||
ClickableSettingItem(
|
)
|
||||||
title = stringResource(R.string.read_config),
|
ClickableSettingItem(
|
||||||
onClick = onNavigateToRead
|
title = stringResource(R.string.read_config),
|
||||||
)
|
onClick = onNavigateToRead
|
||||||
ClickableSettingItem(
|
)
|
||||||
title = stringResource(R.string.cover_config),
|
ClickableSettingItem(
|
||||||
onClick = onNavigateToCover
|
title = stringResource(R.string.cover_config),
|
||||||
)
|
onClick = onNavigateToCover
|
||||||
ClickableSettingItem(
|
)
|
||||||
title = stringResource(R.string.backup_restore),
|
ClickableSettingItem(
|
||||||
onClick = onNavigateToBackup
|
title = stringResource(R.string.backup_restore),
|
||||||
)
|
onClick = onNavigateToBackup
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,9 +12,7 @@ import androidx.compose.foundation.layout.height
|
|||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.foundation.rememberScrollState
|
|
||||||
import androidx.compose.foundation.text.KeyboardOptions
|
import androidx.compose.foundation.text.KeyboardOptions
|
||||||
import androidx.compose.foundation.verticalScroll
|
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.Visibility
|
import androidx.compose.material.icons.filled.Visibility
|
||||||
import androidx.compose.material.icons.filled.VisibilityOff
|
import androidx.compose.material.icons.filled.VisibilityOff
|
||||||
@@ -46,6 +44,7 @@ import io.legado.app.help.storage.Restore
|
|||||||
import io.legado.app.lib.permission.Permissions
|
import io.legado.app.lib.permission.Permissions
|
||||||
import io.legado.app.lib.permission.PermissionsCompat
|
import io.legado.app.lib.permission.PermissionsCompat
|
||||||
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.widget.components.AppScaffold
|
import io.legado.app.ui.widget.components.AppScaffold
|
||||||
import io.legado.app.ui.widget.components.AppTextField
|
import io.legado.app.ui.widget.components.AppTextField
|
||||||
import io.legado.app.ui.widget.components.SplicedColumnGroup
|
import io.legado.app.ui.widget.components.SplicedColumnGroup
|
||||||
@@ -199,20 +198,21 @@ fun BackupConfigScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
) { paddingValues ->
|
) { paddingValues ->
|
||||||
Column(
|
LazyColumn(
|
||||||
modifier = Modifier
|
modifier = Modifier.fillMaxSize(),
|
||||||
.fillMaxSize()
|
contentPadding = adaptiveContentPadding(
|
||||||
.padding(paddingValues)
|
top = paddingValues.calculateTopPadding(),
|
||||||
.verticalScroll(rememberScrollState())
|
bottom = 120.dp
|
||||||
.padding(16.dp)
|
)
|
||||||
) {
|
) {
|
||||||
SplicedColumnGroup(title = stringResource(R.string.web_dav_set)) {
|
item {
|
||||||
InputSettingItem(
|
SplicedColumnGroup(title = stringResource(R.string.web_dav_set)) {
|
||||||
title = stringResource(R.string.web_dav_url),
|
InputSettingItem(
|
||||||
value = BackupConfig.webDavUrl,
|
title = stringResource(R.string.web_dav_url),
|
||||||
defaultValue = "",
|
value = BackupConfig.webDavUrl,
|
||||||
onConfirm = { BackupConfig.webDavUrl = it }
|
defaultValue = "",
|
||||||
)
|
onConfirm = { BackupConfig.webDavUrl = it }
|
||||||
|
)
|
||||||
|
|
||||||
ClickableSettingItem(
|
ClickableSettingItem(
|
||||||
title = stringResource(R.string.web_dav_account),
|
title = stringResource(R.string.web_dav_account),
|
||||||
@@ -285,7 +285,7 @@ fun BackupConfigScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
SplicedColumnGroup(title = stringResource(R.string.backup_restore)) {
|
SplicedColumnGroup(title = stringResource(R.string.backup_restore)) {
|
||||||
ClickableSettingItem(
|
ClickableSettingItem(
|
||||||
title = stringResource(R.string.backup_path),
|
title = stringResource(R.string.backup_path),
|
||||||
description = BackupConfig.backupPath
|
description = BackupConfig.backupPath
|
||||||
@@ -403,6 +403,7 @@ fun BackupConfigScreen(
|
|||||||
checked = BackupConfig.onlyLatestBackup,
|
checked = BackupConfig.onlyLatestBackup,
|
||||||
onCheckedChange = { BackupConfig.onlyLatestBackup = it }
|
onCheckedChange = { BackupConfig.onlyLatestBackup = it }
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,13 +3,10 @@ package io.legado.app.ui.config.coverConfig
|
|||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.border
|
import androidx.compose.foundation.border
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.padding
|
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.shape.CircleShape
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
import androidx.compose.foundation.verticalScroll
|
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
@@ -25,6 +22,7 @@ import androidx.compose.ui.res.stringResource
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import io.legado.app.R
|
import io.legado.app.R
|
||||||
import io.legado.app.constant.PreferKey
|
import io.legado.app.constant.PreferKey
|
||||||
|
import io.legado.app.ui.theme.adaptiveContentPadding
|
||||||
import io.legado.app.ui.widget.components.AppScaffold
|
import io.legado.app.ui.widget.components.AppScaffold
|
||||||
import io.legado.app.ui.widget.components.SplicedColumnGroup
|
import io.legado.app.ui.widget.components.SplicedColumnGroup
|
||||||
import io.legado.app.ui.widget.components.button.TopBarNavigationButton
|
import io.legado.app.ui.widget.components.button.TopBarNavigationButton
|
||||||
@@ -59,14 +57,15 @@ fun CoverConfigScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
) { paddingValues ->
|
) { paddingValues ->
|
||||||
Column(
|
LazyColumn(
|
||||||
modifier = Modifier
|
modifier = Modifier.fillMaxSize(),
|
||||||
.fillMaxSize()
|
contentPadding = adaptiveContentPadding(
|
||||||
.padding(paddingValues)
|
top = paddingValues.calculateTopPadding(),
|
||||||
.verticalScroll(rememberScrollState())
|
bottom = 120.dp
|
||||||
.padding(16.dp)
|
)
|
||||||
) {
|
) {
|
||||||
SplicedColumnGroup {
|
item {
|
||||||
|
SplicedColumnGroup {
|
||||||
SwitchSettingItem(
|
SwitchSettingItem(
|
||||||
title = stringResource(R.string.only_wifi),
|
title = stringResource(R.string.only_wifi),
|
||||||
description = stringResource(R.string.only_wifi_summary),
|
description = stringResource(R.string.only_wifi_summary),
|
||||||
@@ -187,7 +186,7 @@ fun CoverConfigScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
SplicedColumnGroup(title = stringResource(R.string.night)) {
|
SplicedColumnGroup(title = stringResource(R.string.night)) {
|
||||||
val coverCount =
|
val coverCount =
|
||||||
CoverConfig.defaultCoverDark.split(",").filter { it.isNotBlank() }.size
|
CoverConfig.defaultCoverDark.split(",").filter { it.isNotBlank() }.size
|
||||||
ClickableSettingItem(
|
ClickableSettingItem(
|
||||||
@@ -242,6 +241,7 @@ fun CoverConfigScreen(
|
|||||||
enabled = CoverConfig.coverShowNameN,
|
enabled = CoverConfig.coverShowNameN,
|
||||||
onCheckedChange = { viewModel.updateShowAuthor(it, true) }
|
onCheckedChange = { viewModel.updateShowAuthor(it, true) }
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,12 +5,9 @@ import android.os.Build
|
|||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.activity.compose.rememberLauncherForActivityResult
|
import androidx.activity.compose.rememberLauncherForActivityResult
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
import androidx.compose.foundation.layout.Column
|
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.rememberScrollState
|
|
||||||
import androidx.compose.foundation.verticalScroll
|
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
@@ -26,6 +23,7 @@ import androidx.compose.ui.unit.dp
|
|||||||
import io.legado.app.R
|
import io.legado.app.R
|
||||||
import io.legado.app.service.WebService
|
import io.legado.app.service.WebService
|
||||||
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.widget.components.AppScaffold
|
import io.legado.app.ui.widget.components.AppScaffold
|
||||||
import io.legado.app.ui.widget.components.AppTextField
|
import io.legado.app.ui.widget.components.AppTextField
|
||||||
import io.legado.app.ui.widget.components.SplicedColumnGroup
|
import io.legado.app.ui.widget.components.SplicedColumnGroup
|
||||||
@@ -90,15 +88,15 @@ fun OtherConfigScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
) { paddingValues ->
|
) { paddingValues ->
|
||||||
Column(
|
LazyColumn(
|
||||||
modifier = Modifier
|
modifier = Modifier.fillMaxSize(),
|
||||||
.fillMaxSize()
|
contentPadding = adaptiveContentPadding(
|
||||||
.padding(paddingValues)
|
top = paddingValues.calculateTopPadding(),
|
||||||
.verticalScroll(rememberScrollState())
|
bottom = 120.dp
|
||||||
.padding(16.dp)
|
)
|
||||||
) {
|
) {
|
||||||
|
item {
|
||||||
SplicedColumnGroup {
|
SplicedColumnGroup {
|
||||||
DropdownListSettingItem(
|
DropdownListSettingItem(
|
||||||
title = stringResource(R.string.language),
|
title = stringResource(R.string.language),
|
||||||
selectedValue = OtherConfig.language,
|
selectedValue = OtherConfig.language,
|
||||||
@@ -282,7 +280,7 @@ fun OtherConfigScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
SplicedColumnGroup(title = stringResource(R.string.other_setting)) {
|
SplicedColumnGroup(title = stringResource(R.string.other_setting)) {
|
||||||
|
|
||||||
SwitchSettingItem(
|
SwitchSettingItem(
|
||||||
title = stringResource(R.string.use_animation),
|
title = stringResource(R.string.use_animation),
|
||||||
@@ -394,6 +392,7 @@ fun OtherConfigScreen(
|
|||||||
checked = OtherConfig.recordHeapDump,
|
checked = OtherConfig.recordHeapDump,
|
||||||
onCheckedChange = { OtherConfig.recordHeapDump = it }
|
onCheckedChange = { OtherConfig.recordHeapDump = it }
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
package io.legado.app.ui.config.readConfig
|
package io.legado.app.ui.config.readConfig
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Column
|
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.rememberScrollState
|
|
||||||
import androidx.compose.foundation.verticalScroll
|
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
@@ -18,6 +15,7 @@ import androidx.compose.ui.res.stringArrayResource
|
|||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import io.legado.app.R
|
import io.legado.app.R
|
||||||
|
import io.legado.app.ui.theme.adaptiveContentPadding
|
||||||
import io.legado.app.ui.widget.components.AppScaffold
|
import io.legado.app.ui.widget.components.AppScaffold
|
||||||
import io.legado.app.ui.widget.components.SplicedColumnGroup
|
import io.legado.app.ui.widget.components.SplicedColumnGroup
|
||||||
import io.legado.app.ui.widget.components.button.TopBarNavigationButton
|
import io.legado.app.ui.widget.components.button.TopBarNavigationButton
|
||||||
@@ -52,15 +50,15 @@ fun ReadConfigScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
) { paddingValues ->
|
) { paddingValues ->
|
||||||
Column(
|
LazyColumn(
|
||||||
modifier = Modifier
|
modifier = Modifier.fillMaxSize(),
|
||||||
.fillMaxSize()
|
contentPadding = adaptiveContentPadding(
|
||||||
.padding(paddingValues)
|
top = paddingValues.calculateTopPadding(),
|
||||||
.verticalScroll(rememberScrollState())
|
bottom = 120.dp
|
||||||
.padding(16.dp)
|
)
|
||||||
) {
|
) {
|
||||||
|
item {
|
||||||
SplicedColumnGroup(title = stringResource(R.string.screen_settings)) {
|
SplicedColumnGroup(title = stringResource(R.string.screen_settings)) {
|
||||||
DropdownListSettingItem(
|
DropdownListSettingItem(
|
||||||
title = stringResource(R.string.screen_direction),
|
title = stringResource(R.string.screen_direction),
|
||||||
selectedValue = ReadConfig.screenOrientation,
|
selectedValue = ReadConfig.screenOrientation,
|
||||||
@@ -236,7 +234,7 @@ fun ReadConfigScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
SplicedColumnGroup(title = stringResource(R.string.other)) {
|
SplicedColumnGroup(title = stringResource(R.string.other)) {
|
||||||
SwitchSettingItem(
|
SwitchSettingItem(
|
||||||
title = stringResource(R.string.enable_slider_vibrator),
|
title = stringResource(R.string.enable_slider_vibrator),
|
||||||
checked = ReadConfig.sliderVibrator,
|
checked = ReadConfig.sliderVibrator,
|
||||||
@@ -316,6 +314,7 @@ fun ReadConfigScreen(
|
|||||||
checked = ReadConfig.showReadTitleAddition,
|
checked = ReadConfig.showReadTitleAddition,
|
||||||
onCheckedChange = { ReadConfig.showReadTitleAddition = it }
|
onCheckedChange = { ReadConfig.showReadTitleAddition = it }
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,12 +24,11 @@ import androidx.compose.foundation.layout.height
|
|||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.width
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.LazyRow
|
import androidx.compose.foundation.lazy.LazyRow
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.foundation.rememberScrollState
|
|
||||||
import androidx.compose.foundation.shape.CircleShape
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.foundation.verticalScroll
|
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.BrightnessMedium
|
import androidx.compose.material.icons.filled.BrightnessMedium
|
||||||
import androidx.compose.material.icons.filled.Check
|
import androidx.compose.material.icons.filled.Check
|
||||||
@@ -78,6 +77,7 @@ import io.legado.app.lib.theme.primaryColor
|
|||||||
import io.legado.app.ui.theme.LegadoTheme
|
import io.legado.app.ui.theme.LegadoTheme
|
||||||
import io.legado.app.ui.theme.ThemeManager
|
import io.legado.app.ui.theme.ThemeManager
|
||||||
import io.legado.app.ui.theme.ThemeResolver
|
import io.legado.app.ui.theme.ThemeResolver
|
||||||
|
import io.legado.app.ui.theme.adaptiveContentPadding
|
||||||
import io.legado.app.ui.widget.components.AppScaffold
|
import io.legado.app.ui.widget.components.AppScaffold
|
||||||
import io.legado.app.ui.widget.components.AppTextField
|
import io.legado.app.ui.widget.components.AppTextField
|
||||||
import io.legado.app.ui.widget.components.SplicedColumnGroup
|
import io.legado.app.ui.widget.components.SplicedColumnGroup
|
||||||
@@ -134,22 +134,23 @@ fun ThemeConfigScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
) { paddingValues ->
|
) { paddingValues ->
|
||||||
Column(
|
LazyColumn(
|
||||||
modifier = Modifier
|
modifier = Modifier.fillMaxSize(),
|
||||||
.fillMaxSize()
|
contentPadding = adaptiveContentPadding(
|
||||||
.padding(paddingValues)
|
top = paddingValues.calculateTopPadding(),
|
||||||
.verticalScroll(rememberScrollState())
|
bottom = 120.dp
|
||||||
.padding(16.dp)
|
)
|
||||||
) {
|
) {
|
||||||
val composeEngine = ThemeConfig.composeEngine
|
item {
|
||||||
val isMiuixEngine = remember(composeEngine) {
|
val composeEngine = ThemeConfig.composeEngine
|
||||||
ThemeResolver.isMiuixEngine(composeEngine)
|
val isMiuixEngine = remember(composeEngine) {
|
||||||
}
|
ThemeResolver.isMiuixEngine(composeEngine)
|
||||||
val isDarkTheme = when (selectedThemeMode) {
|
}
|
||||||
"1" -> false
|
val isDarkTheme = when (selectedThemeMode) {
|
||||||
"2" -> true
|
"1" -> false
|
||||||
else -> isSystemInDarkTheme()
|
"2" -> true
|
||||||
}
|
else -> isSystemInDarkTheme()
|
||||||
|
}
|
||||||
|
|
||||||
if (!isMiuixEngine) {
|
if (!isMiuixEngine) {
|
||||||
Column(
|
Column(
|
||||||
@@ -513,7 +514,7 @@ fun ThemeConfigScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SplicedColumnGroup(title = stringResource(R.string.night)) {
|
SplicedColumnGroup(title = stringResource(R.string.night)) {
|
||||||
val hasDarkBg = !ThemeConfig.bgImageDark.isNullOrBlank()
|
val hasDarkBg = !ThemeConfig.bgImageDark.isNullOrBlank()
|
||||||
ClickableSettingItem(
|
ClickableSettingItem(
|
||||||
title = stringResource(R.string.background_image),
|
title = stringResource(R.string.background_image),
|
||||||
@@ -535,6 +536,7 @@ fun ThemeConfigScreen(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,12 +14,34 @@ fun Modifier.adaptiveHorizontalPadding(): Modifier {
|
|||||||
return this.padding(horizontal = horizontal)
|
return this.padding(horizontal = horizontal)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun Modifier.adaptiveHorizontalPadding(
|
||||||
|
vertical: Dp,
|
||||||
|
): Modifier {
|
||||||
|
val horizontal = if (ThemeResolver.isMiuixEngine(composeEngine)) 12.dp else 16.dp
|
||||||
|
return this.padding(horizontal = horizontal, vertical = vertical)
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun Modifier.adaptiveVerticalPadding(): Modifier {
|
fun Modifier.adaptiveVerticalPadding(): Modifier {
|
||||||
val horizontal = if (ThemeResolver.isMiuixEngine(composeEngine)) 12.dp else 8.dp
|
val horizontal = if (ThemeResolver.isMiuixEngine(composeEngine)) 12.dp else 8.dp
|
||||||
return this.padding(horizontal = horizontal)
|
return this.padding(horizontal = horizontal)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun adaptiveContentPaddingOnlyVertical(
|
||||||
|
top: Dp,
|
||||||
|
bottom: Dp
|
||||||
|
): PaddingValues {
|
||||||
|
val adjustedTop = if (ThemeResolver.isMiuixEngine(composeEngine)) top + 8.dp else top
|
||||||
|
return PaddingValues(
|
||||||
|
top = adjustedTop,
|
||||||
|
bottom = bottom,
|
||||||
|
start = 0.dp,
|
||||||
|
end = 0.dp
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun adaptiveContentPadding(
|
fun adaptiveContentPadding(
|
||||||
top: Dp,
|
top: Dp,
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.Column
|
|||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.padding
|
|
||||||
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
|
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
|
||||||
import androidx.compose.material3.Surface
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
@@ -18,6 +17,7 @@ import androidx.compose.ui.text.style.TextOverflow
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import io.legado.app.data.entities.Bookmark
|
import io.legado.app.data.entities.Bookmark
|
||||||
import io.legado.app.ui.theme.LegadoTheme
|
import io.legado.app.ui.theme.LegadoTheme
|
||||||
|
import io.legado.app.ui.theme.adaptiveHorizontalPadding
|
||||||
import io.legado.app.ui.widget.components.text.AppText
|
import io.legado.app.ui.widget.components.text.AppText
|
||||||
|
|
||||||
@OptIn(ExperimentalFoundationApi::class, ExperimentalMaterial3ExpressiveApi::class)
|
@OptIn(ExperimentalFoundationApi::class, ExperimentalMaterial3ExpressiveApi::class)
|
||||||
@@ -47,7 +47,7 @@ fun BookmarkItem(
|
|||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(horizontal = 16.dp, vertical = 12.dp)
|
.adaptiveHorizontalPadding(vertical = 12.dp)
|
||||||
) {
|
) {
|
||||||
AppText(
|
AppText(
|
||||||
text = bookmark.chapterName,
|
text = bookmark.chapterName,
|
||||||
|
|||||||
Reference in new issue
Block a user