From 1df87eabf2b301cf6fc60cfa5f9391756984b790 Mon Sep 17 00:00:00 2001 From: AntsyLich <59261191+AntsyLich@users.noreply.github.com> Date: Sun, 5 May 2024 01:53:45 +0600 Subject: [PATCH] Use new SurfaceContainer color roles Non-dynamic themes need to be updated Co-authored-by: Ivan Iskandar <12537387+ivaniskandar@users.noreply.github.com> --- .../eu/kanade/presentation/components/AdaptiveSheet.kt | 6 ------ .../java/eu/kanade/presentation/components/TabbedDialog.kt | 1 + .../presentation/manga/components/MangaBottomActionMenu.kt | 4 ++-- .../more/settings/widget/AppThemePreferenceWidget.kt | 3 +-- .../kanade/presentation/reader/ReaderPageActionsDialog.kt | 4 +--- .../eu/kanade/presentation/track/TrackInfoDialogHome.kt | 2 +- .../ui/browse/source/browse/SourceFilterDialog.kt | 4 +--- .../presentation/core/components/AdaptiveSheet.kt | 6 ++---- .../java/tachiyomi/presentation/core/components/Pill.kt | 7 ++----- .../presentation/core/components/material/Button.kt | 2 -- 10 files changed, 11 insertions(+), 28 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/components/AdaptiveSheet.kt b/app/src/main/java/eu/kanade/presentation/components/AdaptiveSheet.kt index 2712d9a27..15d05a6ec 100644 --- a/app/src/main/java/eu/kanade/presentation/components/AdaptiveSheet.kt +++ b/app/src/main/java/eu/kanade/presentation/components/AdaptiveSheet.kt @@ -7,8 +7,6 @@ import androidx.compose.animation.fadeOut import androidx.compose.animation.togetherWith import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import androidx.compose.ui.unit.Dp -import androidx.compose.ui.unit.dp import androidx.compose.ui.window.Dialog import androidx.compose.ui.window.DialogProperties import cafe.adriel.voyager.core.annotation.InternalVoyagerApi @@ -23,7 +21,6 @@ import tachiyomi.presentation.core.components.AdaptiveSheet as AdaptiveSheetImpl @Composable fun NavigatorAdaptiveSheet( screen: Screen, - tonalElevation: Dp = 1.dp, enableSwipeDismiss: (Navigator) -> Boolean = { true }, onDismissRequest: () -> Unit, ) { @@ -31,7 +28,6 @@ fun NavigatorAdaptiveSheet( screen = screen, content = { sheetNavigator -> AdaptiveSheet( - tonalElevation = tonalElevation, enableSwipeDismiss = enableSwipeDismiss(sheetNavigator), onDismissRequest = onDismissRequest, ) { @@ -73,7 +69,6 @@ fun NavigatorAdaptiveSheet( fun AdaptiveSheet( onDismissRequest: () -> Unit, modifier: Modifier = Modifier, - tonalElevation: Dp = 1.dp, enableSwipeDismiss: Boolean = true, content: @Composable () -> Unit, ) { @@ -86,7 +81,6 @@ fun AdaptiveSheet( AdaptiveSheetImpl( modifier = modifier, isTabletUi = isTabletUi, - tonalElevation = tonalElevation, enableSwipeDismiss = enableSwipeDismiss, onDismissRequest = onDismissRequest, ) { diff --git a/app/src/main/java/eu/kanade/presentation/components/TabbedDialog.kt b/app/src/main/java/eu/kanade/presentation/components/TabbedDialog.kt index 4ef2e9771..b651060f7 100644 --- a/app/src/main/java/eu/kanade/presentation/components/TabbedDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/components/TabbedDialog.kt @@ -58,6 +58,7 @@ fun TabbedDialog( PrimaryTabRow( modifier = Modifier.weight(1f), selectedTabIndex = pagerState.currentPage, + containerColor = MaterialTheme.colorScheme.surfaceContainerHigh, divider = {}, ) { tabTitles.fastForEachIndexed { index, tab -> diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/MangaBottomActionMenu.kt b/app/src/main/java/eu/kanade/presentation/manga/components/MangaBottomActionMenu.kt index a78383590..93b8c1843 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/MangaBottomActionMenu.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/MangaBottomActionMenu.kt @@ -81,7 +81,7 @@ fun MangaBottomActionMenu( Surface( modifier = modifier, shape = MaterialTheme.shapes.large.copy(bottomEnd = ZeroCornerSize, bottomStart = ZeroCornerSize), - tonalElevation = 3.dp, + color = MaterialTheme.colorScheme.surfaceContainerHigh, ) { val haptic = LocalHapticFeedback.current val confirm = remember { mutableStateListOf(false, false, false, false, false, false, false) } @@ -237,7 +237,7 @@ fun LibraryBottomActionMenu( Surface( modifier = modifier, shape = MaterialTheme.shapes.large.copy(bottomEnd = ZeroCornerSize, bottomStart = ZeroCornerSize), - tonalElevation = 3.dp, + color = MaterialTheme.colorScheme.surfaceContainerHigh, ) { val haptic = LocalHapticFeedback.current val confirm = remember { mutableStateListOf(false, false, false, false, false) } diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/widget/AppThemePreferenceWidget.kt b/app/src/main/java/eu/kanade/presentation/more/settings/widget/AppThemePreferenceWidget.kt index db0842d08..5e3f76efe 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/widget/AppThemePreferenceWidget.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/widget/AppThemePreferenceWidget.kt @@ -223,13 +223,12 @@ fun AppThemePreviewItem( contentAlignment = Alignment.BottomCenter, ) { Surface( - tonalElevation = 3.dp, + color = MaterialTheme.colorScheme.surfaceContainer, ) { Row( modifier = Modifier .height(32.dp) .fillMaxWidth() - .background(MaterialTheme.colorScheme.surfaceVariant) .padding(horizontal = 8.dp), verticalAlignment = Alignment.CenterVertically, ) { diff --git a/app/src/main/java/eu/kanade/presentation/reader/ReaderPageActionsDialog.kt b/app/src/main/java/eu/kanade/presentation/reader/ReaderPageActionsDialog.kt index 70cc58f20..b83e8d6ad 100644 --- a/app/src/main/java/eu/kanade/presentation/reader/ReaderPageActionsDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/reader/ReaderPageActionsDialog.kt @@ -33,9 +33,7 @@ fun ReaderPageActionsDialog( ) { var showSetCoverDialog by remember { mutableStateOf(false) } - AdaptiveSheet( - onDismissRequest = onDismissRequest, - ) { + AdaptiveSheet(onDismissRequest = onDismissRequest) { Row( modifier = Modifier.padding(vertical = 16.dp), horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.small), diff --git a/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogHome.kt b/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogHome.kt index 993532180..7ed6b3cc0 100644 --- a/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogHome.kt +++ b/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogHome.kt @@ -186,7 +186,7 @@ private fun TrackInfoItem( modifier = Modifier .padding(top = 12.dp) .clip(MaterialTheme.shapes.medium) - .background(MaterialTheme.colorScheme.surface) + .background(MaterialTheme.colorScheme.surfaceContainerHighest) .padding(8.dp) .clip(RoundedCornerShape(6.dp)), ) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/SourceFilterDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/SourceFilterDialog.kt index 017af7479..42355c504 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/SourceFilterDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/SourceFilterDialog.kt @@ -40,9 +40,7 @@ fun SourceFilterDialog( ) { val updateFilters = { onUpdate(filters) } - AdaptiveSheet( - onDismissRequest = onDismissRequest, - ) { + AdaptiveSheet(onDismissRequest = onDismissRequest) { LazyColumn { stickyHeader { Row( diff --git a/presentation-core/src/main/java/tachiyomi/presentation/core/components/AdaptiveSheet.kt b/presentation-core/src/main/java/tachiyomi/presentation/core/components/AdaptiveSheet.kt index 54d2ad700..bb9ed8e85 100644 --- a/presentation-core/src/main/java/tachiyomi/presentation/core/components/AdaptiveSheet.kt +++ b/presentation-core/src/main/java/tachiyomi/presentation/core/components/AdaptiveSheet.kt @@ -38,7 +38,6 @@ import androidx.compose.ui.input.nestedscroll.NestedScrollSource import androidx.compose.ui.input.nestedscroll.nestedScroll import androidx.compose.ui.layout.onSizeChanged import androidx.compose.ui.platform.LocalDensity -import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.IntOffset import androidx.compose.ui.unit.Velocity import androidx.compose.ui.unit.dp @@ -53,7 +52,6 @@ private val sheetAnimationSpec = tween(durationMillis = 350) @Composable fun AdaptiveSheet( isTabletUi: Boolean, - tonalElevation: Dp, enableSwipeDismiss: Boolean, onDismissRequest: () -> Unit, modifier: Modifier = Modifier, @@ -97,7 +95,7 @@ fun AdaptiveSheet( .padding(vertical = 16.dp) .then(modifier), shape = MaterialTheme.shapes.extraLarge, - tonalElevation = tonalElevation, + color = MaterialTheme.colorScheme.surfaceContainerHigh, content = { BackHandler(enabled = alpha > 0f, onBack = internalOnDismissRequest) content() @@ -180,7 +178,7 @@ fun AdaptiveSheet( .navigationBarsPadding() .statusBarsPadding(), shape = MaterialTheme.shapes.extraLarge, - tonalElevation = tonalElevation, + color = MaterialTheme.colorScheme.surfaceContainerHigh, content = { BackHandler( enabled = anchoredDraggableState.targetValue == 0, diff --git a/presentation-core/src/main/java/tachiyomi/presentation/core/components/Pill.kt b/presentation-core/src/main/java/tachiyomi/presentation/core/components/Pill.kt index 4389fb482..1d8cf2d5f 100644 --- a/presentation-core/src/main/java/tachiyomi/presentation/core/components/Pill.kt +++ b/presentation-core/src/main/java/tachiyomi/presentation/core/components/Pill.kt @@ -10,7 +10,6 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color -import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.TextUnit import androidx.compose.ui.unit.dp @@ -18,9 +17,8 @@ import androidx.compose.ui.unit.dp fun Pill( text: String, modifier: Modifier = Modifier, - color: Color = MaterialTheme.colorScheme.background, - contentColor: Color = MaterialTheme.colorScheme.onBackground, - elevation: Dp = 1.dp, + color: Color = MaterialTheme.colorScheme.surfaceContainerHigh, + contentColor: Color = MaterialTheme.colorScheme.onSurface, fontSize: TextUnit = LocalTextStyle.current.fontSize, ) { Surface( @@ -29,7 +27,6 @@ fun Pill( shape = MaterialTheme.shapes.extraLarge, color = color, contentColor = contentColor, - tonalElevation = elevation, ) { Box( modifier = Modifier diff --git a/presentation-core/src/main/java/tachiyomi/presentation/core/components/material/Button.kt b/presentation-core/src/main/java/tachiyomi/presentation/core/components/material/Button.kt index 6a645ed6a..5e65c89a2 100644 --- a/presentation-core/src/main/java/tachiyomi/presentation/core/components/material/Button.kt +++ b/presentation-core/src/main/java/tachiyomi/presentation/core/components/material/Button.kt @@ -100,7 +100,6 @@ fun Button( val containerColor = colors.containerColor(enabled).value val contentColor = colors.contentColor(enabled).value val shadowElevation = elevation?.shadowElevation(enabled, interactionSource)?.value ?: 0.dp - val tonalElevation = elevation?.tonalElevation(enabled, interactionSource)?.value ?: 0.dp Surface( onClick = onClick, @@ -109,7 +108,6 @@ fun Button( shape = shape, color = containerColor, contentColor = contentColor, - tonalElevation = tonalElevation, shadowElevation = shadowElevation, border = border, interactionSource = interactionSource,