[优化] 优化部分界面的模糊效果
This commit is contained in:
@@ -49,6 +49,7 @@ import androidx.compose.ui.unit.dp
|
||||
import io.legado.app.data.entities.Bookmark
|
||||
import io.legado.app.ui.theme.LegadoTheme
|
||||
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.widget.components.AppScaffold
|
||||
import io.legado.app.ui.widget.components.EmptyMessageView
|
||||
@@ -203,7 +204,6 @@ fun AllBookmarkScreen(
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(paddingValues)
|
||||
) {
|
||||
AnimatedContent(
|
||||
targetState = contentState,
|
||||
@@ -216,6 +216,10 @@ fun AllBookmarkScreen(
|
||||
isLoading = true,
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(
|
||||
top = paddingValues.calculateTopPadding(),
|
||||
bottom = 120.dp
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -224,6 +228,10 @@ fun AllBookmarkScreen(
|
||||
message = "没有书签!",
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(
|
||||
top = paddingValues.calculateTopPadding(),
|
||||
bottom = 120.dp
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -233,7 +241,11 @@ fun AllBookmarkScreen(
|
||||
) {
|
||||
FastScrollLazyColumn(
|
||||
state = listState,
|
||||
modifier = Modifier.fillMaxSize()
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
contentPadding = adaptiveContentPaddingOnlyVertical(
|
||||
top = paddingValues.calculateTopPadding(),
|
||||
bottom = 120.dp
|
||||
)
|
||||
) {
|
||||
items(
|
||||
items = bookmarkGroups,
|
||||
@@ -245,7 +257,7 @@ fun AllBookmarkScreen(
|
||||
modifier = Modifier
|
||||
.animateItem()
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp, vertical = 4.dp),
|
||||
.padding(vertical = 4.dp),
|
||||
shape = MaterialTheme.shapes.medium,
|
||||
containerColor = LegadoTheme.colorScheme.surfaceContainer
|
||||
) {
|
||||
@@ -288,7 +300,10 @@ fun AllBookmarkScreen(
|
||||
TopFloatingStickyItem(
|
||||
item = stickyGroup,
|
||||
modifier = Modifier
|
||||
.padding(top = 4.dp, start = 8.dp)
|
||||
.padding(
|
||||
top = paddingValues.calculateTopPadding() + 4.dp,
|
||||
start = 8.dp
|
||||
)
|
||||
) { group ->
|
||||
TextCard(
|
||||
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.replace.ReplaceEditRoute
|
||||
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.widget.CollapsibleHeader
|
||||
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.BookmarkItem
|
||||
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.PillHeaderDivider
|
||||
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.RoundDropdownMenuItem
|
||||
import io.legado.app.ui.widget.components.tabRow.AppTabRow
|
||||
@@ -193,6 +196,23 @@ fun TocScreen(
|
||||
}
|
||||
|
||||
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) {
|
||||
listOf(
|
||||
@@ -445,10 +465,7 @@ fun TocScreen(
|
||||
)
|
||||
|
||||
if (pagerState.currentPage == 0 && hasVolumes) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.padding(end = 16.dp)
|
||||
) {
|
||||
Box {
|
||||
SmallOutlinedIconToggleButton(
|
||||
checked = showVolumeMenu,
|
||||
onCheckedChange = { showVolumeMenu = it },
|
||||
@@ -566,27 +583,56 @@ fun TocScreen(
|
||||
)
|
||||
}
|
||||
|
||||
Column(modifier = Modifier.padding(padding)) {
|
||||
HorizontalPager(state = pagerState) { page ->
|
||||
when (page) {
|
||||
0 -> ChapterListContent(
|
||||
viewModel = viewModel,
|
||||
listState = listState,
|
||||
onChapterClick = onChapterClick,
|
||||
contentPadding = PaddingValues(bottom = if (isSelectionMode) 80.dp else 0.dp)
|
||||
HorizontalPager(state = pagerState) { page ->
|
||||
when (page) {
|
||||
0 -> ChapterListContent(
|
||||
viewModel = viewModel,
|
||||
listState = listState,
|
||||
onChapterClick = onChapterClick,
|
||||
contentPadding = adaptiveContentPaddingOnlyVertical(
|
||||
top = padding.calculateTopPadding(),
|
||||
bottom = 120.dp
|
||||
)
|
||||
)
|
||||
|
||||
1 -> BookmarkListContent(
|
||||
viewModel = viewModel,
|
||||
onBookmarkLongClick = onBookmarkClick,
|
||||
onBookmarkClick = { bookmark ->
|
||||
editingBookmark = bookmark
|
||||
},
|
||||
contentPadding = PaddingValues(bottom = if (isSelectionMode) 80.dp else 0.dp)
|
||||
1 -> BookmarkListContent(
|
||||
viewModel = viewModel,
|
||||
onBookmarkLongClick = onBookmarkClick,
|
||||
onBookmarkClick = { bookmark ->
|
||||
editingBookmark = bookmark
|
||||
},
|
||||
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) {
|
||||
@@ -629,7 +675,7 @@ fun ChapterListContent(
|
||||
|
||||
if (uiItem.isVolume) {
|
||||
|
||||
stickyHeader(key = "volume-${uiItem.id}") {
|
||||
item(key = "volume-${uiItem.id}") {
|
||||
CollapsibleHeader(
|
||||
modifier = Modifier.animateItem(),
|
||||
title = uiItem.title,
|
||||
@@ -711,7 +757,7 @@ fun ChapterItem(
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.padding(horizontal = 16.dp, vertical = 16.dp),
|
||||
.adaptiveHorizontalPadding(vertical = 16.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
Column(modifier = Modifier.weight(1f)) {
|
||||
@@ -810,7 +856,12 @@ fun BookmarkListContent(
|
||||
|
||||
if (bookmarks.isEmpty()) {
|
||||
Box(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(
|
||||
top = contentPadding.calculateTopPadding(),
|
||||
bottom = contentPadding.calculateBottomPadding()
|
||||
),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
EmptyMessageView(
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package io.legado.app.ui.config
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.runtime.Composable
|
||||
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.unit.dp
|
||||
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.SplicedColumnGroup
|
||||
import io.legado.app.ui.widget.components.button.TopBarNavigationButton
|
||||
@@ -43,34 +41,36 @@ fun ConfigNavScreen(
|
||||
)
|
||||
}
|
||||
) { paddingValues ->
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(paddingValues)
|
||||
.verticalScroll(rememberScrollState())
|
||||
.padding(16.dp)
|
||||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
contentPadding = adaptiveContentPadding(
|
||||
top = paddingValues.calculateTopPadding(),
|
||||
bottom = 120.dp
|
||||
)
|
||||
) {
|
||||
SplicedColumnGroup {
|
||||
ClickableSettingItem(
|
||||
title = stringResource(R.string.theme_setting),
|
||||
onClick = onNavigateToTheme
|
||||
)
|
||||
ClickableSettingItem(
|
||||
title = stringResource(R.string.other_setting),
|
||||
onClick = onNavigateToOther
|
||||
)
|
||||
ClickableSettingItem(
|
||||
title = stringResource(R.string.read_config),
|
||||
onClick = onNavigateToRead
|
||||
)
|
||||
ClickableSettingItem(
|
||||
title = stringResource(R.string.cover_config),
|
||||
onClick = onNavigateToCover
|
||||
)
|
||||
ClickableSettingItem(
|
||||
title = stringResource(R.string.backup_restore),
|
||||
onClick = onNavigateToBackup
|
||||
)
|
||||
item {
|
||||
SplicedColumnGroup {
|
||||
ClickableSettingItem(
|
||||
title = stringResource(R.string.theme_setting),
|
||||
onClick = onNavigateToTheme
|
||||
)
|
||||
ClickableSettingItem(
|
||||
title = stringResource(R.string.other_setting),
|
||||
onClick = onNavigateToOther
|
||||
)
|
||||
ClickableSettingItem(
|
||||
title = stringResource(R.string.read_config),
|
||||
onClick = onNavigateToRead
|
||||
)
|
||||
ClickableSettingItem(
|
||||
title = stringResource(R.string.cover_config),
|
||||
onClick = onNavigateToCover
|
||||
)
|
||||
ClickableSettingItem(
|
||||
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.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Visibility
|
||||
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.PermissionsCompat
|
||||
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.AppTextField
|
||||
import io.legado.app.ui.widget.components.SplicedColumnGroup
|
||||
@@ -199,20 +198,21 @@ fun BackupConfigScreen(
|
||||
)
|
||||
}
|
||||
) { paddingValues ->
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(paddingValues)
|
||||
.verticalScroll(rememberScrollState())
|
||||
.padding(16.dp)
|
||||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
contentPadding = adaptiveContentPadding(
|
||||
top = paddingValues.calculateTopPadding(),
|
||||
bottom = 120.dp
|
||||
)
|
||||
) {
|
||||
SplicedColumnGroup(title = stringResource(R.string.web_dav_set)) {
|
||||
InputSettingItem(
|
||||
title = stringResource(R.string.web_dav_url),
|
||||
value = BackupConfig.webDavUrl,
|
||||
defaultValue = "",
|
||||
onConfirm = { BackupConfig.webDavUrl = it }
|
||||
)
|
||||
item {
|
||||
SplicedColumnGroup(title = stringResource(R.string.web_dav_set)) {
|
||||
InputSettingItem(
|
||||
title = stringResource(R.string.web_dav_url),
|
||||
value = BackupConfig.webDavUrl,
|
||||
defaultValue = "",
|
||||
onConfirm = { BackupConfig.webDavUrl = it }
|
||||
)
|
||||
|
||||
ClickableSettingItem(
|
||||
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(
|
||||
title = stringResource(R.string.backup_path),
|
||||
description = BackupConfig.backupPath
|
||||
@@ -403,6 +403,7 @@ fun BackupConfigScreen(
|
||||
checked = BackupConfig.onlyLatestBackup,
|
||||
onCheckedChange = { BackupConfig.onlyLatestBackup = it }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,13 +3,10 @@ package io.legado.app.ui.config.coverConfig
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
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.verticalScroll
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
@@ -25,6 +22,7 @@ import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.legado.app.R
|
||||
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.SplicedColumnGroup
|
||||
import io.legado.app.ui.widget.components.button.TopBarNavigationButton
|
||||
@@ -59,14 +57,15 @@ fun CoverConfigScreen(
|
||||
)
|
||||
}
|
||||
) { paddingValues ->
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(paddingValues)
|
||||
.verticalScroll(rememberScrollState())
|
||||
.padding(16.dp)
|
||||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
contentPadding = adaptiveContentPadding(
|
||||
top = paddingValues.calculateTopPadding(),
|
||||
bottom = 120.dp
|
||||
)
|
||||
) {
|
||||
SplicedColumnGroup {
|
||||
item {
|
||||
SplicedColumnGroup {
|
||||
SwitchSettingItem(
|
||||
title = stringResource(R.string.only_wifi),
|
||||
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 =
|
||||
CoverConfig.defaultCoverDark.split(",").filter { it.isNotBlank() }.size
|
||||
ClickableSettingItem(
|
||||
@@ -242,6 +241,7 @@ fun CoverConfigScreen(
|
||||
enabled = CoverConfig.coverShowNameN,
|
||||
onCheckedChange = { viewModel.updateShowAuthor(it, true) }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,12 +5,9 @@ import android.os.Build
|
||||
import android.widget.Toast
|
||||
import androidx.activity.compose.rememberLauncherForActivityResult
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
@@ -26,6 +23,7 @@ import androidx.compose.ui.unit.dp
|
||||
import io.legado.app.R
|
||||
import io.legado.app.service.WebService
|
||||
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.AppTextField
|
||||
import io.legado.app.ui.widget.components.SplicedColumnGroup
|
||||
@@ -90,15 +88,15 @@ fun OtherConfigScreen(
|
||||
)
|
||||
}
|
||||
) { paddingValues ->
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(paddingValues)
|
||||
.verticalScroll(rememberScrollState())
|
||||
.padding(16.dp)
|
||||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
contentPadding = adaptiveContentPadding(
|
||||
top = paddingValues.calculateTopPadding(),
|
||||
bottom = 120.dp
|
||||
)
|
||||
) {
|
||||
|
||||
SplicedColumnGroup {
|
||||
item {
|
||||
SplicedColumnGroup {
|
||||
DropdownListSettingItem(
|
||||
title = stringResource(R.string.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(
|
||||
title = stringResource(R.string.use_animation),
|
||||
@@ -394,6 +392,7 @@ fun OtherConfigScreen(
|
||||
checked = OtherConfig.recordHeapDump,
|
||||
onCheckedChange = { OtherConfig.recordHeapDump = it }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package io.legado.app.ui.config.readConfig
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.runtime.Composable
|
||||
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.unit.dp
|
||||
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.SplicedColumnGroup
|
||||
import io.legado.app.ui.widget.components.button.TopBarNavigationButton
|
||||
@@ -52,15 +50,15 @@ fun ReadConfigScreen(
|
||||
)
|
||||
}
|
||||
) { paddingValues ->
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(paddingValues)
|
||||
.verticalScroll(rememberScrollState())
|
||||
.padding(16.dp)
|
||||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
contentPadding = adaptiveContentPadding(
|
||||
top = paddingValues.calculateTopPadding(),
|
||||
bottom = 120.dp
|
||||
)
|
||||
) {
|
||||
|
||||
SplicedColumnGroup(title = stringResource(R.string.screen_settings)) {
|
||||
item {
|
||||
SplicedColumnGroup(title = stringResource(R.string.screen_settings)) {
|
||||
DropdownListSettingItem(
|
||||
title = stringResource(R.string.screen_direction),
|
||||
selectedValue = ReadConfig.screenOrientation,
|
||||
@@ -236,7 +234,7 @@ fun ReadConfigScreen(
|
||||
)
|
||||
}
|
||||
|
||||
SplicedColumnGroup(title = stringResource(R.string.other)) {
|
||||
SplicedColumnGroup(title = stringResource(R.string.other)) {
|
||||
SwitchSettingItem(
|
||||
title = stringResource(R.string.enable_slider_vibrator),
|
||||
checked = ReadConfig.sliderVibrator,
|
||||
@@ -316,6 +314,7 @@ fun ReadConfigScreen(
|
||||
checked = ReadConfig.showReadTitleAddition,
|
||||
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.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.LazyRow
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.BrightnessMedium
|
||||
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.ThemeManager
|
||||
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.AppTextField
|
||||
import io.legado.app.ui.widget.components.SplicedColumnGroup
|
||||
@@ -134,22 +134,23 @@ fun ThemeConfigScreen(
|
||||
)
|
||||
}
|
||||
) { paddingValues ->
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(paddingValues)
|
||||
.verticalScroll(rememberScrollState())
|
||||
.padding(16.dp)
|
||||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
contentPadding = adaptiveContentPadding(
|
||||
top = paddingValues.calculateTopPadding(),
|
||||
bottom = 120.dp
|
||||
)
|
||||
) {
|
||||
val composeEngine = ThemeConfig.composeEngine
|
||||
val isMiuixEngine = remember(composeEngine) {
|
||||
ThemeResolver.isMiuixEngine(composeEngine)
|
||||
}
|
||||
val isDarkTheme = when (selectedThemeMode) {
|
||||
"1" -> false
|
||||
"2" -> true
|
||||
else -> isSystemInDarkTheme()
|
||||
}
|
||||
item {
|
||||
val composeEngine = ThemeConfig.composeEngine
|
||||
val isMiuixEngine = remember(composeEngine) {
|
||||
ThemeResolver.isMiuixEngine(composeEngine)
|
||||
}
|
||||
val isDarkTheme = when (selectedThemeMode) {
|
||||
"1" -> false
|
||||
"2" -> true
|
||||
else -> isSystemInDarkTheme()
|
||||
}
|
||||
|
||||
if (!isMiuixEngine) {
|
||||
Column(
|
||||
@@ -513,7 +514,7 @@ fun ThemeConfigScreen(
|
||||
}
|
||||
}
|
||||
|
||||
SplicedColumnGroup(title = stringResource(R.string.night)) {
|
||||
SplicedColumnGroup(title = stringResource(R.string.night)) {
|
||||
val hasDarkBg = !ThemeConfig.bgImageDark.isNullOrBlank()
|
||||
ClickableSettingItem(
|
||||
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)
|
||||
}
|
||||
|
||||
@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
|
||||
fun Modifier.adaptiveVerticalPadding(): Modifier {
|
||||
val horizontal = if (ThemeResolver.isMiuixEngine(composeEngine)) 12.dp else 8.dp
|
||||
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
|
||||
fun adaptiveContentPadding(
|
||||
top: Dp,
|
||||
|
||||
@@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.runtime.Composable
|
||||
@@ -18,6 +17,7 @@ import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.legado.app.data.entities.Bookmark
|
||||
import io.legado.app.ui.theme.LegadoTheme
|
||||
import io.legado.app.ui.theme.adaptiveHorizontalPadding
|
||||
import io.legado.app.ui.widget.components.text.AppText
|
||||
|
||||
@OptIn(ExperimentalFoundationApi::class, ExperimentalMaterial3ExpressiveApi::class)
|
||||
@@ -47,7 +47,7 @@ fun BookmarkItem(
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp, vertical = 12.dp)
|
||||
.adaptiveHorizontalPadding(vertical = 12.dp)
|
||||
) {
|
||||
AppText(
|
||||
text = bookmark.chapterName,
|
||||
|
||||
Reference in New Issue
Block a user