Explorar el Código

feat: 优化了一下容器相关实现

HapeLee hace 3 meses
padre
commit
71051a78fa

+ 148 - 51
app/src/main/java/io/legado/app/ui/config/themeConfig/BackgroundImageManageSheet.kt

@@ -1,7 +1,9 @@
 package io.legado.app.ui.config.themeConfig
 
+import androidx.compose.foundation.layout.Arrangement
 import androidx.compose.foundation.layout.Box
 import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.Row
 import androidx.compose.foundation.layout.aspectRatio
 import androidx.compose.foundation.layout.fillMaxSize
 import androidx.compose.foundation.layout.fillMaxWidth
@@ -24,79 +26,174 @@ import io.legado.app.ui.widget.components.button.series.SmallTonalButton
 import io.legado.app.ui.widget.components.card.NormalCard
 import io.legado.app.ui.widget.components.icon.AppIcon
 import io.legado.app.ui.widget.components.modalBottomSheet.AppModalBottomSheet
+import io.legado.app.ui.widget.components.settingItem.SliderSettingItem
+import io.legado.app.ui.widget.components.text.AppText
 
+/** 背景图片对应的额外选项:应用背景图为模糊,大容器/项目背景图为透明度。 */
+sealed interface BackgroundImageExtraOption {
+    data class Blur(
+        val lightTitle: String,
+        val darkTitle: String,
+        val lightValue: Int,
+        val darkValue: Int,
+        val onLightChange: (Int) -> Unit,
+        val onDarkChange: (Int) -> Unit,
+    ) : BackgroundImageExtraOption
+
+    data class Opacity(
+        val title: String,
+        val value: Int,
+        val onValueChange: (Int) -> Unit,
+    ) : BackgroundImageExtraOption
+}
+
+/**
+ * 通用亮/暗背景图管理面板:左右两个图片容器(日间/夜间,空时显示添加卡片,
+ * 有图时显示图片与关闭按钮),下方是对应的额外选项(背景虚化或背景图透明度)。
+ */
 @OptIn(ExperimentalMaterial3Api::class)
 @Composable
 fun BackgroundImageManageSheet(
-    isDarkTheme: Boolean?,
-    currentPath: String?,
+    show: Boolean,
     onDismissRequest: () -> Unit,
-    onSelectImage: (Boolean) -> Unit,
-    onRemoveImage: (Boolean) -> Unit,
+    title: String,
+    lightPath: String?,
+    darkPath: String?,
+    extraOption: BackgroundImageExtraOption? = null,
+    onSelectLight: () -> Unit,
+    onSelectDark: () -> Unit,
+    onRemoveLight: () -> Unit,
+    onRemoveDark: () -> Unit,
 ) {
     AppModalBottomSheet(
-        data = isDarkTheme,
+        show = show,
         onDismissRequest = onDismissRequest,
-        title = stringResource(R.string.background_image),
-    ) { isDark ->
+        title = title,
+    ) {
         Column(
             modifier = Modifier
                 .fillMaxWidth()
-                .padding(bottom = 24.dp)
+                .padding(bottom = 24.dp),
+            verticalArrangement = Arrangement.spacedBy(2.dp)
         ) {
+            Row(
+                horizontalArrangement = Arrangement.spacedBy(12.dp),
+                modifier = Modifier.fillMaxWidth()
+            ) {
+                BackgroundImageTile(
+                    label = stringResource(R.string.day),
+                    path = lightPath,
+                    modifier = Modifier.weight(1f),
+                    onSelect = onSelectLight,
+                    onRemove = onRemoveLight,
+                )
+                BackgroundImageTile(
+                    label = stringResource(R.string.night),
+                    path = darkPath,
+                    modifier = Modifier.weight(1f),
+                    onSelect = onSelectDark,
+                    onRemove = onRemoveDark,
+                )
+            }
 
-            if (currentPath.isNullOrBlank()) {
-                NormalCard(
-                    onClick = { onSelectImage(isDark) },
-                    cornerRadius = 12.dp,
-                    containerColor = LegadoTheme.colorScheme.surfaceContainerHigh,
-                    modifier = Modifier
-                        .fillMaxWidth()
-                        .aspectRatio(16f / 9f)
-                        .padding(16.dp)
-                ) {
-                    Box(
-                        modifier = Modifier.fillMaxSize(),
-                        contentAlignment = Alignment.Center
-                    ) {
-                        AppIcon(
-                            imageVector = Icons.Default.Add,
-                            contentDescription = stringResource(R.string.add),
-                            modifier = Modifier.size(48.dp),
-                            tint = LegadoTheme.colorScheme.primary
+            when (val option = extraOption) {
+                is BackgroundImageExtraOption.Blur -> {
+                    if (!lightPath.isNullOrBlank()) {
+                        SliderSettingItem(
+                            title = option.lightTitle,
+                            value = option.lightValue.toFloat(),
+                            defaultValue = 0f,
+                            valueRange = 0f..100f,
+                            onValueChange = { option.onLightChange(it.toInt()) },
                         )
                     }
+                    if (!darkPath.isNullOrBlank()) {
+                        SliderSettingItem(
+                            title = option.darkTitle,
+                            value = option.darkValue.toFloat(),
+                            defaultValue = 0f,
+                            valueRange = 0f..100f,
+                            onValueChange = { option.onDarkChange(it.toInt()) },
+                        )
+                    }
+                }
+
+                is BackgroundImageExtraOption.Opacity -> {
+                    SliderSettingItem(
+                        title = option.title,
+                        description = "${option.value}%",
+                        value = option.value.toFloat(),
+                        defaultValue = 100f,
+                        valueRange = 0f..100f,
+                        onValueChange = { option.onValueChange(it.toInt()) },
+                    )
                 }
-            } else {
+
+                null -> Unit
+            }
+        }
+    }
+}
+
+@Composable
+private fun BackgroundImageTile(
+    label: String,
+    path: String?,
+    modifier: Modifier,
+    onSelect: () -> Unit,
+    onRemove: () -> Unit,
+) {
+    Column(modifier = modifier) {
+        if (path.isNullOrBlank()) {
+            NormalCard(
+                onClick = onSelect,
+                cornerRadius = 12.dp,
+                containerColor = LegadoTheme.colorScheme.surfaceContainerHigh,
+                modifier = Modifier
+                    .fillMaxWidth()
+                    .aspectRatio(1f)
+            ) {
                 Box(
-                    modifier = Modifier
-                        .fillMaxWidth()
-                        .padding(16.dp)
+                    modifier = Modifier.fillMaxSize(),
+                    contentAlignment = Alignment.Center
                 ) {
-                    NormalCard(
-                        cornerRadius = 12.dp,
-                    ) {
-                        AsyncImage(
-                            model = currentPath,
-                            contentDescription = null,
-                            modifier = Modifier
-                                .fillMaxWidth()
-                                .aspectRatio(9f / 16f),
-                            contentScale = ContentScale.Crop
-                        )
-                    }
-                    SmallTonalButton(
-                        onClick = { onRemoveImage(isDark) },
+                    AppIcon(
+                        imageVector = Icons.Default.Add,
+                        contentDescription = stringResource(R.string.add),
+                        modifier = Modifier.size(48.dp),
+                        tint = LegadoTheme.colorScheme.primary
+                    )
+                }
+            }
+        } else {
+            Box(modifier = Modifier.fillMaxWidth()) {
+                NormalCard(
+                    cornerRadius = 12.dp,
+                ) {
+                    AsyncImage(
+                        model = path,
+                        contentDescription = null,
                         modifier = Modifier
-                            .align(Alignment.TopEnd)
-                            .padding(8.dp)
-                            .size(32.dp),
-                        icon = Icons.Default.Close,
-                        contentDescription = stringResource(R.string.close)
+                            .fillMaxWidth()
+                            .aspectRatio(1f),
+                        contentScale = ContentScale.Crop
                     )
                 }
+                SmallTonalButton(
+                    onClick = onRemove,
+                    modifier = Modifier
+                        .align(Alignment.TopEnd)
+                        .padding(8.dp)
+                        .size(32.dp),
+                    icon = Icons.Default.Close,
+                    contentDescription = stringResource(R.string.close)
+                )
             }
         }
+        AppText(
+            text = label,
+            style = LegadoTheme.typography.labelSmall,
+            modifier = Modifier.padding(start = 4.dp, top = 8.dp)
+        )
     }
-
 }

+ 4 - 2
app/src/main/java/io/legado/app/ui/config/themeConfig/ThemeConfigContract.kt

@@ -16,8 +16,7 @@ data class ThemeConfigUiState(
 )
 
 sealed interface ThemeConfigSheet {
-    data class Background(val dark: Boolean) : ThemeConfigSheet
-    data class ContainerBackground(val target: ContainerBackgroundTarget, val dark: Boolean) : ThemeConfigSheet
+    data class BackgroundImage(val target: BackgroundImageTarget) : ThemeConfigSheet
     data object MainNavigation : ThemeConfigSheet
     data object LauncherIcon : ThemeConfigSheet
     data object DividerColor : ThemeConfigSheet
@@ -25,6 +24,9 @@ sealed interface ThemeConfigSheet {
     data object Font : ThemeConfigSheet
 }
 
+/** 背景图片类型:应用的背景图片 / 大容器背景图片 / 项目背景图片 */
+enum class BackgroundImageTarget { App, LargeContainer, Item }
+
 enum class ContainerBackgroundTarget { LargeContainer, Item }
 
 sealed interface ThemeConfigDialog {

+ 145 - 135
app/src/main/java/io/legado/app/ui/config/themeConfig/ThemeConfigScreen.kt

@@ -309,6 +309,19 @@ fun ThemeConfigScreen(
                         description = stringResource(R.string.theme_pack_s),
                         onClick = onNavigateToThemeManage
                     )
+                    ClickableSettingItem(
+                        title = stringResource(R.string.background_image),
+                        description = "日间/夜间背景图与背景虚化",
+                        onClick = {
+                            onIntent(
+                                ThemeConfigIntent.ShowSheet(
+                                    ThemeConfigSheet.BackgroundImage(
+                                        BackgroundImageTarget.App
+                                    )
+                                )
+                            )
+                        }
+                    )
                 }
 
                 SplicedColumnGroup(title = stringResource(R.string.main_activity)) {
@@ -608,56 +621,6 @@ fun ThemeConfigScreen(
                     }
                 }
 
-                SplicedColumnGroup(title = stringResource(R.string.background_image)) {
-                    val hasLightBg = !theme.backgroundImageLight.isNullOrBlank()
-                    ClickableSettingItem(
-                        title = stringResource(R.string.day),
-                        description = if (hasLightBg) stringResource(R.string.click_to_delete) else stringResource(
-                            R.string.select_image
-                        ),
-                        onClick = {
-                            onIntent(
-                                ThemeConfigIntent.ShowSheet(ThemeConfigSheet.Background(false))
-                            )
-                        }
-                    )
-
-                    if (hasLightBg) {
-                        SliderSettingItem(
-                            title = stringResource(R.string.background_image_blurring),
-                            value = theme.backgroundImageBlurring.toFloat(),
-                            defaultValue = 0f,
-                            valueRange = 0f..100f,
-                            onValueChange = { value ->
-                                updateTheme { it.copy(backgroundImageBlurring = value.toInt()) }
-                            }
-                        )
-                    }
-                    val hasDarkBg = !theme.backgroundImageDark.isNullOrBlank()
-                    ClickableSettingItem(
-                        title = stringResource(R.string.night),
-                        description = if (hasDarkBg) stringResource(R.string.click_to_delete) else stringResource(
-                            R.string.select_image
-                        ),
-                        onClick = {
-                            onIntent(
-                                ThemeConfigIntent.ShowSheet(ThemeConfigSheet.Background(true))
-                            )
-                        }
-                    )
-
-                    if (hasDarkBg) {
-                        SliderSettingItem(
-                            title = stringResource(R.string.background_image_blurring),
-                            value = theme.backgroundImageDarkBlurring.toFloat(),
-                            defaultValue = 0f,
-                            valueRange = 0f..100f,
-                            onValueChange = { value ->
-                                updateTheme { it.copy(backgroundImageDarkBlurring = value.toInt()) }
-                            }
-                        )
-                    }
-                }
             }
 
             // Container settings
@@ -672,66 +635,46 @@ fun ThemeConfigScreen(
                         }
                     )
                     AnimatedVisibility(visible = theme.enableContainerBackgroundImage) {
-                        Column {
-                            ContainerBackgroundSettingItem(
-                                title = "大容器日间背景图片",
-                                path = theme.largeContainerBackgroundImageLight,
-                                onClick = {
-                                    onIntent(ThemeConfigIntent.RequestContainerBackgroundImage(ContainerBackgroundTarget.LargeContainer, false))
-                                },
-                                onRemove = {
-                                    onIntent(ThemeConfigIntent.RemoveContainerBackground(ContainerBackgroundTarget.LargeContainer, false))
+                        Column(
+                            verticalArrangement = Arrangement.spacedBy(2.dp)
+                        ) {
+                            ClickableSettingItem(
+                                title = "大容器背景图片",
+                                description = if (theme.largeContainerBackgroundImageLight.isNullOrBlank() &&
+                                    theme.largeContainerBackgroundImageDark.isNullOrBlank()
+                                ) {
+                                    stringResource(R.string.select_image)
+                                } else {
+                                    "已选择"
                                 },
-                            )
-                            ContainerBackgroundSettingItem(
-                                title = "大容器夜间背景图片",
-                                path = theme.largeContainerBackgroundImageDark,
                                 onClick = {
-                                    onIntent(ThemeConfigIntent.RequestContainerBackgroundImage(ContainerBackgroundTarget.LargeContainer, true))
-                                },
-                                onRemove = {
-                                    onIntent(ThemeConfigIntent.RemoveContainerBackground(ContainerBackgroundTarget.LargeContainer, true))
-                                },
-                            )
-                            SliderSettingItem(
-                                title = "大容器背景图透明度",
-                                description = "${theme.appColumnBackgroundOpacity}%",
-                                value = theme.appColumnBackgroundOpacity.toFloat(),
-                                defaultValue = 100f,
-                                valueRange = 0f..100f,
-                                onValueChange = { value ->
-                                    updateTheme { it.copy(appColumnBackgroundOpacity = value.toInt()) }
-                                }
-                            )
-                            SliderSettingItem(
-                                title = "项目背景图透明度",
-                                description = "${theme.glassCardBackgroundOpacity}%",
-                                value = theme.glassCardBackgroundOpacity.toFloat(),
-                                defaultValue = 100f,
-                                valueRange = 0f..100f,
-                                onValueChange = { value ->
-                                    updateTheme { it.copy(glassCardBackgroundOpacity = value.toInt()) }
+                                    onIntent(
+                                        ThemeConfigIntent.ShowSheet(
+                                            ThemeConfigSheet.BackgroundImage(
+                                                BackgroundImageTarget.LargeContainer
+                                            )
+                                        )
+                                    )
                                 }
                             )
-                            ContainerBackgroundSettingItem(
-                                title = "项目日间背景图片",
-                                path = theme.itemBackgroundImageLight,
-                                onClick = {
-                                    onIntent(ThemeConfigIntent.RequestContainerBackgroundImage(ContainerBackgroundTarget.Item, false))
-                                },
-                                onRemove = {
-                                    onIntent(ThemeConfigIntent.RemoveContainerBackground(ContainerBackgroundTarget.Item, false))
+                            ClickableSettingItem(
+                                title = "项目背景图片",
+                                description = if (theme.itemBackgroundImageLight.isNullOrBlank() &&
+                                    theme.itemBackgroundImageDark.isNullOrBlank()
+                                ) {
+                                    stringResource(R.string.select_image)
+                                } else {
+                                    "已选择"
                                 },
-                            )
-                            ContainerBackgroundSettingItem(
-                                title = "项目夜间背景图片",
-                                path = theme.itemBackgroundImageDark,
                                 onClick = {
-                                    onIntent(ThemeConfigIntent.RequestContainerBackgroundImage(ContainerBackgroundTarget.Item, true))
-                                },
-                                onRemove = {
-                                    onIntent(ThemeConfigIntent.RemoveContainerBackground(ContainerBackgroundTarget.Item, true))
-                                },
+                                    onIntent(
+                                        ThemeConfigIntent.ShowSheet(
+                                            ThemeConfigSheet.BackgroundImage(
+                                                BackgroundImageTarget.Item
+                                            )
+                                        )
+                                    )
+                                }
                             )
                         }
                     }
@@ -932,14 +875,106 @@ fun ThemeConfigScreen(
     }
 
 
+    val backgroundImageSheet = state.activeSheet as? ThemeConfigSheet.BackgroundImage
+    val backgroundImageTarget = backgroundImageSheet?.target
+    fun requestImage(dark: Boolean) {
+        when (backgroundImageTarget) {
+            BackgroundImageTarget.App ->
+                onIntent(ThemeConfigIntent.RequestBackgroundImage(dark))
+
+            BackgroundImageTarget.LargeContainer ->
+                onIntent(
+                    ThemeConfigIntent.RequestContainerBackgroundImage(
+                        ContainerBackgroundTarget.LargeContainer,
+                        dark
+                    )
+                )
+
+            BackgroundImageTarget.Item ->
+                onIntent(
+                    ThemeConfigIntent.RequestContainerBackgroundImage(
+                        ContainerBackgroundTarget.Item,
+                        dark
+                    )
+                )
+
+            null -> Unit
+        }
+    }
+
+    fun removeImage(dark: Boolean) {
+        when (backgroundImageTarget) {
+            BackgroundImageTarget.App ->
+                onIntent(ThemeConfigIntent.RemoveBackground(dark))
+
+            BackgroundImageTarget.LargeContainer ->
+                onIntent(
+                    ThemeConfigIntent.RemoveContainerBackground(
+                        ContainerBackgroundTarget.LargeContainer,
+                        dark
+                    )
+                )
+
+            BackgroundImageTarget.Item ->
+                onIntent(
+                    ThemeConfigIntent.RemoveContainerBackground(
+                        ContainerBackgroundTarget.Item,
+                        dark
+                    )
+                )
+
+            null -> Unit
+        }
+    }
     BackgroundImageManageSheet(
-        isDarkTheme = (state.activeSheet as? ThemeConfigSheet.Background)?.dark,
-        currentPath = (state.activeSheet as? ThemeConfigSheet.Background)?.let {
-            if (it.dark) theme.backgroundImageDark else theme.backgroundImageLight
-        },
+        show = backgroundImageSheet != null,
         onDismissRequest = { onIntent(ThemeConfigIntent.DismissSheet) },
-        onSelectImage = { onIntent(ThemeConfigIntent.RequestBackgroundImage(it)) },
-        onRemoveImage = { onIntent(ThemeConfigIntent.RemoveBackground(it)) },
+        title = when (backgroundImageTarget) {
+            BackgroundImageTarget.App -> stringResource(R.string.background_image)
+            BackgroundImageTarget.LargeContainer -> "大容器背景图片"
+            BackgroundImageTarget.Item -> "项目背景图片"
+            null -> ""
+        },
+        lightPath = when (backgroundImageTarget) {
+            BackgroundImageTarget.App -> theme.backgroundImageLight
+            BackgroundImageTarget.LargeContainer -> theme.largeContainerBackgroundImageLight
+            BackgroundImageTarget.Item -> theme.itemBackgroundImageLight
+            null -> null
+        },
+        darkPath = when (backgroundImageTarget) {
+            BackgroundImageTarget.App -> theme.backgroundImageDark
+            BackgroundImageTarget.LargeContainer -> theme.largeContainerBackgroundImageDark
+            BackgroundImageTarget.Item -> theme.itemBackgroundImageDark
+            null -> null
+        },
+        extraOption = when (backgroundImageTarget) {
+            BackgroundImageTarget.App -> BackgroundImageExtraOption.Blur(
+                lightTitle = "日间背景图片虚化",
+                darkTitle = "夜间背景图片虚化",
+                lightValue = theme.backgroundImageBlurring,
+                darkValue = theme.backgroundImageDarkBlurring,
+                onLightChange = { value -> updateTheme { it.copy(backgroundImageBlurring = value) } },
+                onDarkChange = { value -> updateTheme { it.copy(backgroundImageDarkBlurring = value) } },
+            )
+
+            BackgroundImageTarget.LargeContainer -> BackgroundImageExtraOption.Opacity(
+                title = "大容器背景图透明度",
+                value = theme.appColumnBackgroundOpacity,
+                onValueChange = { value -> updateTheme { it.copy(appColumnBackgroundOpacity = value) } },
+            )
+
+            BackgroundImageTarget.Item -> BackgroundImageExtraOption.Opacity(
+                title = "项目背景图透明度",
+                value = theme.glassCardBackgroundOpacity,
+                onValueChange = { value -> updateTheme { it.copy(glassCardBackgroundOpacity = value) } },
+            )
+
+            null -> null
+        },
+        onSelectLight = { requestImage(false) },
+        onSelectDark = { requestImage(true) },
+        onRemoveLight = { removeImage(false) },
+        onRemoveDark = { removeImage(true) },
     )
 
     MainNavigationSettingsSheet(
@@ -1022,31 +1057,6 @@ fun ThemeConfigScreen(
 
 }
 
-@Composable
-private fun ContainerBackgroundSettingItem(
-    title: String,
-    path: String?,
-    onClick: () -> Unit,
-    onRemove: () -> Unit,
-) {
-    ClickableSettingItem(
-        title = title,
-        description = if (path.isNullOrBlank()) "选择图片" else "已选择",
-        onClick = onClick,
-        trailingContent = if (path.isNullOrBlank()) {
-            null
-        } else {
-            {
-                SmallPlainButton(
-                    onClick = onRemove,
-                    icon = Icons.Default.Delete,
-                    contentDescription = stringResource(R.string.clear),
-                )
-            }
-        },
-    )
-}
-
 @Composable
 private fun BaseCardBorderColorSettingItem(
     title: String,

+ 26 - 8
app/src/main/java/io/legado/app/ui/widget/components/SplicedColumnGroup.kt

@@ -4,8 +4,10 @@ import androidx.compose.animation.animateContentSize
 import androidx.compose.foundation.BorderStroke
 import androidx.compose.foundation.border
 import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Box
 import androidx.compose.foundation.layout.Column
 import androidx.compose.foundation.layout.ColumnScope
+import androidx.compose.foundation.layout.Spacer
 import androidx.compose.foundation.layout.fillMaxWidth
 import androidx.compose.foundation.layout.padding
 import androidx.compose.foundation.shape.RoundedCornerShape
@@ -92,26 +94,42 @@ fun SplicedColumnGroup(
                     ),
                     cornerRadius = cornerRadius,
                 ) {
-                    Column(
+                    Box(
                         modifier = Modifier
                             .fillMaxWidth()
                             .animateContentSize()
                             .clip(RoundedCornerShape(cornerRadius))
                     ) {
-                        currentIndex.intValue = 0
-                        items()
+                        Spacer(
+                            modifier = Modifier
+                                .matchParentSize()
+                                .appContainerBackground(AppContainerBackgroundType.Large)
+                        )
+                        Column(modifier = Modifier.fillMaxWidth()) {
+                            currentIndex.intValue = 0
+                            items()
+                        }
                     }
                 }
             } else {
-                Column(
+                Box(
                     modifier = Modifier
                         .fillMaxWidth()
                         .animateContentSize()
-                        .clip(RoundedCornerShape(cornerRadius)),
-                    verticalArrangement = Arrangement.spacedBy(2.dp)
+                        .clip(RoundedCornerShape(cornerRadius))
                 ) {
-                    currentIndex.intValue = 0
-                    items()
+                    Spacer(
+                        modifier = Modifier
+                            .matchParentSize()
+                            .appContainerBackground(AppContainerBackgroundType.Large)
+                    )
+                    Column(
+                        modifier = Modifier.fillMaxWidth(),
+                        verticalArrangement = Arrangement.spacedBy(2.dp)
+                    ) {
+                        currentIndex.intValue = 0
+                        items()
+                    }
                 }
             }
         }

+ 20 - 99
app/src/main/java/io/legado/app/ui/widget/components/card/GlassCard.kt

@@ -1,7 +1,6 @@
 package io.legado.app.ui.widget.components.card
 
 import androidx.compose.foundation.BorderStroke
-import androidx.compose.foundation.border
 import androidx.compose.foundation.combinedClickable
 import androidx.compose.foundation.layout.Box
 import androidx.compose.foundation.layout.Column
@@ -9,7 +8,6 @@ import androidx.compose.foundation.layout.ColumnScope
 import androidx.compose.foundation.layout.Spacer
 import androidx.compose.foundation.shape.RoundedCornerShape
 import androidx.compose.material.ExperimentalMaterialApi
-import androidx.compose.material3.CardDefaults
 import androidx.compose.material3.Surface
 import androidx.compose.runtime.Composable
 import androidx.compose.ui.Modifier
@@ -18,13 +16,10 @@ import androidx.compose.ui.graphics.Color
 import androidx.compose.ui.graphics.Shape
 import androidx.compose.ui.unit.Dp
 import androidx.compose.ui.unit.dp
-import io.legado.app.ui.theme.LocalAppUiConfiguration
 import io.legado.app.ui.theme.LegadoTheme
-import io.legado.app.ui.theme.ThemeResolver
+import io.legado.app.ui.theme.LocalAppUiConfiguration
 import io.legado.app.ui.widget.components.AppContainerBackgroundType
 import io.legado.app.ui.widget.components.appContainerBackground
-import top.yukonga.miuix.kmp.utils.PressFeedbackType
-import top.yukonga.miuix.kmp.basic.Card as MiuixCard
 import top.yukonga.miuix.kmp.basic.CardDefaults as MiuixCardDefaults
 
 @Composable
@@ -57,7 +52,6 @@ private fun BaseCard(
     onClick: (() -> Unit)? = null,
     onLongClick: (() -> Unit)? = null,
     cornerRadius: Dp = MiuixCardDefaults.CornerRadius,
-    pressFeedbackType: PressFeedbackType = PressFeedbackType.None,
     containerColor: Color? = null,
     contentColor: Color? = null,
     elevation: Dp = 0.dp,
@@ -90,99 +84,30 @@ private fun BaseCard(
         border
     }
     val resolvedShape = RoundedCornerShape(resolvedCornerRadius)
-    val decoratedModifier = modifier.then(
-        if (themeSettings.overrideBaseCardBorder && resolvedBorder != null) {
-            Modifier.border(resolvedBorder, resolvedShape)
-        } else {
-            Modifier
-        }
-    )
-
-    if (isTransparent) {
-        val clickableModifier = if (onClick != null || onLongClick != null) {
-            decoratedModifier
-                .clip(resolvedShape)
-                .combinedClickable(
-                    onClick = { onClick?.invoke() },
-                    onLongClick = onLongClick
-                )
-        } else {
-            decoratedModifier.clip(resolvedShape)
-        }
+    val clickableModifier = if (onClick != null || onLongClick != null) {
+        modifier
+            .clip(resolvedShape)
+            .combinedClickable(
+                onClick = { onClick?.invoke() },
+                onLongClick = onLongClick
+            )
+    } else {
+        modifier
+    }
+    Surface(
+        modifier = clickableModifier,
+        shape = resolvedShape,
+        color = if (isTransparent) Color.Transparent else resolvedContainerColor,
+        contentColor = contentColor ?: LegadoTheme.colorScheme.onSurface,
+        tonalElevation = 0.dp,
+        shadowElevation = elevation,
+        border = resolvedBorder
+    ) {
         BaseCardContent(
-            modifier = clickableModifier,
             shape = resolvedShape,
             useItemBackground = useItemBackground,
             content = content,
         )
-    } else if (ThemeResolver.isMiuixEngine(LegadoTheme.composeEngine)) {
-        val colors = MiuixCardDefaults.defaultColors(
-            color = resolvedContainerColor,
-            contentColor = contentColor ?: LegadoTheme.colorScheme.onSurface
-        )
-        if (onClick != null) {
-            MiuixCard(
-                modifier = decoratedModifier,
-                cornerRadius = resolvedCornerRadius,
-                pressFeedbackType = pressFeedbackType,
-                showIndication = true,
-                onClick = onClick,
-                onLongPress = onLongClick,
-                content = {
-                    BaseCardContent(
-                        shape = resolvedShape,
-                        useItemBackground = useItemBackground,
-                        content = content,
-                    )
-                },
-                colors = colors
-            )
-        } else {
-            MiuixCard(
-                modifier = decoratedModifier,
-                cornerRadius = resolvedCornerRadius,
-                content = {
-                    BaseCardContent(
-                        shape = resolvedShape,
-                        useItemBackground = useItemBackground,
-                        content = content,
-                    )
-                },
-                colors = colors
-            )
-        }
-    } else {
-        val colors = CardDefaults.cardColors(
-            containerColor = resolvedContainerColor,
-            contentColor = contentColor ?: LegadoTheme.colorScheme.onSecondaryContainer,
-            disabledContainerColor = LegadoTheme.colorScheme.onSecondaryContainer.copy(alpha = alpha * 0.38f),
-            disabledContentColor = LegadoTheme.colorScheme.onSecondaryContainer.copy(alpha = alpha * 0.38f)
-        )
-        val clickableModifier = if (onClick != null || onLongClick != null) {
-            modifier
-                .clip(resolvedShape)
-                .combinedClickable(
-                    onClick = { onClick?.invoke() },
-                    onLongClick = onLongClick
-                )
-        } else {
-            modifier
-        }
-        Surface(
-            modifier = clickableModifier,
-            shape = resolvedShape,
-            color = colors.containerColor,
-            contentColor = colors.contentColor,
-            tonalElevation = 0.dp,
-            shadowElevation = elevation,
-            border = resolvedBorder
-        ) {
-            BaseCardContent(
-                shape = resolvedShape,
-                useItemBackground = useItemBackground,
-                content = content,
-            )
-        }
     }
 }
 
@@ -193,7 +118,6 @@ fun GlassCard(
     onClick: (() -> Unit)? = null,
     onLongClick: (() -> Unit)? = null,
     cornerRadius: Dp = MiuixCardDefaults.CornerRadius,
-    pressFeedbackType: PressFeedbackType = PressFeedbackType.None,
     containerColor: Color? = null,
     contentColor: Color? = null,
     elevation: Dp = 0.dp,
@@ -205,7 +129,6 @@ fun GlassCard(
         onClick = onClick,
         onLongClick = onLongClick,
         cornerRadius = cornerRadius,
-        pressFeedbackType = pressFeedbackType,
         containerColor = containerColor,
         contentColor = contentColor,
         elevation = elevation,
@@ -223,7 +146,6 @@ fun NormalCard(
     onClick: (() -> Unit)? = null,
     onLongClick: (() -> Unit)? = null,
     cornerRadius: Dp = MiuixCardDefaults.CornerRadius,
-    pressFeedbackType: PressFeedbackType = PressFeedbackType.None,
     containerColor: Color? = null,
     contentColor: Color? = null,
     elevation: Dp = 0.dp,
@@ -235,7 +157,6 @@ fun NormalCard(
         onClick = onClick,
         onLongClick = onLongClick,
         cornerRadius = cornerRadius,
-        pressFeedbackType = pressFeedbackType,
         containerColor = containerColor,
         contentColor = contentColor,
         elevation = elevation,