From e3b27209246c60e2de7033976573681352fee7f9 Mon Sep 17 00:00:00 2001 From: arkon Date: Wed, 24 May 2023 18:10:17 -0400 Subject: [PATCH] Remove redundant inset handling in AdaptiveSheet The Dialog is handling it anyway, so this doesn't really do anything useful. We might need to add this back if Dialog actually handles edge-to-edge properly. --- .../presentation/components/AdaptiveSheet.kt | 15 ++------------- .../presentation/components/TabbedDialog.kt | 7 +++---- .../presentation/library/LibrarySettingsDialog.kt | 3 +-- .../presentation/manga/ChapterSettingsDialog.kt | 3 +-- .../ui/browse/source/browse/SourceFilterDialog.kt | 6 ++---- 5 files changed, 9 insertions(+), 25 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 a97b508f56..cacb0fe207 100644 --- a/app/src/main/java/eu/kanade/presentation/components/AdaptiveSheet.kt +++ b/app/src/main/java/eu/kanade/presentation/components/AdaptiveSheet.kt @@ -5,12 +5,6 @@ import androidx.compose.animation.core.tween import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeOut import androidx.compose.animation.togetherWith -import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.foundation.layout.WindowInsets -import androidx.compose.foundation.layout.WindowInsetsSides -import androidx.compose.foundation.layout.asPaddingValues -import androidx.compose.foundation.layout.only -import androidx.compose.foundation.layout.safeContent import androidx.compose.runtime.Composable import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp @@ -79,14 +73,9 @@ fun AdaptiveSheet( tonalElevation: Dp = 1.dp, enableSwipeDismiss: Boolean = true, onDismissRequest: () -> Unit, - content: @Composable (PaddingValues) -> Unit, + content: @Composable () -> Unit, ) { val isTabletUi = isTabletUi() - val contentPadding = if (isTabletUi) { - PaddingValues() - } else { - WindowInsets.safeContent.only(WindowInsetsSides.Bottom).asPaddingValues() - } Dialog( onDismissRequest = onDismissRequest, @@ -98,7 +87,7 @@ fun AdaptiveSheet( enableSwipeDismiss = enableSwipeDismiss, onDismissRequest = onDismissRequest, ) { - content(contentPadding) + content() } } } 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 2e0ff985e3..e13638ac2f 100644 --- a/app/src/main/java/eu/kanade/presentation/components/TabbedDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/components/TabbedDialog.kt @@ -4,7 +4,6 @@ import androidx.compose.animation.animateContentSize import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.ColumnScope -import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.wrapContentSize import androidx.compose.foundation.pager.rememberPagerState @@ -43,11 +42,11 @@ fun TabbedDialog( onDismissRequest: () -> Unit, tabTitles: List, tabOverflowMenuContent: (@Composable ColumnScope.(() -> Unit) -> Unit)? = null, - content: @Composable (PaddingValues, Int) -> Unit, + content: @Composable (Int) -> Unit, ) { AdaptiveSheet( onDismissRequest = onDismissRequest, - ) { contentPadding -> + ) { val scope = rememberCoroutineScope() val pagerState = rememberPagerState { tabTitles.size } @@ -87,7 +86,7 @@ fun TabbedDialog( state = pagerState, verticalAlignment = Alignment.Top, ) { page -> - content(contentPadding, page) + content(page) } } } diff --git a/app/src/main/java/eu/kanade/presentation/library/LibrarySettingsDialog.kt b/app/src/main/java/eu/kanade/presentation/library/LibrarySettingsDialog.kt index b9b59e3a61..0ed6e3400e 100644 --- a/app/src/main/java/eu/kanade/presentation/library/LibrarySettingsDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/library/LibrarySettingsDialog.kt @@ -55,10 +55,9 @@ fun LibrarySettingsDialog( stringResource(R.string.action_sort), stringResource(R.string.action_display), ), - ) { contentPadding, page -> + ) { page -> Column( modifier = Modifier - .padding(contentPadding) .padding(vertical = TabbedDialogPaddings.Vertical) .verticalScroll(rememberScrollState()), ) { diff --git a/app/src/main/java/eu/kanade/presentation/manga/ChapterSettingsDialog.kt b/app/src/main/java/eu/kanade/presentation/manga/ChapterSettingsDialog.kt index 46a26045ba..c0d5229999 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/ChapterSettingsDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/ChapterSettingsDialog.kt @@ -69,10 +69,9 @@ fun ChapterSettingsDialog( }, ) }, - ) { contentPadding, page -> + ) { page -> Column( modifier = Modifier - .padding(contentPadding) .padding(vertical = TabbedDialogPaddings.Vertical) .verticalScroll(rememberScrollState()), ) { 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 6b0e77d8c5..95b3c4af24 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 @@ -42,10 +42,8 @@ fun SourceFilterDialog( AdaptiveSheet( onDismissRequest = onDismissRequest, - ) { contentPadding -> - LazyColumn( - contentPadding = contentPadding, - ) { + ) { + LazyColumn { stickyHeader { Row( modifier = Modifier