HapeLee 3 месяцев назад
Родитель
Сommit
2500690561

+ 2 - 2
app/src/main/java/io/legado/app/ui/book/read/sheet/GlobalThemePage.kt

@@ -20,12 +20,12 @@ import androidx.compose.foundation.lazy.rememberLazyListState
 import androidx.compose.foundation.rememberScrollState
 import androidx.compose.foundation.verticalScroll
 import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.automirrored.filled.AlignHorizontalLeft
 import androidx.compose.material.icons.filled.Add
 import androidx.compose.material.icons.filled.Check
 import androidx.compose.material.icons.filled.DarkMode
 import androidx.compose.material.icons.filled.GridView
 import androidx.compose.material.icons.filled.LightMode
-import androidx.compose.material.icons.filled.SpaceBar
 import androidx.compose.material.icons.filled.TextFields
 import androidx.compose.material.icons.filled.Visibility
 import androidx.compose.material3.Icon
@@ -371,7 +371,7 @@ fun GlobalThemePage(
             ) {
                 Box(contentAlignment = Alignment.Center, modifier = Modifier.fillMaxSize()) {
                     Icon(
-                        imageVector = Icons.Default.SpaceBar,
+                        imageVector = Icons.AutoMirrored.Filled.AlignHorizontalLeft,
                         contentDescription = stringResource(R.string.padding),
                         tint = LegadoTheme.colorScheme.onSurfaceVariant,
                     )

+ 2 - 1
app/src/main/java/io/legado/app/ui/main/MainScreen.kt

@@ -482,7 +482,8 @@ fun MainScreen(
                                 ),
                                 m3ShowLabel = showLabel,
                                 m3AlwaysShowLabel = alwaysShowLabel,
-                                useCustomIcon = customIconPath.isNotEmpty()
+                                useCustomIcon =
+                                    customIconPath.isNotEmpty() || selectedCustomIconPath.isNotEmpty(),
                             )
                         }
                     }

+ 52 - 1
app/src/main/java/io/legado/app/ui/widget/components/navigation/AppNavigationBar.kt

@@ -3,7 +3,9 @@ package io.legado.app.ui.widget.components.navigation
 import androidx.compose.foundation.background
 import androidx.compose.foundation.clickable
 import androidx.compose.foundation.interaction.MutableInteractionSource
+import androidx.compose.foundation.layout.Arrangement
 import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Column
 import androidx.compose.foundation.layout.RowScope
 import androidx.compose.foundation.layout.fillMaxHeight
 import androidx.compose.foundation.layout.height
@@ -23,11 +25,14 @@ import androidx.compose.ui.graphics.Color
 import androidx.compose.ui.graphics.vector.ImageVector
 import androidx.compose.ui.layout.HorizontalAlignmentLine
 import androidx.compose.ui.layout.Measured
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.text.style.TextAlign
 import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.sp
 import io.legado.app.domain.model.settings.customColors
 import io.legado.app.ui.theme.LegadoTheme
-import io.legado.app.ui.theme.LocalHazeState
 import io.legado.app.ui.theme.LocalAppUiConfiguration
+import io.legado.app.ui.theme.LocalHazeState
 import io.legado.app.ui.theme.ThemeResolver
 import io.legado.app.ui.theme.regularHazeEffect
 import io.legado.app.ui.widget.components.GlassDefaults
@@ -151,6 +156,15 @@ fun RowScope.AppNavigationBarItem(
             }
             m3Icon()
         }
+    } else if (isMiuix && useCustomIcon) {
+        MiuixCustomNavigationBarItem(
+            selected = selected,
+            onClick = onClick,
+            modifier = modifier,
+            labelString = labelString,
+            showLabel = m3ShowLabel && (m3AlwaysShowLabel || selected),
+            icon = m3Icon,
+        )
     } else if (isMiuix) {
         MiuixNavigationBarItem(
             selected = selected,
@@ -174,3 +188,40 @@ fun RowScope.AppNavigationBarItem(
         )
     }
 }
+
+@Composable
+private fun RowScope.MiuixCustomNavigationBarItem(
+    selected: Boolean,
+    onClick: () -> Unit,
+    modifier: Modifier,
+    labelString: String,
+    showLabel: Boolean,
+    icon: @Composable () -> Unit,
+) {
+    val itemColor = MiuixTheme.colorScheme.onSurfaceContainer.let { color ->
+        if (selected) color else color.copy(alpha = 0.4f)
+    }
+    Column(
+        modifier = modifier
+            .height(64.dp)
+            .weight(1f)
+            .clickable(
+                interactionSource = remember { MutableInteractionSource() },
+                indication = null,
+                onClick = onClick,
+            ),
+        horizontalAlignment = Alignment.CenterHorizontally,
+        verticalArrangement = Arrangement.Center,
+    ) {
+        icon()
+        if (showLabel) {
+            AnimatedText(
+                text = labelString,
+                color = itemColor,
+                fontSize = 12.sp,
+                fontWeight = if (selected) FontWeight.Bold else FontWeight.Normal,
+                textAlign = TextAlign.Center,
+            )
+        }
+    }
+}