[优化] 优化部分界面的模糊效果

This commit is contained in:
HapeLee committed 2026-04-10 00:30:56 +08:00
1 parent ce4598fa7f
commit 31cb803c78
10 files changed
+163 -74

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,14 +583,16 @@ 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 = PaddingValues(bottom = if (isSelectionMode) 80.dp else 0.dp) contentPadding = adaptiveContentPaddingOnlyVertical(
top = padding.calculateTopPadding(),
bottom = 120.dp
)
) )
1 -> BookmarkListContent( 1 -> BookmarkListContent(
@@ -582,10 +601,37 @@ fun TocScreen(
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)
}
}
}
)
} }
} }
@@ -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,13 +41,14 @@ 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) )
) { ) {
item {
SplicedColumnGroup { SplicedColumnGroup {
ClickableSettingItem( ClickableSettingItem(
title = stringResource(R.string.theme_setting), title = stringResource(R.string.theme_setting),
@@ -74,4 +73,5 @@ fun ConfigNavScreen(
} }
} }
} }
}
} }
@@ -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,13 +198,14 @@ 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) )
) { ) {
item {
SplicedColumnGroup(title = stringResource(R.string.web_dav_set)) { SplicedColumnGroup(title = stringResource(R.string.web_dav_set)) {
InputSettingItem( InputSettingItem(
title = stringResource(R.string.web_dav_url), title = stringResource(R.string.web_dav_url),
@@ -406,6 +406,7 @@ fun BackupConfigScreen(
} }
} }
} }
}
AppAlertDialog( AppAlertDialog(
show = showWebDavAuthDialog, show = showWebDavAuthDialog,
@@ -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,13 +57,14 @@ 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) )
) { ) {
item {
SplicedColumnGroup { SplicedColumnGroup {
SwitchSettingItem( SwitchSettingItem(
title = stringResource(R.string.only_wifi), title = stringResource(R.string.only_wifi),
@@ -245,6 +244,7 @@ fun CoverConfigScreen(
} }
} }
} }
}
CoverRuleConfigSheet( CoverRuleConfigSheet(
show = showCoverRuleSheet, show = showCoverRuleSheet,
@@ -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,14 +88,14 @@ 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),
@@ -396,6 +394,7 @@ fun OtherConfigScreen(
) )
} }
} }
}
FilePickerSheet( FilePickerSheet(
show = showFilePicker, show = showFilePicker,
@@ -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,14 +50,14 @@ 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),
@@ -319,6 +317,7 @@ fun ReadConfigScreen(
} }
} }
} }
}
PageKeySheet( PageKeySheet(
show = showPageKeySheet, show = showPageKeySheet,
@@ -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,13 +134,14 @@ 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) )
) { ) {
item {
val composeEngine = ThemeConfig.composeEngine val composeEngine = ThemeConfig.composeEngine
val isMiuixEngine = remember(composeEngine) { val isMiuixEngine = remember(composeEngine) {
ThemeResolver.isMiuixEngine(composeEngine) ThemeResolver.isMiuixEngine(composeEngine)
@@ -538,6 +539,7 @@ fun ThemeConfigScreen(
} }
} }
} }
}
AppAlertDialog( AppAlertDialog(
@@ -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,