diff --git a/docs/insets.md b/docs/insets.md deleted file mode 100644 index a06b195f6..000000000 --- a/docs/insets.md +++ /dev/null @@ -1,378 +0,0 @@ -# Insets for Jetpack Compose - -[![Maven Central](https://img.shields.io/maven-central/v/com.google.accompanist/accompanist-insets)](https://search.maven.org/search?q=g:com.google.accompanist) - -!!! warning - **This library is deprecated, with official insets support in androidx.compose.foundation.** The migration guide and original documentation is below. - -## Migration - -The official `androidx.compose.foundation` insets support is very similar to accompanist/insets, with a few changes. - -`androidx.compose.foundation` also does not disable window decor fitting, so you still need to call [`WindowCompat.setDecorFitsSystemWindows(window, false)`](https://developer.android.com/reference/androidx/core/view/WindowCompat#setDecorFitsSystemWindows(android.view.Window,%20boolean)) from your Activity. -You also still need to set the system bar backgrounds to be transparent, which can be done with our [System UI Controller](../systemuicontroller) library. - -If you are using insets for IME support, you also still need to ensure that the activity's `windowSoftInputMode` is set to `adjustResize`: - -```xml - - -``` - -## Migration steps: - -1. Remove `ProvideWindowInsets` (there is no equivalent in `androidx.compose.foundation`) -1. Remove `ViewWindowInsetObserver` (there is no equivalent in `androidx.compose.foundation`) -1. Replace padding modifiers with `androidx.compose.foundation` equivalents. If using `additionalPadding` or only applying the insets to certain sides, use the corresponding [`WindowInsets.add`](https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/package-summary#(androidx.compose.foundation.layout.WindowInsets).add(androidx.compose.foundation.layout.WindowInsets)) and [`WindowInsets.only`](https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/package-summary#(androidx.compose.foundation.layout.WindowInsets).only(androidx.compose.foundation.layout.WindowInsetsSides)) extensions. -1. Replace `rememberInsetsPaddingValues` with the equivalent `WindowInsets.asPaddingValues`. -1. Replace direct calculations from `LocalWindowInsets.current` with calculations on `WindowInsets`. -1. Migrate from using `insets-ui` components to the [built-in support](https://developer.android.com/develop/ui/compose/layouts/insets#material3-components) in Material components. - -For reference, consult the [Migration table](#migration-table) below. - -## Inset consumption - -The biggest behavioral change between `accompanist/insets` and `androidx.compose.foundation` is in the consumption behavior of padding modifiers. - -In `accompanist/insets`, the padding modifiers always padded the full size of the specified inset types, which led to some unintuitive duplicate padding when nesting modifiers. - -For example, let’s look at what happens when we have nested boxes, where the outer one has Modifier.systemBarsPadding() applied, and the inner has Modifier.imePadding(): - -```kotlin -Box(Modifier.systemBarsPadding()) { - Box(Modifier.imePadding()) { - // content - } -} -``` - -Let’s assume that the bottom system bar padding is `30dp`, to account for the navigation bar padding, and let’s assume that when the IME is visible, the height of the IME is `150dp`. - -When the IME is closed, the outer box will apply the bottom `30dp` as padding, and the inner box will apply zero additional padding, since the IME isn’t visible. - -When the IME opens, the outer box will continue to apply the bottom `30dp` as the system bar padding, and the inner box will now apply `150dp` bottom padding, since that is the full height of the IME. - -This results in a total padding of `180dp` applied to the content, which double pads the bottom navigation bar padding. -The solutions to this issue were using `derivedWindowInsetsTypeOf`, built-in derived types like `Modifier.navigationBarsWithImePadding()`, or performing calculations manually to apply the remaining padding. - -In `androidx.compose.foundation`, when the IME is open, the outer box still apply the bottom `30dp`, but the inner box will only apply the remaining `120dp` needed to have the content be padded a total of `150dp` to match the height of the IME. - -This behavior can be influenced further in `androidx.compose.foundation` with [`Modifier.consumedWindowInsets()`](https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier#(androidx.compose.ui.Modifier).consumedWindowInsets(androidx.compose.foundation.layout.WindowInsets)) - -As a result, the equivalent of `Modifier.navigationBarsWithImePadding()` is simply `Modifier.navigationBarsPadding().imePadding()`. - -## Migration table: - -| accompanist/insets | androidx.compose.foundation | -|-----------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `ProvideWindowInsets` | (remove) | -| `Modifier.systemBarsPadding()` | [`Modifier.systemBarsPadding()`](https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier#(androidx.compose.ui.Modifier).systemBarsPadding()) | -| `Modifier.systemBarsPadding(bottom = false)` | [`Modifier.windowInsetsPadding(WindowInsets.systemBars.only(WindowInsetsSides.Horizontal + WindowInsetsSides.Top))`](https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/package-summary#(androidx.compose.ui.Modifier).windowInsetsPadding(androidx.compose.foundation.layout.WindowInsets)) | -| `Modifier.statusBarsPadding()` | [`Modifier.statusBarsPadding()`](https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier#(androidx.compose.ui.Modifier).statusBarsPadding()) | -| `Modifier.navigationBarsPadding()` | [`Modifier.navigationBarsPadding()`](https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier#(androidx.compose.ui.Modifier).navigationBarsPadding()) | -| `Modifier.imePadding()` | [`Modifier.imePadding()`](https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier#(androidx.compose.ui.Modifier).imePadding()) | -| `Modifier.cutoutPadding()` | [`Modifier.displayCutoutPadding()`](https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier#(androidx.compose.ui.Modifier).displayCutoutPadding()) | -| `Modifier.navigationBarsWithImePadding()` | [`Modifier.navigationBarsPadding().imePadding()`](https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier#(androidx.compose.ui.Modifier).imePadding()) | -| `Modifier.statusBarsHeight()` | [`Modifier.windowInsetsTopHeight(WindowInsets.statusBars)`](https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier#(androidx.compose.ui.Modifier).windowInsetsTopHeight(androidx.compose.foundation.layout.WindowInsets)) | -| `Modifier.navigationBarsHeight()` | [`Modifier.windowInsetsBottomHeight(WindowInsets.navigationBars)`](https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier#(androidx.compose.ui.Modifier).windowInsetsBottomHeight(androidx.compose.foundation.layout.WindowInsets)) | -| `Modifier.navigationBarsWidth()` | [`Modifier.windowInsetsStartWidth(WindowInsets.navigationBars)`](https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier#(androidx.compose.ui.Modifier).windowInsetsStartWidth(androidx.compose.foundation.layout.WindowInsets)) / [`Modifier.windowInsetsEndWidth(WindowInsets.navigationBars)`](https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier#(androidx.compose.ui.Modifier).windowInsetsEndWidth(androidx.compose.foundation.layout.WindowInsets)) | -| `rememberInsetsPaddingValues(insets = LocalWindowInsets.current.statusBars, applyStart = true, applyTop = true, applyEnd = true)` | [`WindowInsets.statusBars.only(WindowInsetsSides.Horizontal + WindowInsetsSides.Top).asPaddingValues()`](https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/package-summary#(androidx.compose.foundation.layout.WindowInsets).asPaddingValues()) | -| `derivedWindowInsetsTypeOf` | [`WindowInsets.union(windowInsets: WindowInsets)`](https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/package-summary#(androidx.compose.foundation.layout.WindowInsets).union(androidx.compose.foundation.layout.WindowInsets)) | -| `LocalWindowInsets.current.navigationBars` | [`WindowInsets.navigationBars`](https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/package-summary#(androidx.compose.foundation.layout.WindowInsets.Companion).navigationBars()) | -| `LocalWindowInsets.current.statusBars` | [`WindowInsets.statusBars`](https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/package-summary#(androidx.compose.foundation.layout.WindowInsets.Companion).statusBars()) | -| `LocalWindowInsets.current.ime` | [`WindowInsets.ime`](https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/package-summary#(androidx.compose.foundation.layout.WindowInsets.Companion).ime()) | -| `LocalWindowInsets.current.systemGestures` | [`WindowInsets.systemGestures`](https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/package-summary#(androidx.compose.foundation.layout.WindowInsets.Companion).systemGestures()) | -| `LocalWindowInsets.current.systemBars` | [`WindowInsets.systemBars`](https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/package-summary#(androidx.compose.foundation.layout.WindowInsets.Companion).systemBars()) | -| `LocalWindowInsets.current.displayCutout` | [`WindowInsets.displayCutout`](https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/package-summary#(androidx.compose.foundation.layout.WindowInsets.Companion).displayCutout()) | -| `LocalWindowInsets.current.ime.bottom` | [`WindowInsets.ime.getBottom(LocalDensity.current)`](https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/WindowInsets#getBottom(androidx.compose.ui.unit.Density)) | -| `WindowInsets.Type.isVisible` | [`WindowInsets.isImeVisible`](https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/package-summary#(androidx.compose.foundation.layout.WindowInsets.Companion).isImeVisible()), etc. | -| `WindowInsets.Type.animationInProgress` | [Bug: 217770337](https://issuetracker.google.com/issues/217770337) | -| `WindowInsets.Type.animationFraction` | [Bug: 217770337](https://issuetracker.google.com/issues/217770337) | -| `WindowInsets.Type.layoutInsets` | [Bug: 217770337](https://issuetracker.google.com/issues/217770337) | -| `WindowInsets.Type.animatedInsets` | [Bug: 217770337](https://issuetracker.google.com/issues/217770337) | -| `rememberImeNestedScrollConnection()` | [`Modifier.imeNestedScroll()`](https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier#(androidx.compose.ui.Modifier).imeNestedScroll()) | - -## Original docs - -Insets for Jetpack Compose takes a lot of the ideas which drove [Insetter][insetter-view] for views, and applies them for use in composables. - -## Usage -To setup Insets in your composables, you need to call the `ProvideWindowInsets` function and -wrap your content. This would typically be done near the top level of your composable hierarchy: - -``` kotlin -setContent { - MaterialTheme { - ProvideWindowInsets { - // your content - } - } -} -``` - -!!! note - **This library does not disable window decor fitting.** For your view hierarchy to able to receive insets, you need to make sure to call: [`WindowCompat.setDecorFitsSystemWindows(window, false)`](https://developer.android.com/reference/androidx/core/view/WindowCompat#setDecorFitsSystemWindows(android.view.Window,%20boolean)) from your Activity. You also need to set the system bar backgrounds to be transparent, which can be done with our [System UI Controller](../systemuicontroller) library. - -`ProvideWindowInsets` allows the library to set an [`OnApplyWindowInsetsListener`][insetslistener] on your content's host view. That listener is used to update the value of a composition local bundled in this library: `LocalWindowInsets`. - -`LocalWindowInsets` holds an instance of `WindowInsets` which contains the value of various [WindowInsets][insets] [types][insettypes]. You can use the values manually like so: - -``` kotlin -@Composable -fun ImeAvoidingBox() { - val insets = LocalWindowInsets.current - - val imeBottom = with(LocalDensity.current) { insets.ime.bottom.toDp() } - Box(Modifier.padding(bottom = imeBottom)) -} -``` - -...but we also provide some easy-to-use [Modifier][modifier]s. - -### Modifiers - -We provide two types of modifiers for easy handling of insets: padding and size. - -#### Padding modifiers -The padding modifiers allow you to apply padding to a composable which matches a specific type of inset. Currently we provide: - -- [`Modifier.statusBarsPadding()`](../api/insets/com.google.accompanist.insets/status-bars-padding.html) -- [`Modifier.navigationBarsPadding()`](../api/insets/com.google.accompanist.insets/navigation-bars-padding.html) -- [`Modifier.systemBarsPadding()`](../api/insets/com.google.accompanist.insets/system-bars-padding.html) -- [`Modifier.imePadding()`](../api/insets/com.google.accompanist.insets/ime-padding.html) -- [`Modifier.navigationBarsWithImePadding()`](../api/insets/com.google.accompanist.insets/navigation-bars-with-ime-padding.html) -- [`Modifier.cutoutPadding()`](../api/insets/com.google.accompanist.insets/cutout-padding.html) - -These are commonly used to move composables out from under the system bars. The common example would be a [`FloatingActionButton`][fab]: - -``` kotlin -FloatingActionButton( - onClick = { /* TODO */ }, - modifier = Modifier - .align(Alignment.BottomEnd) - .padding(16.dp) // normal 16dp of padding for FABs - .navigationBarsPadding() // Move it out from under the nav bar -) { - Icon(imageVector = Icons.Default.Add, contentDescription = null) -} -``` - -#### Size modifiers -The size modifiers allow you to match the size of a composable to a specific type of inset. Currently we provide: - -- [`Modifier.statusBarsHeight()`](../api/insets/com.google.accompanist.insets/status-bars-height.html) -- [`Modifier.navigationBarsHeight()`](../api/insets/com.google.accompanist.insets/navigation-bars-height.html) -- [`Modifier.navigationBarsWidth()`](../api/insets/com.google.accompanist.insets/navigation-bars-width.html) - -These are commonly used to allow composables behind the system bars, to provide background protection, or similar: - -``` kotlin -Spacer( - Modifier - .background(Color.Black.copy(alpha = 0.7f)) - .statusBarsHeight() // Match the height of the status bar - .fillMaxWidth() -) -``` - -### PaddingValues -Compose also provides the concept of [`PaddingValues`][paddingvalues], a data class which contains the padding values to be applied on all dimensions (similar to a rect). This is commonly used with container composables, such as [`LazyColumn`][lazycolumn], to set the content padding. - -You may want to use inset values for content padding, so this library provides the [`rememberInsetsPaddingValues()`](..//api/insets/com.google.accompanist.insets/remember-insets-padding-values.html) extension function to convert between `Insets` and [`PaddingValues`][paddingvalues]. Here's an example of using the system bars insets: - -``` kotlin -LazyColumn( - contentPadding = rememberInsetsPaddingValues( - insets = LocalWindowInsets.current.systemBars, - applyTop = true, - applyBottom = true, - ) -) { - // content -} -``` - -For a more complex example, see the [`EdgeToEdgeLazyColumn`](https://github.com/google/accompanist/blob/main/sample/src/main/java/com/google/accompanist/sample/insets/EdgeToEdgeLazyColumn.kt) example: - - - - - -## Inset-aware layouts (`insets-ui`) - -!!! warning - **This library is deprecated, with [official support](https://android-review.googlesource.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 -// 😥 This likely doesn't do what you want -TopAppBar( - // content - modifier = Modifier.statusBarsPadding() -) -``` - -To workaround this, we provide the `insets-ui` companion library which contains versions of commonly used layouts, with the addition of a `contentPadding` parameter. The example below is using our [`TopAppBar`](../api/insets-ui/com.google.accompanist.insets.ui/-top-app-bar.html) layout, providing the status bar insets to use as content padding: - -``` kotlin -import com.google.accompanist.insets.ui.TopAppBar - -TopAppBar( - contentPadding = rememberInsetsPaddingValues( - insets = LocalWindowInsets.current.statusBars, - applyStart = true, - applyTop = true, - applyEnd = true, - ) -) { - // content -} -``` - -The library also provides a modified copy of Compose Material's [`Scaffold`](https://developer.android.com/reference/kotlin/androidx/compose/material/package-summary#Scaffold(androidx.compose.ui.Modifier,androidx.compose.material.ScaffoldState,kotlin.Function0,kotlin.Function0,kotlin.Function1,kotlin.Function0,androidx.compose.material.FabPosition,kotlin.Boolean,kotlin.Function1,kotlin.Boolean,androidx.compose.ui.graphics.Shape,androidx.compose.ui.unit.Dp,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,kotlin.Function1)) which better supports edge-to-edge layouts, by drawing the top and bottom bars over the content. - -``` kotlin -Scaffold( - topBar = { - // We use TopAppBar from accompanist-insets-ui which allows us to provide - // content padding matching the system bars insets. - TopAppBar( - title = { Text(stringResource(R.string.insets_title_list)) }, - backgroundColor = MaterialTheme.colors.surface.copy(alpha = 0.9f), - contentPadding = rememberInsetsPaddingValues( - LocalWindowInsets.current.statusBars, - applyBottom = false, - ), - ) - }, - bottomBar = { - // We add a spacer as a bottom bar, which is the same height as - // the navigation bar - Spacer(Modifier.navigationBarsHeight().fillMaxWidth()) - }, -) { contentPadding -> - // We apply the contentPadding passed to us from the Scaffold - Box(Modifier.padding(contentPadding)) { - // content - } -} -``` - -See the [API docs](../api/insets-ui/com.google.accompanist.insets.ui/) for a list of the other layouts provided in the library. - -### Animated Insets support - -=== "Info" - - ![](images/ime-insets.gif){: align=right loading=lazy } - - The library now has experimental support for [`WindowInsetsAnimations`](https://developer.android.com/reference/android/view/WindowInsetsAnimation), allowing your content is react to inset animations, such as the on screen-keyboard (IME) being animated on/off screen. The `imePadding()` and `navigationBarsWithImePadding()` modifiers are available especially for this use-case. - - This functionality works wherever [WindowInsetsAnimationCompat](https://developer.android.com/reference/androidx/core/view/WindowInsetsAnimationCompat) works, which at the time or writing is on devices running API 21+. - - To enable animated insets support, you need need to new `ProvideWindowInsets` overload, and set `windowInsetsAnimationsEnabled = true`. - -=== "Usage" - - ``` kotlin - ProvideWindowInsets(windowInsetsAnimationsEnabled = true) { - // content - } - ``` - - You can then use the new `navigationBarsWithImePadding()` modifier like so: - - ``` kotlin - OutlinedTextField( - // other params, - modifier = Modifier.navigationBarsWithImePadding() - ) - ``` - - See the [ImeAnimationSample](https://github.com/google/accompanist/blob/main/sample/src/main/java/com/google/accompanist/sample/insets/ImeAnimationSample.kt) for a working example. - -### IME animations -If you're using the animation insets support for IME/keyboard animations, you also need to ensure that the activity's `windowSoftInputMode` is set to `adjustResize`: - -``` xml - - -``` - -The default value of `windowSoftInputMode` _should_ work, but Compose does not currently set the flags necessary (see [here](https://issuetracker.google.com/154101484)). - -## 🚧 Experimental - -The features below are experimental, and require developers to [opt-in](https://kotlinlang.org/docs/reference/opt-in-requirements.html). - -### Controlling the IME (on-screen keyboard) - -=== "Info" - - ![](images/ime-scroll.gif){: loading=lazy align=right } - - This library also has support for controlling the IME from scroll gestures, allowing your scrollable components to pull/push the IME on/off screen. This is achieved through the built-in [`NestedScrollConnection`](https://developer.android.com/reference/kotlin/androidx/compose/ui/gesture/nestedscroll/NestedScrollConnection) implementation returned by [`rememberImeNestedScrollConnection()`](../api/insets/com.google.accompanist.insets/remember-ime-nested-scroll-connection.html). - - This functionality only works when running on devices with API 30+. - -=== "Usage" - - ``` kotlin - // Here we're using a scrollable Column, but it also works with LazyColumn, etc. - Column( - // We use the nestedScroll modifier, passing in the - // the connection from rememberImeNestedScrollConnection() - modifier = Modifier - .nestedScroll(connection = rememberImeNestedScrollConnection()) - .verticalScroll(state = rememberScrollState()) - ) { - // list content - } - ``` - - See the [ImeAnimationSample](https://github.com/google/accompanist/blob/main/sample/src/main/java/com/google/accompanist/sample/insets/ImeAnimationSample.kt) for a working example. - - -## Download - -[![Maven Central](https://img.shields.io/maven-central/v/com.google.accompanist/accompanist-insets)](https://search.maven.org/search?q=g:com.google.accompanist) - -```groovy -repositories { - mavenCentral() -} - -dependencies { - implementation "com.google.accompanist:accompanist-insets:" - // If using insets-ui - implementation "com.google.accompanist:accompanist-insets-ui:" -} -``` - -Snapshots of the development version are available in [Sonatype's `snapshots` repository][snap]. These are updated on every commit. - -## Something not working? - -If you find that something isn't working correctly, here's a checklist to try: - -- Check that you've called [`WindowCompat.setDecorFitsSystemWindows(window, false)`](https://developer.android.com/reference/androidx/core/view/WindowCompat#setDecorFitsSystemWindows(android.view.Window,%20boolean)) in your Activity. Unless you do that, the window decor will consume the insets, and they will not be dispatched to your content. -- If it's something related to the keyboard, check that the Activity's `windowSoftInputMode` is set to [`adjustResize`](https://developer.android.com/reference/android/view/WindowManager.LayoutParams#SOFT_INPUT_ADJUST_RESIZE). Without that, IME visibility changes will not be sent as inset changes. -- Similarly, if you're setting [`android:windowFullscreen`](https://developer.android.com/reference/android/view/WindowManager.LayoutParams#FLAG_FULLSCREEN) to `true` (or using a `.Fullscreen` theme), be aware that `adjustResize` will not work. Please see the [documentation](https://developer.android.com/reference/android/view/WindowManager.LayoutParams#FLAG_FULLSCREEN) for an alternative. -- If you're using `ProvideWindowInsets` (or `ViewWindowInsetObserver`) in multiple layers of your view hierarchy (i.e. in the activity, _and_ in a fragment), you need to turn off consuming of insets. By default `ProvideWindowInsets` and `ViewWindowInsetObserver` will completely consume any insets passed to it. In the previous example, this means that the activity content will get the insets, but the fragment won't. To disable consuming, pass `consumeWindowInsets = false` to `ProvideWindowInsets` or `ViewWindowInsetObserver.start()`. - -[compose]: https://developer.android.com/jetpack/compose -[snap]: https://oss.sonatype.org/content/repositories/snapshots/com/google/accompanist/accompanist-insets/ -[insetter-view]: https://github.com/chrisbanes/insetter -[insets]: https://developer.android.com/reference/kotlin/androidx/core/view/WindowInsetsCompat -[insettypes]: https://developer.android.com/reference/kotlin/androidx/core/view/WindowInsetsCompat.Type -[insetslistener]: https://developer.android.com/reference/kotlin/androidx/core/view/OnApplyWindowInsetsListener -[modifier]: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier -[paddingvalues]: https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/PaddingValues -[lazycolumn]: https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/package-summary#lazycolumn -[fab]: https://developer.android.com/reference/kotlin/androidx/compose/material/package-summary#floatingactionbutton -[api-type]: ../api/insets/com.google.accompanist.insets/-window-insets/-type/ diff --git a/insets-ui/README.md b/insets-ui/README.md deleted file mode 100644 index cbfe2250e..000000000 --- a/insets-ui/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# Insets: UI for Jetpack Compose - -[![Maven Central](https://img.shields.io/maven-central/v/com.google.accompanist/accompanist-insets-ui)](https://search.maven.org/search?q=g:com.google.accompanist) - -For more information, visit the documentation: https://google.github.io/accompanist/insets - -## Download - -```groovy -repositories { - mavenCentral() -} - -dependencies { - implementation "com.google.accompanist:accompanist-insets-ui:" -} -``` - -Snapshots of the development version are available in [Sonatype's `snapshots` repository][snap]. These are updated on every commit. - - - [snap]: https://oss.sonatype.org/content/repositories/snapshots/com/google/accompanist/accompanist-insets-ui/ \ No newline at end of file diff --git a/insets-ui/api/current.api b/insets-ui/api/current.api deleted file mode 100644 index 0bdcf162b..000000000 --- a/insets-ui/api/current.api +++ /dev/null @@ -1,23 +0,0 @@ -// Signature format: 4.0 -package com.google.accompanist.insets.ui { - - public final class BottomNavigationKt { - method @Deprecated @androidx.compose.runtime.Composable public static void BottomNavigation(optional androidx.compose.ui.Modifier modifier, optional androidx.compose.foundation.layout.PaddingValues contentPadding, optional long backgroundColor, optional long contentColor, optional float elevation, kotlin.jvm.functions.Function1 content); - method @Deprecated @androidx.compose.runtime.Composable public static void BottomNavigationContent(optional androidx.compose.ui.Modifier modifier, kotlin.jvm.functions.Function1 content); - method @Deprecated @androidx.compose.runtime.Composable public static void BottomNavigationSurface(optional androidx.compose.ui.Modifier modifier, optional long backgroundColor, optional long contentColor, optional float elevation, kotlin.jvm.functions.Function0 content); - } - - public final class ScaffoldKt { - method @Deprecated @androidx.compose.runtime.Composable public static void Scaffold(optional androidx.compose.ui.Modifier modifier, optional androidx.compose.material.ScaffoldState scaffoldState, optional kotlin.jvm.functions.Function0 topBar, optional kotlin.jvm.functions.Function0 bottomBar, optional kotlin.jvm.functions.Function1 snackbarHost, optional kotlin.jvm.functions.Function0 floatingActionButton, optional int floatingActionButtonPosition, optional boolean isFloatingActionButtonDocked, optional kotlin.jvm.functions.Function1? drawerContent, optional boolean drawerGesturesEnabled, optional androidx.compose.ui.graphics.Shape drawerShape, optional float drawerElevation, optional long drawerBackgroundColor, optional long drawerContentColor, optional long drawerScrimColor, optional long backgroundColor, optional long contentColor, optional androidx.compose.foundation.layout.PaddingValues contentPadding, kotlin.jvm.functions.Function1 content); - method public static androidx.compose.runtime.ProvidableCompositionLocal getLocalScaffoldPadding(); - property public static final androidx.compose.runtime.ProvidableCompositionLocal LocalScaffoldPadding; - } - - public final class TopAppBarKt { - method @Deprecated @androidx.compose.runtime.Composable public static void TopAppBar(kotlin.jvm.functions.Function0 title, optional androidx.compose.ui.Modifier modifier, optional androidx.compose.foundation.layout.PaddingValues contentPadding, optional kotlin.jvm.functions.Function0? navigationIcon, optional kotlin.jvm.functions.Function1 actions, optional long backgroundColor, optional long contentColor, optional float elevation); - method @Deprecated @androidx.compose.runtime.Composable public static void TopAppBarContent(kotlin.jvm.functions.Function0 title, optional androidx.compose.ui.Modifier modifier, optional kotlin.jvm.functions.Function0? navigationIcon, optional kotlin.jvm.functions.Function1 actions); - method @Deprecated @androidx.compose.runtime.Composable public static void TopAppBarSurface(optional androidx.compose.ui.Modifier modifier, optional long backgroundColor, optional long contentColor, optional float elevation, kotlin.jvm.functions.Function0 content); - } - -} - diff --git a/insets-ui/build.gradle.kts b/insets-ui/build.gradle.kts deleted file mode 100644 index 5f451e522..000000000 --- a/insets-ui/build.gradle.kts +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright 2023 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -@file:Suppress("UnstableApiUsage") - -plugins { - id(libs.plugins.android.library.get().pluginId) - id(libs.plugins.android.kotlin.get().pluginId) - id(libs.plugins.jetbrains.dokka.get().pluginId) - id(libs.plugins.gradle.metalava.get().pluginId) - id(libs.plugins.vanniktech.maven.publish.get().pluginId) -} - -kotlin { - explicitApi() -} - -android { - namespace = "com.google.accompanist.insets.ui" - - compileSdk = 34 - - defaultConfig { - minSdk = 21 - // targetSdkVersion has no effect for libraries. This is only used for the test APK - targetSdk = 33 - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" - } - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - - buildFeatures { - buildConfig = false - compose = true - } - - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() - } - - lint { - textReport = true - textOutput = File("stdout") - // We run a full lint analysis as build part in CI, so skip vital checks for assemble tasks - checkReleaseBuilds = false - disable += setOf("GradleOverrides") - } - - packaging { - // Some of the META-INF files conflict with coroutines-test. Exclude them to enable - // our test APK to build (has no effect on our AARs) - resources { - excludes += listOf("/META-INF/AL2.0", "/META-INF/LGPL2.1") - } - } - - testOptions { - unitTests { - isIncludeAndroidResources = true - } - unitTests.all { - it.useJUnit { - excludeCategories("com.google.accompanist.internal.test.IgnoreOnRobolectric") - } - } - animationsDisabled = true - } - - sourceSets { - named("test") { - java.srcDirs("src/sharedTest/kotlin") - res.srcDirs("src/sharedTest/res") - } - named("androidTest") { - java.srcDirs("src/sharedTest/kotlin") - res.srcDirs("src/sharedTest/res") - } - } -} - -metalava { - sourcePaths.setFrom("src/main") - filename.set("api/current.api") - reportLintsAsErrors.set(true) -} - -dependencies { - api(libs.compose.material.material) - - implementation(libs.kotlin.coroutines.android) - - // ====================== - // Test dependencies - // ====================== - - androidTestImplementation(project(":internal-testutils")) - testImplementation(project(":internal-testutils")) - - androidTestImplementation(libs.junit) - testImplementation(libs.junit) - - androidTestImplementation(libs.truth) - testImplementation(libs.truth) - - androidTestImplementation(libs.compose.ui.test.junit4) - testImplementation(libs.compose.ui.test.junit4) - - androidTestImplementation(libs.compose.ui.test.manifest) - testImplementation(libs.compose.ui.test.manifest) - - androidTestImplementation(libs.androidx.test.runner) - testImplementation(libs.androidx.test.runner) - - testImplementation(libs.robolectric) -} diff --git a/insets-ui/gradle.properties b/insets-ui/gradle.properties deleted file mode 100644 index 577eeb392..000000000 --- a/insets-ui/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -POM_ARTIFACT_ID=accompanist-insets-ui -POM_NAME=Accompanist Insets UI library -POM_PACKAGING=aar \ No newline at end of file diff --git a/insets-ui/src/androidTest/AndroidManifest.xml b/insets-ui/src/androidTest/AndroidManifest.xml deleted file mode 100644 index 4cb25cde2..000000000 --- a/insets-ui/src/androidTest/AndroidManifest.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - diff --git a/insets-ui/src/main/AndroidManifest.xml b/insets-ui/src/main/AndroidManifest.xml deleted file mode 100644 index 7de13f329..000000000 --- a/insets-ui/src/main/AndroidManifest.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - 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 deleted file mode 100644 index 442aa5130..000000000 --- a/insets-ui/src/main/java/com/google/accompanist/insets/ui/BottomNavigation.kt +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -@file:Suppress("DEPRECATION") - -package com.google.accompanist.insets.ui - -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.RowScope -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.selection.selectableGroup -import androidx.compose.material.BottomNavigation -import androidx.compose.material.BottomNavigationDefaults -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Surface -import androidx.compose.material.contentColorFor -import androidx.compose.material.primarySurface -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.unit.Dp -import androidx.compose.ui.unit.dp - -/** - * A wrapper around [BottomNavigation] which supports the setting of [contentPadding] to add - * internal padding. This is especially useful in conjunction with insets. - * - * For an edge-to-edge layout, typically you would use the - * [com.google.accompanist.insets.WindowInsets.navigationBars] insets like so below: - * - * @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, - contentPadding: PaddingValues = PaddingValues(0.dp), - backgroundColor: Color = MaterialTheme.colors.primarySurface, - contentColor: Color = contentColorFor(backgroundColor), - elevation: Dp = BottomNavigationDefaults.Elevation, - content: @Composable RowScope.() -> Unit, -) { - BottomNavigationSurface(modifier, backgroundColor, contentColor, elevation) { - BottomNavigationContent(Modifier.padding(contentPadding)) { - content() - } - } -} - -@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, - backgroundColor: Color = MaterialTheme.colors.primarySurface, - contentColor: Color = contentColorFor(backgroundColor), - elevation: Dp = BottomNavigationDefaults.Elevation, - content: @Composable () -> Unit -) { - Surface( - color = backgroundColor, - contentColor = contentColor, - elevation = elevation, - modifier = modifier, - ) { - content() - } -} - -@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, - content: @Composable RowScope.() -> Unit, -) { - Row( - modifier = modifier - .fillMaxWidth() - .height(BottomNavigationHeight) - .selectableGroup(), - horizontalArrangement = Arrangement.SpaceBetween, - content = content, - ) -} - -/** - * Copied from [androidx.compose.material.BottomNavigationHeight] - * Height of a [BottomNavigation] component - */ -private val BottomNavigationHeight = 56.dp 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 deleted file mode 100644 index 8390d3128..000000000 --- a/insets-ui/src/main/java/com/google/accompanist/insets/ui/Scaffold.kt +++ /dev/null @@ -1,361 +0,0 @@ -/* - * Copyright 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.accompanist.insets.ui - -import androidx.compose.foundation.layout.ColumnScope -import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.foundation.layout.calculateEndPadding -import androidx.compose.foundation.layout.calculateStartPadding -import androidx.compose.material.BottomAppBar -import androidx.compose.material.DrawerDefaults -import androidx.compose.material.FabPosition -import androidx.compose.material.FloatingActionButton -import androidx.compose.material.MaterialTheme -import androidx.compose.material.ModalDrawer -import androidx.compose.material.Scaffold -import androidx.compose.material.ScaffoldState -import androidx.compose.material.Snackbar -import androidx.compose.material.SnackbarHost -import androidx.compose.material.SnackbarHostState -import androidx.compose.material.Surface -import androidx.compose.material.TopAppBar -import androidx.compose.material.contentColorFor -import androidx.compose.material.rememberScaffoldState -import androidx.compose.runtime.Composable -import androidx.compose.runtime.CompositionLocalProvider -import androidx.compose.runtime.Immutable -import androidx.compose.runtime.ProvidableCompositionLocal -import androidx.compose.runtime.Stable -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember -import androidx.compose.runtime.setValue -import androidx.compose.runtime.staticCompositionLocalOf -import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.Shape -import androidx.compose.ui.layout.SubcomposeLayout -import androidx.compose.ui.unit.Dp -import androidx.compose.ui.unit.LayoutDirection -import androidx.compose.ui.unit.dp - -/** - * Provides the current [Scaffold] content padding values. - */ -public val LocalScaffoldPadding: ProvidableCompositionLocal = - staticCompositionLocalOf { PaddingValues(0.dp) } - -/** - * A copy of [androidx.compose.material.Scaffold] which lays out [content] behind both the top bar - * content, and the bottom bar content. See [androidx.compose.material.Scaffold] for more - * information about the features provided. - * - * A sample which demonstrates how to use this layout to achieve a edge-to-edge layout is - * below: - * - * @sample com.google.accompanist.sample.insets.InsetsBasics - * - * @param modifier optional Modifier for the root of the [Scaffold] - * @param scaffoldState state of this scaffold widget. It contains the state of the screen, e.g. - * variables to provide manual control over the drawer behavior, sizes of components, etc - * @param topBar top app bar of the screen. Consider using [TopAppBar]. - * @param bottomBar bottom bar of the screen. Consider using [BottomAppBar]. - * @param snackbarHost component to host [Snackbar]s that are pushed to be shown via - * [SnackbarHostState.showSnackbar]. Usually it's a [SnackbarHost] - * @param floatingActionButton Main action button of your screen. Consider using - * [FloatingActionButton] for this slot. - * @param floatingActionButtonPosition position of the FAB on the screen. See [FabPosition] for - * possible options available. - * @param isFloatingActionButtonDocked whether [floatingActionButton] should overlap with - * [bottomBar] for half a height, if [bottomBar] exists. Ignored if there's no [bottomBar] or no - * [floatingActionButton]. - * @param drawerContent content of the Drawer sheet that can be pulled from the left side (right - * for RTL). - * @param drawerGesturesEnabled whether or not drawer (if set) can be interacted with via gestures - * @param drawerShape shape of the drawer sheet (if set) - * @param drawerElevation drawer sheet elevation. This controls the size of the shadow - * below the drawer sheet (if set) - * @param drawerBackgroundColor background color to be used for the drawer sheet - * @param drawerContentColor color of the content to use inside the drawer sheet. Defaults to - * either the matching content color for [drawerBackgroundColor], or, if it is not a color from - * the theme, this will keep the same value set above this Surface. - * @param drawerScrimColor color of the scrim that obscures content when the drawer is open - * @param backgroundColor background of the scaffold body - * @param contentColor color of the content in scaffold body. Defaults to either the matching - * content color for [backgroundColor], or, if it is not a color from the theme, this will keep - * the same value set above this Surface. - * @param contentPadding Additional content padding to apply to the [content]. - * @param content content of your screen. The lambda receives an [PaddingValues] that should be - * applied to the content root via Modifier.padding to properly offset top and bottom bars. If - * 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, - scaffoldState: ScaffoldState = rememberScaffoldState(), - topBar: @Composable () -> Unit = {}, - bottomBar: @Composable () -> Unit = {}, - snackbarHost: @Composable (SnackbarHostState) -> Unit = { SnackbarHost(it) }, - floatingActionButton: @Composable () -> Unit = {}, - floatingActionButtonPosition: FabPosition = FabPosition.End, - isFloatingActionButtonDocked: Boolean = false, - drawerContent: @Composable (ColumnScope.() -> Unit)? = null, - drawerGesturesEnabled: Boolean = true, - drawerShape: Shape = MaterialTheme.shapes.large, - drawerElevation: Dp = DrawerDefaults.Elevation, - drawerBackgroundColor: Color = MaterialTheme.colors.surface, - drawerContentColor: Color = contentColorFor(drawerBackgroundColor), - drawerScrimColor: Color = DrawerDefaults.scrimColor, - backgroundColor: Color = MaterialTheme.colors.background, - contentColor: Color = contentColorFor(backgroundColor), - contentPadding: PaddingValues = LocalScaffoldPadding.current, - content: @Composable (PaddingValues) -> Unit -) { - val child = @Composable { childModifier: Modifier -> - Surface(modifier = childModifier, color = backgroundColor, contentColor = contentColor) { - ScaffoldLayout( - isFabDocked = isFloatingActionButtonDocked, - fabPosition = floatingActionButtonPosition, - topBar = topBar, - content = content, - snackbar = { snackbarHost(scaffoldState.snackbarHostState) }, - fab = floatingActionButton, - bottomBar = bottomBar, - contentPadding = contentPadding, - ) - } - } - - if (drawerContent != null) { - ModalDrawer( - modifier = modifier, - drawerState = scaffoldState.drawerState, - gesturesEnabled = drawerGesturesEnabled, - drawerContent = drawerContent, - drawerShape = drawerShape, - drawerElevation = drawerElevation, - drawerBackgroundColor = drawerBackgroundColor, - drawerContentColor = drawerContentColor, - scrimColor = drawerScrimColor, - content = { child(Modifier) } - ) - } else { - child(modifier) - } -} - -/** - * Layout for a [Scaffold]'s content. - * - * @param isFabDocked whether the FAB (if present) is docked to the bottom bar or not - * @param fabPosition [FabPosition] for the FAB (if present) - * @param topBar the content to place at the top of the [Scaffold], typically a [TopAppBar] - * @param content the main 'body' of the [Scaffold] - * @param snackbar the [Snackbar] displayed on top of the [content] - * @param fab the [FloatingActionButton] displayed on top of the [content], below the [snackbar] - * and above the [bottomBar] - * @param bottomBar the content to place at the bottom of the [Scaffold], on top of the - * [content], typically a [BottomAppBar]. - */ -@Composable -private fun ScaffoldLayout( - isFabDocked: Boolean, - fabPosition: FabPosition, - topBar: @Composable () -> Unit, - content: @Composable (PaddingValues) -> Unit, - snackbar: @Composable () -> Unit, - fab: @Composable () -> Unit, - bottomBar: @Composable () -> Unit, - contentPadding: PaddingValues, -) { - val innerPadding = remember { MutablePaddingValues() } - - SubcomposeLayout { constraints -> - val layoutWidth = constraints.maxWidth - val layoutHeight = constraints.maxHeight - - val looseConstraints = constraints.copy(minWidth = 0, minHeight = 0) - - layout(layoutWidth, layoutHeight) { - val topBarPlaceables = subcompose(ScaffoldLayoutContent.TopBar, topBar).map { - it.measure(looseConstraints) - } - - val topBarHeight = topBarPlaceables.maxByOrNull { it.height }?.height ?: 0 - - val snackbarPlaceables = subcompose(ScaffoldLayoutContent.Snackbar, snackbar).map { - it.measure(looseConstraints) - } - - val snackbarHeight = snackbarPlaceables.maxByOrNull { it.height }?.height ?: 0 - - val fabPlaceables = subcompose(ScaffoldLayoutContent.Fab, fab) - .mapNotNull { measurable -> - measurable.measure(looseConstraints).takeIf { it.height != 0 && it.width != 0 } - } - - val fabPlacement = if (fabPlaceables.isNotEmpty()) { - val fabWidth = fabPlaceables.maxByOrNull { it.width }!!.width - val fabHeight = fabPlaceables.maxByOrNull { it.height }!!.height - // FAB distance from the left of the layout, taking into account LTR / RTL - val fabLeftOffset = if (fabPosition == FabPosition.End) { - if (layoutDirection == LayoutDirection.Ltr) { - layoutWidth - FabSpacing.roundToPx() - fabWidth - } else { - FabSpacing.roundToPx() - } - } else { - (layoutWidth - fabWidth) / 2 - } - - FabPlacement( - isDocked = isFabDocked, - left = fabLeftOffset, - width = fabWidth, - height = fabHeight - ) - } else { - null - } - - val bottomBarPlaceables = subcompose(ScaffoldLayoutContent.BottomBar) { - CompositionLocalProvider( - LocalFabPlacement provides fabPlacement, - content = bottomBar - ) - }.map { it.measure(looseConstraints) } - - val bottomBarHeight = bottomBarPlaceables.maxByOrNull { it.height }?.height ?: 0 - val fabOffsetFromBottom = fabPlacement?.let { - if (bottomBarHeight == 0) { - it.height + - FabSpacing.roundToPx() + - contentPadding.calculateBottomPadding().roundToPx() - } else { - if (isFabDocked) { - // Total height is the bottom bar height + half the FAB height - bottomBarHeight + (it.height / 2) - } else { - // Total height is the bottom bar height + the FAB height + the padding - // between the FAB and bottom bar - bottomBarHeight + it.height + FabSpacing.roundToPx() - } - } - } - - val snackbarOffsetFromBottom = if (snackbarHeight != 0) { - snackbarHeight + (fabOffsetFromBottom ?: bottomBarHeight) - } else { - 0 - } - - // Update the inner padding - innerPadding.apply { - start = contentPadding.calculateStartPadding(LayoutDirection.Ltr) - top = topBarHeight.toDp() + contentPadding.calculateTopPadding() - end = contentPadding.calculateEndPadding(LayoutDirection.Ltr) - bottom = bottomBarHeight.toDp() + contentPadding.calculateBottomPadding() - } - - val bodyContentPlaceables = subcompose(ScaffoldLayoutContent.MainContent) { - CompositionLocalProvider(LocalScaffoldPadding provides innerPadding) { - content(innerPadding) - } - }.map { it.measure(looseConstraints.copy(maxHeight = layoutHeight)) } - - // Placing to control drawing order to match default elevation of each placeable - - bodyContentPlaceables.forEach { it.place(0, 0) } - topBarPlaceables.forEach { it.place(0, 0) } - snackbarPlaceables.forEach { - it.place(0, layoutHeight - snackbarOffsetFromBottom) - } - // The bottom bar is always at the bottom of the layout - bottomBarPlaceables.forEach { - it.place(0, layoutHeight - bottomBarHeight) - } - // Explicitly not using placeRelative here as `leftOffset` already accounts for RTL - fabPlacement?.let { placement -> - fabPlaceables.forEach { - it.place(placement.left, layoutHeight - fabOffsetFromBottom!!) - } - } - } - } -} - -/** - * Placement information for a [FloatingActionButton] inside a [Scaffold]. - * - * @property isDocked whether the FAB should be docked with the bottom bar - * @property left the FAB's offset from the left edge of the bottom bar, already adjusted for RTL - * support - * @property width the width of the FAB - * @property height the height of the FAB - */ -@Immutable -internal class FabPlacement( - val isDocked: Boolean, - val left: Int, - val width: Int, - val height: Int -) - -/** - * CompositionLocal containing a [FabPlacement] that is read by [BottomAppBar] to calculate notch - * location. - */ -internal val LocalFabPlacement = staticCompositionLocalOf { null } - -// FAB spacing above the bottom bar / bottom of the Scaffold -private val FabSpacing = 16.dp - -private enum class ScaffoldLayoutContent { TopBar, MainContent, Snackbar, Fab, BottomBar } - -@Stable -internal class MutablePaddingValues : PaddingValues { - var start: Dp by mutableStateOf(0.dp) - var top: Dp by mutableStateOf(0.dp) - var end: Dp by mutableStateOf(0.dp) - var bottom: Dp by mutableStateOf(0.dp) - - override fun calculateLeftPadding(layoutDirection: LayoutDirection): Dp { - return when (layoutDirection) { - LayoutDirection.Ltr -> start - LayoutDirection.Rtl -> end - } - } - - override fun calculateTopPadding(): Dp = top - - override fun calculateRightPadding(layoutDirection: LayoutDirection): Dp { - return when (layoutDirection) { - LayoutDirection.Ltr -> end - LayoutDirection.Rtl -> start - } - } - - override fun calculateBottomPadding(): Dp = bottom -} 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 deleted file mode 100644 index d1bce921c..000000000 --- a/insets-ui/src/main/java/com/google/accompanist/insets/ui/TopAppBar.kt +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -@file:Suppress("DEPRECATION") - -package com.google.accompanist.insets.ui - -import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.foundation.layout.RowScope -import androidx.compose.foundation.layout.padding -import androidx.compose.material.AppBarDefaults -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Surface -import androidx.compose.material.TopAppBar -import androidx.compose.material.contentColorFor -import androidx.compose.material.primarySurface -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.unit.Dp -import androidx.compose.ui.unit.dp - -/** - * A wrapper around [TopAppBar] which supports the setting of [contentPadding] to add - * internal padding. This is especially useful in conjunction with insets. - * - * For an edge-to-edge layout, typically you would use the - * [com.google.accompanist.insets.WindowInsets.systemBars] insets like so below: - * - * @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, - modifier: Modifier = Modifier, - contentPadding: PaddingValues = PaddingValues(0.dp), - navigationIcon: @Composable (() -> Unit)? = null, - actions: @Composable RowScope.() -> Unit = {}, - backgroundColor: Color = MaterialTheme.colors.primarySurface, - contentColor: Color = contentColorFor(backgroundColor), - elevation: Dp = AppBarDefaults.TopAppBarElevation, -) { - TopAppBarSurface( - modifier = modifier, - backgroundColor = backgroundColor, - contentColor = contentColor, - elevation = elevation - ) { - TopAppBarContent( - title = title, - navigationIcon = navigationIcon, - actions = actions, - modifier = Modifier.padding(contentPadding) - ) - } -} - -@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, - backgroundColor: Color = MaterialTheme.colors.primarySurface, - contentColor: Color = contentColorFor(backgroundColor), - elevation: Dp = AppBarDefaults.TopAppBarElevation, - content: @Composable () -> Unit, -) { - Surface( - color = backgroundColor, - contentColor = contentColor, - elevation = elevation, - modifier = modifier, - content = content - ) -} - -@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, - modifier: Modifier = Modifier, - navigationIcon: @Composable (() -> Unit)? = null, - actions: @Composable RowScope.() -> Unit = {}, -) { - TopAppBar( - title = title, - navigationIcon = navigationIcon, - actions = actions, - backgroundColor = Color.Transparent, - elevation = 0.dp, - modifier = modifier - ) -} 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 deleted file mode 100644 index b61ef61dc..000000000 --- a/insets-ui/src/sharedTest/kotlin/com/google/accompanist/insets/ScaffoldTest.kt +++ /dev/null @@ -1,577 +0,0 @@ -/* - * Copyright 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -@file:Suppress("DEPRECATION") - -package com.google.accompanist.insets - -import android.os.Build -import androidx.compose.foundation.background -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.requiredSize -import androidx.compose.foundation.layout.sizeIn -import androidx.compose.material.BottomAppBar -import androidx.compose.material.FabPosition -import androidx.compose.material.FloatingActionButton -import androidx.compose.material.Icon -import androidx.compose.material.MaterialTheme -import androidx.compose.material.ScaffoldState -import androidx.compose.material.Surface -import androidx.compose.material.Text -import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.Favorite -import androidx.compose.material.rememberScaffoldState -import androidx.compose.runtime.Composable -import androidx.compose.runtime.mutableStateOf -import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.shadow -import androidx.compose.ui.geometry.Offset -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.asAndroidBitmap -import androidx.compose.ui.layout.LayoutCoordinates -import androidx.compose.ui.layout.onGloballyPositioned -import androidx.compose.ui.layout.positionInParent -import androidx.compose.ui.layout.positionInRoot -import androidx.compose.ui.platform.testTag -import androidx.compose.ui.semantics.semantics -import androidx.compose.ui.test.SemanticsNodeInteraction -import androidx.compose.ui.test.assertHeightIsEqualTo -import androidx.compose.ui.test.assertWidthIsEqualTo -import androidx.compose.ui.test.captureToImage -import androidx.compose.ui.test.junit4.ComposeContentTestRule -import androidx.compose.ui.test.junit4.createComposeRule -import androidx.compose.ui.test.onNodeWithTag -import androidx.compose.ui.test.performTouchInput -import androidx.compose.ui.test.swipeLeft -import androidx.compose.ui.test.swipeRight -import androidx.compose.ui.unit.Dp -import androidx.compose.ui.unit.IntSize -import androidx.compose.ui.unit.dp -import androidx.compose.ui.unit.toSize -import androidx.compose.ui.zIndex -import androidx.test.ext.junit.runners.AndroidJUnit4 -import androidx.test.filters.SdkSuppress -import com.google.accompanist.insets.ui.FabPlacement -import com.google.accompanist.insets.ui.LocalFabPlacement -import com.google.accompanist.insets.ui.Scaffold -import com.google.accompanist.internal.test.IgnoreOnRobolectric -import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.runBlocking -import org.junit.Ignore -import org.junit.Rule -import org.junit.Test -import org.junit.experimental.categories.Category -import org.junit.runner.RunWith - -@RunWith(AndroidJUnit4::class) -class ScaffoldTest { - - @get:Rule - val rule = createComposeRule() - - private val scaffoldTag = "Scaffold" - - @Test - fun scaffold_onlyContent_takesWholeScreen() { - rule.setMaterialContentForSizeAssertions( - parentMaxWidth = 100.dp, - parentMaxHeight = 100.dp - ) { - Scaffold { - Text("Scaffold body") - } - } - .assertWidthIsEqualTo(100.dp) - .assertHeightIsEqualTo(100.dp) - } - - @Test - fun scaffold_onlyContent_stackSlot() { - var child1: Offset = Offset.Zero - var child2: Offset = Offset.Zero - rule.setMaterialContent { - Scaffold { - Text( - "One", - Modifier.onGloballyPositioned { child1 = it.positionInParent() } - ) - Text( - "Two", - Modifier.onGloballyPositioned { child2 = it.positionInParent() } - ) - } - } - assertThat(child1.y).isEqualTo(child2.y) - assertThat(child1.x).isEqualTo(child2.x) - } - - @Test - fun scaffold_AppbarAndContent_inStack() { - var appbarPosition: Offset = Offset.Zero - var appbarSize: IntSize = IntSize.Zero - var contentPosition: Offset = Offset.Zero - var contentPadding = PaddingValues(0.dp) - - rule.setMaterialContent { - Scaffold( - topBar = { - Box( - Modifier - .fillMaxWidth() - .height(50.dp) - .background(color = Color.Red) - .onGloballyPositioned { positioned: LayoutCoordinates -> - appbarPosition = positioned.localToRoot(Offset.Zero) - appbarSize = positioned.size - } - ) - } - ) { paddingValues -> - contentPadding = paddingValues - - Box( - Modifier - .fillMaxWidth() - .height(50.dp) - .background(Color.Blue) - .onGloballyPositioned { positioned -> - contentPosition = positioned.localToRoot(Offset.Zero) - } - ) - } - } - - assertThat(appbarPosition.y).isWithin(0.1f).of(0f) - assertThat(appbarPosition.y).isEqualTo(contentPosition.y) - assertThat(with(rule.density) { contentPadding.calculateTopPadding().roundToPx() }) - .isEqualTo(appbarSize.height) - } - - @Test - fun scaffold_bottomBarAndContent_inStack() { - var appbarPosition: Offset = Offset.Zero - var appbarSize: IntSize = IntSize.Zero - var contentPosition: Offset = Offset.Zero - var contentSize: IntSize = IntSize.Zero - var contentPadding = PaddingValues(0.dp) - - rule.setMaterialContent { - Scaffold( - bottomBar = { - Box( - Modifier - .fillMaxWidth() - .height(50.dp) - .background(color = Color.Red) - .onGloballyPositioned { positioned: LayoutCoordinates -> - appbarPosition = positioned.positionInParent() - appbarSize = positioned.size - } - ) - } - ) { paddingValues -> - contentPadding = paddingValues - - Box( - Modifier - .fillMaxSize() - .height(50.dp) - .background(color = Color.Blue) - .onGloballyPositioned { positioned: LayoutCoordinates -> - contentPosition = positioned.positionInParent() - contentSize = positioned.size - } - ) - } - } - - val appBarBottom = appbarPosition.y + appbarSize.height - val contentBottom = contentPosition.y + contentSize.height - - assertThat(appBarBottom).isEqualTo(contentBottom) - assertThat(with(rule.density) { contentPadding.calculateBottomPadding().roundToPx() }) - .isEqualTo(appbarSize.height) - } - - @Test - @Ignore("unignore once animation sync is ready (b/147291885)") - fun scaffold_drawer_gestures() { - var drawerChildPosition: Offset = Offset.Zero - val drawerGesturedEnabledState = mutableStateOf(false) - rule.setContent { - Box(Modifier.testTag(scaffoldTag)) { - Scaffold( - drawerContent = { - Box( - Modifier - .fillMaxWidth() - .height(50.dp) - .background(color = Color.Blue) - .onGloballyPositioned { positioned: LayoutCoordinates -> - drawerChildPosition = positioned.positionInParent() - } - ) - }, - drawerGesturesEnabled = drawerGesturedEnabledState.value - ) { - Box( - Modifier - .fillMaxWidth() - .height(50.dp) - .background(color = Color.Blue) - ) - } - } - } - assertThat(drawerChildPosition.x).isLessThan(0f) - rule.onNodeWithTag(scaffoldTag).performTouchInput { - swipeRight() - } - assertThat(drawerChildPosition.x).isLessThan(0f) - rule.onNodeWithTag(scaffoldTag).performTouchInput { - swipeLeft() - } - assertThat(drawerChildPosition.x).isLessThan(0f) - - rule.runOnUiThread { - drawerGesturedEnabledState.value = true - } - - rule.onNodeWithTag(scaffoldTag).performTouchInput { - swipeRight() - } - assertThat(drawerChildPosition.x).isEqualTo(0f) - rule.onNodeWithTag(scaffoldTag).performTouchInput { - swipeLeft() - } - assertThat(drawerChildPosition.x).isLessThan(0f) - } - - @Test - @Ignore("unignore once animation sync is ready (b/147291885)") - fun scaffold_drawer_manualControl(): Unit = runBlocking { - var drawerChildPosition: Offset = Offset.Zero - lateinit var scaffoldState: ScaffoldState - rule.setContent { - scaffoldState = rememberScaffoldState() - Box(Modifier.testTag(scaffoldTag)) { - Scaffold( - scaffoldState = scaffoldState, - drawerContent = { - Box( - Modifier - .fillMaxWidth() - .height(50.dp) - .background(color = Color.Blue) - .onGloballyPositioned { positioned: LayoutCoordinates -> - drawerChildPosition = positioned.positionInParent() - } - ) - } - ) { - Box( - Modifier - .fillMaxWidth() - .height(50.dp) - .background(color = Color.Blue) - ) - } - } - } - assertThat(drawerChildPosition.x).isLessThan(0f) - scaffoldState.drawerState.open() - assertThat(drawerChildPosition.x).isLessThan(0f) - scaffoldState.drawerState.close() - assertThat(drawerChildPosition.x).isLessThan(0f) - } - - @Test - fun scaffold_centerDockedFab_position() { - var fabPosition: Offset = Offset.Zero - var fabSize: IntSize = IntSize.Zero - var bottomBarPosition: Offset = Offset.Zero - rule.setContent { - Scaffold( - floatingActionButton = { - FloatingActionButton( - modifier = Modifier.onGloballyPositioned { positioned -> - fabSize = positioned.size - fabPosition = positioned.positionInRoot() - }, - onClick = {} - ) { - Icon(Icons.Filled.Favorite, null) - } - }, - floatingActionButtonPosition = FabPosition.Center, - isFloatingActionButtonDocked = true, - bottomBar = { - BottomAppBar( - Modifier - .onGloballyPositioned { positioned: LayoutCoordinates -> - bottomBarPosition = positioned.positionInRoot() - } - ) {} - } - ) { - Text("body") - } - } - val expectedFabY = bottomBarPosition.y - (fabSize.height / 2) - assertThat(fabPosition.y).isEqualTo(expectedFabY) - } - - @Test - fun scaffold_fab_position_nestedScaffold() { - var fabPosition: Offset = Offset.Zero - var fabSize: IntSize = IntSize.Zero - var bottomBarPosition: Offset = Offset.Zero - rule.setContent { - Scaffold( - bottomBar = { - BottomAppBar( - Modifier - .onGloballyPositioned { positioned: LayoutCoordinates -> - bottomBarPosition = positioned.positionInRoot() - } - ) {} - } - ) { - Scaffold( - floatingActionButton = { - FloatingActionButton( - modifier = Modifier.onGloballyPositioned { positioned -> - fabSize = positioned.size - fabPosition = positioned.positionInRoot() - }, - onClick = {} - ) { - Icon(Icons.Filled.Favorite, null) - } - }, - ) { - Text("body") - } - } - } - - val expectedFabY = bottomBarPosition.y - fabSize.height - - with(rule.density) { 16.dp.roundToPx() } - assertThat(fabPosition.y).isEqualTo(expectedFabY) - } - - @Test - fun scaffold_endDockedFab_position() { - var fabPosition: Offset = Offset.Zero - var fabSize: IntSize = IntSize.Zero - var bottomBarPosition: Offset = Offset.Zero - rule.setContent { - Scaffold( - floatingActionButton = { - FloatingActionButton( - modifier = Modifier.onGloballyPositioned { positioned -> - fabSize = positioned.size - fabPosition = positioned.positionInRoot() - }, - onClick = {} - ) { - Icon(Icons.Filled.Favorite, null) - } - }, - floatingActionButtonPosition = FabPosition.End, - isFloatingActionButtonDocked = true, - bottomBar = { - BottomAppBar( - Modifier - .onGloballyPositioned { positioned: LayoutCoordinates -> - bottomBarPosition = positioned.positionInRoot() - } - ) {} - } - ) { - Text("body") - } - } - val expectedFabY = bottomBarPosition.y - (fabSize.height / 2) - assertThat(fabPosition.y).isEqualTo(expectedFabY) - } - - @SdkSuppress(minSdkVersion = Build.VERSION_CODES.O) - @Category(IgnoreOnRobolectric::class) - @Test - fun scaffold_topAppBarIsDrawnOnTopOfContent() { - rule.setContent { - Box( - Modifier - .requiredSize(10.dp, 20.dp) - .semantics(mergeDescendants = true) {} - .testTag("Scaffold") - ) { - Scaffold( - topBar = { - Box( - Modifier - .requiredSize(10.dp) - .shadow(4.dp) - .zIndex(4f) - .background(color = Color.White) - ) - } - ) { - Box( - Modifier - .requiredSize(10.dp) - .background(color = Color.White) - ) - } - } - } - - rule.onNodeWithTag("Scaffold") - .captureToImage() - .asAndroidBitmap() - .apply { - // asserts the appbar(top half part) has the shadow - val yPos = height / 2 + 2 - assertThat(Color(getPixel(0, yPos))).isNotEqualTo(Color.White) - assertThat(Color(getPixel(width / 2, yPos))).isNotEqualTo(Color.White) - assertThat(Color(getPixel(width - 1, yPos))).isNotEqualTo(Color.White) - } - } - - @Test - fun scaffold_geometry_fabSize() { - var fabSize: IntSize = IntSize.Zero - val showFab = mutableStateOf(true) - var fabPlacement: FabPlacement? = null - rule.setContent { - val fab = @Composable { - if (showFab.value) { - FloatingActionButton( - modifier = Modifier.onGloballyPositioned { positioned -> - fabSize = positioned.size - }, - onClick = {} - ) { - Icon(Icons.Filled.Favorite, null) - } - } - } - Scaffold( - floatingActionButton = fab, - floatingActionButtonPosition = FabPosition.End, - bottomBar = { - fabPlacement = LocalFabPlacement.current - } - ) { - Text("body") - } - } - rule.runOnIdle { - assertThat(fabPlacement?.width).isEqualTo(fabSize.width) - assertThat(fabPlacement?.height).isEqualTo(fabSize.height) - showFab.value = false - } - - rule.runOnIdle { - assertThat(fabPlacement).isEqualTo(null) - assertThat(fabPlacement).isEqualTo(null) - } - } - - @Test - fun scaffold_innerPadding_lambdaParam() { - var bottomBarSize: IntSize = IntSize.Zero - lateinit var innerPadding: PaddingValues - - lateinit var scaffoldState: ScaffoldState - rule.setContent { - scaffoldState = rememberScaffoldState() - Scaffold( - scaffoldState = scaffoldState, - bottomBar = { - Box( - Modifier - .fillMaxWidth() - .height(100.dp) - .background(color = Color.Red) - .onGloballyPositioned { positioned: LayoutCoordinates -> - bottomBarSize = positioned.size - } - ) - } - ) { - innerPadding = it - Text("body") - } - } - rule.runOnIdle { - with(rule.density) { - assertThat(innerPadding.calculateBottomPadding()) - .isEqualTo(bottomBarSize.toSize().height.toDp()) - } - } - } -} - -private fun ComposeContentTestRule.setMaterialContent( - modifier: Modifier = Modifier, - composable: @Composable () -> Unit -) { - setContent { - MaterialTheme { - Surface(modifier = modifier, content = composable) - } - } -} - -/** - * Constant to emulate very big but finite constraints - */ -private val BigTestMaxWidth = 5000.dp -private val BigTestMaxHeight = 5000.dp - -private fun ComposeContentTestRule.setMaterialContentForSizeAssertions( - parentMaxWidth: Dp = BigTestMaxWidth, - parentMaxHeight: Dp = BigTestMaxHeight, - // TODO : figure out better way to make it flexible - content: @Composable () -> Unit -): SemanticsNodeInteraction { - setContent { - MaterialTheme { - Surface { - Box { - Box( - Modifier - .sizeIn( - maxWidth = parentMaxWidth, - maxHeight = parentMaxHeight - ) - .testTag("containerForSizeAssertion") - ) { - content() - } - } - } - } - } - - return onNodeWithTag("containerForSizeAssertion") -} diff --git a/insets-ui/src/test/resources/robolectric.properties b/insets-ui/src/test/resources/robolectric.properties deleted file mode 100644 index 2806eaffa..000000000 --- a/insets-ui/src/test/resources/robolectric.properties +++ /dev/null @@ -1,3 +0,0 @@ -# Pin SDK to 30 since Robolectric does not currently support API 31: -# https://github.com/robolectric/robolectric/issues/6635 -sdk=30 diff --git a/mkdocs.yml b/mkdocs.yml index b0c4a719d..2883c554f 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -15,9 +15,6 @@ repo_url: 'https://github.com/google/accompanist' # Navigation nav: - 'Overview': index.md - - 'Insets': - - 'Guide': insets.md - - 'API': api/insets/ - 'System UI Controller': - 'Guide': systemuicontroller.md - 'API': api/systemuicontroller/ diff --git a/sample/build.gradle.kts b/sample/build.gradle.kts index 843b77b84..9ff319594 100644 --- a/sample/build.gradle.kts +++ b/sample/build.gradle.kts @@ -59,7 +59,6 @@ android { dependencies { implementation(project(":adaptive")) implementation(project(":drawablepainter")) - implementation(project(":insets-ui")) implementation(project(":navigation-animation")) implementation(project(":navigation-material")) implementation(project(":permissions")) diff --git a/settings.gradle.kts b/settings.gradle.kts index d9a950207..464abe5e1 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -27,23 +27,14 @@ gradleEnterprise { include(":adaptive") include(":internal-testutils") -include(":insets-ui") include(":appcompat-theme") include(":drawablepainter") include(":navigation-animation") include(":navigation-material") include(":permissions") include(":permissions-lint") -include(":placeholder") -include(":placeholder-material") -include(":placeholder-material3") include(":systemuicontroller") include(":sample") include(":testharness") -include(":themeadapter-core") -include(":themeadapter-appcompat") -include(":themeadapter-material") -include(":themeadapter-material3") -include(":web") rootProject.name = "accompanist"