From 5a189cc796385071e10907cf1e271e4a50444b2b Mon Sep 17 00:00:00 2001 From: Ben Trengrove Date: Mon, 7 Aug 2023 11:00:32 +1000 Subject: [PATCH 1/2] Deprecate insets-ui --- .../accompanist/insets/ui/BottomNavigation.kt | 23 +++++++++++++++++++ .../google/accompanist/insets/ui/Scaffold.kt | 7 ++++++ .../google/accompanist/insets/ui/TopAppBar.kt | 23 +++++++++++++++++++ .../google/accompanist/insets/ScaffoldTest.kt | 2 ++ 4 files changed, 55 insertions(+) diff --git a/insets-ui/src/main/java/com/google/accompanist/insets/ui/BottomNavigation.kt b/insets-ui/src/main/java/com/google/accompanist/insets/ui/BottomNavigation.kt index ffdb020f6..442aa5130 100644 --- a/insets-ui/src/main/java/com/google/accompanist/insets/ui/BottomNavigation.kt +++ b/insets-ui/src/main/java/com/google/accompanist/insets/ui/BottomNavigation.kt @@ -14,6 +14,8 @@ * limitations under the License. */ +@file:Suppress("DEPRECATION") + package com.google.accompanist.insets.ui import androidx.compose.foundation.layout.Arrangement @@ -45,6 +47,13 @@ import androidx.compose.ui.unit.dp * * @sample com.google.accompanist.sample.insets.BottomNavigation_Insets */ +@Deprecated( + """ + accompanist/insets-ui has been deprecated. + This functionality has been upstreamed to Material. + For more migration information, please visit https://google.github.io/accompanist/insets/#migration + """ +) @Composable public fun BottomNavigation( modifier: Modifier = Modifier, @@ -61,6 +70,13 @@ public fun BottomNavigation( } } +@Deprecated( + """ + accompanist/insets-ui has been deprecated. + This functionality has been upstreamed to Material. + For more migration information, please visit https://google.github.io/accompanist/insets/#migration + """ +) @Composable public fun BottomNavigationSurface( modifier: Modifier = Modifier, @@ -79,6 +95,13 @@ public fun BottomNavigationSurface( } } +@Deprecated( + """ + accompanist/insets-ui has been deprecated. + This functionality has been upstreamed to Material. + For more migration information, please visit https://google.github.io/accompanist/insets/#migration + """ +) @Composable public fun BottomNavigationContent( modifier: Modifier = Modifier, diff --git a/insets-ui/src/main/java/com/google/accompanist/insets/ui/Scaffold.kt b/insets-ui/src/main/java/com/google/accompanist/insets/ui/Scaffold.kt index aeee5f8c8..8390d3128 100644 --- a/insets-ui/src/main/java/com/google/accompanist/insets/ui/Scaffold.kt +++ b/insets-ui/src/main/java/com/google/accompanist/insets/ui/Scaffold.kt @@ -104,6 +104,13 @@ public val LocalScaffoldPadding: ProvidableCompositionLocal = * you're using VerticalScroller, apply this modifier to the child of the scroller, and not on * the scroller itself. */ +@Deprecated( + """ + accompanist/insets-ui has been deprecated. + This functionality has been upstreamed to Material. + For more migration information, please visit https://google.github.io/accompanist/insets/#migration + """ +) @Composable public fun Scaffold( modifier: Modifier = Modifier, diff --git a/insets-ui/src/main/java/com/google/accompanist/insets/ui/TopAppBar.kt b/insets-ui/src/main/java/com/google/accompanist/insets/ui/TopAppBar.kt index 1822e924f..d1bce921c 100644 --- a/insets-ui/src/main/java/com/google/accompanist/insets/ui/TopAppBar.kt +++ b/insets-ui/src/main/java/com/google/accompanist/insets/ui/TopAppBar.kt @@ -14,6 +14,8 @@ * limitations under the License. */ +@file:Suppress("DEPRECATION") + package com.google.accompanist.insets.ui import androidx.compose.foundation.layout.PaddingValues @@ -40,6 +42,13 @@ import androidx.compose.ui.unit.dp * * @sample com.google.accompanist.sample.insets.TopAppBar_Insets */ +@Deprecated( + """ + accompanist/insets-ui has been deprecated. + This functionality has been upstreamed to Material. + For more migration information, please visit https://google.github.io/accompanist/insets/#migration + """ +) @Composable public fun TopAppBar( title: @Composable () -> Unit, @@ -66,6 +75,13 @@ public fun TopAppBar( } } +@Deprecated( + """ + accompanist/insets-ui has been deprecated. + This functionality has been upstreamed to Material. + For more migration information, please visit https://google.github.io/accompanist/insets/#migration + """ +) @Composable public fun TopAppBarSurface( modifier: Modifier = Modifier, @@ -83,6 +99,13 @@ public fun TopAppBarSurface( ) } +@Deprecated( + """ + accompanist/insets-ui has been deprecated. + This functionality has been upstreamed to Material. + For more migration information, please visit https://google.github.io/accompanist/insets/#migration + """ +) @Composable public fun TopAppBarContent( title: @Composable () -> Unit, diff --git a/insets-ui/src/sharedTest/kotlin/com/google/accompanist/insets/ScaffoldTest.kt b/insets-ui/src/sharedTest/kotlin/com/google/accompanist/insets/ScaffoldTest.kt index 3c5ddf0cf..b61ef61dc 100644 --- a/insets-ui/src/sharedTest/kotlin/com/google/accompanist/insets/ScaffoldTest.kt +++ b/insets-ui/src/sharedTest/kotlin/com/google/accompanist/insets/ScaffoldTest.kt @@ -14,6 +14,8 @@ * limitations under the License. */ +@file:Suppress("DEPRECATION") + package com.google.accompanist.insets import android.os.Build From 564f2ba72171737ca7f82bb16555014d98d8cfe1 Mon Sep 17 00:00:00 2001 From: Ben Trengrove Date: Mon, 7 Aug 2023 11:06:52 +1000 Subject: [PATCH 2/2] Update docs --- docs/insets.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/insets.md b/docs/insets.md index a74bc03f7..6f8a9f0b4 100644 --- a/docs/insets.md +++ b/docs/insets.md @@ -202,6 +202,9 @@ For a more complex example, see the [`EdgeToEdgeLazyColumn`](https://github.com/ ## Inset-aware layouts (`insets-ui`) +!!! warning + **This library is deprecated, with [official support](https://android-review.git.corp.google.com/c/platform/frameworks/support/+/2667875) in androidx.compose.material.** The original documentation is below. + Unfortunately, most of Compose Material's layouts do not support the use of content padding, which means that the following code probably doesn't produce the effect you want: ``` kotlin