From 9d2d78ae5b659b257f2d565b7e20465eaf011200 Mon Sep 17 00:00:00 2001 From: Ivan Iskandar <12537387+ivaniskandar@users.noreply.github.com> Date: Sun, 18 Dec 2022 00:56:19 +0700 Subject: [PATCH] AdaptiveSheet: Don't blindly consume back event (#8760) --- .../eu/kanade/presentation/components/AdaptiveSheet.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 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 cf44c49c2a..b349891a73 100644 --- a/app/src/main/java/eu/kanade/presentation/components/AdaptiveSheet.kt +++ b/app/src/main/java/eu/kanade/presentation/components/AdaptiveSheet.kt @@ -16,7 +16,7 @@ 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.consumedWindowInsets +import androidx.compose.foundation.layout.consumeWindowInsets import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.navigationBars import androidx.compose.foundation.layout.offset @@ -194,7 +194,7 @@ fun AdaptiveSheetImpl( shape = MaterialTheme.shapes.extraLarge, tonalElevation = tonalElevation, content = { - BackHandler(onBack = internalOnDismissRequest) + BackHandler(enabled = alpha > 0f, onBack = internalOnDismissRequest) content() }, ) @@ -264,14 +264,14 @@ fun AdaptiveSheetImpl( WindowInsets.systemBars .only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal), ) - .consumedWindowInsets( + .consumeWindowInsets( WindowInsets.systemBars .only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal), ), shape = MaterialTheme.shapes.extraLarge.copy(bottomStart = ZeroCornerSize, bottomEnd = ZeroCornerSize), tonalElevation = tonalElevation, content = { - BackHandler(onBack = internalOnDismissRequest) + BackHandler(enabled = swipeState.targetValue == 0, onBack = internalOnDismissRequest) content() }, )