Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: UiConfiguration.windowInsets #2200

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions redwood-runtime/api/android/redwood-runtime.api
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,15 @@ public final class app/cash/redwood/ui/UiConfiguration {
public static final field $stable I
public static final field Companion Lapp/cash/redwood/ui/UiConfiguration$Companion;
public fun <init> ()V
public fun <init> (ZLapp/cash/redwood/ui/Margin;Lapp/cash/redwood/ui/Size;DLapp/cash/redwood/ui/LayoutDirection;)V
public synthetic fun <init> (ZLapp/cash/redwood/ui/Margin;Lapp/cash/redwood/ui/Size;DLapp/cash/redwood/ui/LayoutDirection;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun <init> (ZLapp/cash/redwood/ui/Margin;Lapp/cash/redwood/ui/Margin;Lapp/cash/redwood/ui/Size;DLapp/cash/redwood/ui/LayoutDirection;)V
public synthetic fun <init> (ZLapp/cash/redwood/ui/Margin;Lapp/cash/redwood/ui/Margin;Lapp/cash/redwood/ui/Size;DLapp/cash/redwood/ui/LayoutDirection;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun equals (Ljava/lang/Object;)Z
public final fun getDarkMode ()Z
public final fun getDensity ()D
public final fun getLayoutDirection ()Lapp/cash/redwood/ui/LayoutDirection;
public final fun getSafeAreaInsets ()Lapp/cash/redwood/ui/Margin;
public final fun getViewportSize ()Lapp/cash/redwood/ui/Size;
public final fun getWindowInsets ()Lapp/cash/redwood/ui/Margin;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
Expand Down
5 changes: 3 additions & 2 deletions redwood-runtime/api/jvm/redwood-runtime.api
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,15 @@ public final class app/cash/redwood/ui/UiConfiguration {
public static final field $stable I
public static final field Companion Lapp/cash/redwood/ui/UiConfiguration$Companion;
public fun <init> ()V
public fun <init> (ZLapp/cash/redwood/ui/Margin;Lapp/cash/redwood/ui/Size;DLapp/cash/redwood/ui/LayoutDirection;)V
public synthetic fun <init> (ZLapp/cash/redwood/ui/Margin;Lapp/cash/redwood/ui/Size;DLapp/cash/redwood/ui/LayoutDirection;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun <init> (ZLapp/cash/redwood/ui/Margin;Lapp/cash/redwood/ui/Margin;Lapp/cash/redwood/ui/Size;DLapp/cash/redwood/ui/LayoutDirection;)V
public synthetic fun <init> (ZLapp/cash/redwood/ui/Margin;Lapp/cash/redwood/ui/Margin;Lapp/cash/redwood/ui/Size;DLapp/cash/redwood/ui/LayoutDirection;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun equals (Ljava/lang/Object;)Z
public final fun getDarkMode ()Z
public final fun getDensity ()D
public final fun getLayoutDirection ()Lapp/cash/redwood/ui/LayoutDirection;
public final fun getSafeAreaInsets ()Lapp/cash/redwood/ui/Margin;
public final fun getViewportSize ()Lapp/cash/redwood/ui/Size;
public final fun getWindowInsets ()Lapp/cash/redwood/ui/Margin;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
Expand Down
4 changes: 3 additions & 1 deletion redwood-runtime/api/redwood-runtime.klib.api
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ final class app.cash.redwood.ui/Size { // app.cash.redwood.ui/Size|null[0]
}

final class app.cash.redwood.ui/UiConfiguration { // app.cash.redwood.ui/UiConfiguration|null[0]
constructor <init>(kotlin/Boolean = ..., app.cash.redwood.ui/Margin = ..., app.cash.redwood.ui/Size = ..., kotlin/Double = ..., app.cash.redwood.ui/LayoutDirection = ...) // app.cash.redwood.ui/UiConfiguration.<init>|<init>(kotlin.Boolean;app.cash.redwood.ui.Margin;app.cash.redwood.ui.Size;kotlin.Double;app.cash.redwood.ui.LayoutDirection){}[0]
constructor <init>(kotlin/Boolean = ..., app.cash.redwood.ui/Margin = ..., app.cash.redwood.ui/Margin = ..., app.cash.redwood.ui/Size = ..., kotlin/Double = ..., app.cash.redwood.ui/LayoutDirection = ...) // app.cash.redwood.ui/UiConfiguration.<init>|<init>(kotlin.Boolean;app.cash.redwood.ui.Margin;app.cash.redwood.ui.Margin;app.cash.redwood.ui.Size;kotlin.Double;app.cash.redwood.ui.LayoutDirection){}[0]

final val darkMode // app.cash.redwood.ui/UiConfiguration.darkMode|{}darkMode[0]
final fun <get-darkMode>(): kotlin/Boolean // app.cash.redwood.ui/UiConfiguration.darkMode.<get-darkMode>|<get-darkMode>(){}[0]
Expand All @@ -154,6 +154,8 @@ final class app.cash.redwood.ui/UiConfiguration { // app.cash.redwood.ui/UiConfi
final fun <get-safeAreaInsets>(): app.cash.redwood.ui/Margin // app.cash.redwood.ui/UiConfiguration.safeAreaInsets.<get-safeAreaInsets>|<get-safeAreaInsets>(){}[0]
final val viewportSize // app.cash.redwood.ui/UiConfiguration.viewportSize|{}viewportSize[0]
final fun <get-viewportSize>(): app.cash.redwood.ui/Size // app.cash.redwood.ui/UiConfiguration.viewportSize.<get-viewportSize>|<get-viewportSize>(){}[0]
final val windowInsets // app.cash.redwood.ui/UiConfiguration.windowInsets|{}windowInsets[0]
final fun <get-windowInsets>(): app.cash.redwood.ui/Margin // app.cash.redwood.ui/UiConfiguration.windowInsets.<get-windowInsets>|<get-windowInsets>(){}[0]

final fun equals(kotlin/Any?): kotlin/Boolean // app.cash.redwood.ui/UiConfiguration.equals|equals(kotlin.Any?){}[0]
final fun hashCode(): kotlin/Int // app.cash.redwood.ui/UiConfiguration.hashCode|hashCode(){}[0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,23 @@ import kotlinx.serialization.Serializable
@Poko
public class UiConfiguration(
public val darkMode: Boolean = false,

/**
* The insets of the host window, independent of where the Redwood composition is positioned
* within it. The Redwood composition is not responsible for consuming these insets.
*/
public val safeAreaInsets: Margin = Margin.Zero,

/**
* The insets of the viewport that the composition is responsible for consuming.
*
* This may be zero if the host view isn't attached to a view hierarchy and therefore doesn't
* know its insets.
*
* See https://developer.android.com/develop/ui/views/layout/edge-to-edge
*/
public val windowInsets: Margin = Margin.Zero,

/**
* The size of the viewport into which the composition is rendering. This could be as lage as the
* entire screen or as small as an individual view within a larger native screen.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
public final class app/cash/redwood/treehouse/composeui/TreehouseContentKt {
public static final fun TreehouseContent (Lapp/cash/redwood/treehouse/TreehouseApp;Lapp/cash/redwood/treehouse/TreehouseView$WidgetSystem;Lapp/cash/redwood/treehouse/TreehouseContentSource;Landroidx/compose/ui/Modifier;Lapp/cash/redwood/treehouse/CodeListener;Landroidx/compose/runtime/Composer;II)V
public static final fun TreehouseContent (Lapp/cash/redwood/treehouse/TreehouseApp;Lapp/cash/redwood/treehouse/TreehouseView$WidgetSystem;Lapp/cash/redwood/treehouse/TreehouseContentSource;Landroidx/compose/ui/Modifier;Lapp/cash/redwood/ui/Margin;Lapp/cash/redwood/treehouse/CodeListener;Landroidx/compose/runtime/Composer;II)V
}

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
public final class app/cash/redwood/treehouse/composeui/TreehouseContentKt {
public static final fun TreehouseContent (Lapp/cash/redwood/treehouse/TreehouseApp;Lapp/cash/redwood/treehouse/TreehouseView$WidgetSystem;Lapp/cash/redwood/treehouse/TreehouseContentSource;Landroidx/compose/ui/Modifier;Lapp/cash/redwood/treehouse/CodeListener;Landroidx/compose/runtime/Composer;II)V
public static final fun TreehouseContent (Lapp/cash/redwood/treehouse/TreehouseApp;Lapp/cash/redwood/treehouse/TreehouseView$WidgetSystem;Lapp/cash/redwood/treehouse/TreehouseContentSource;Landroidx/compose/ui/Modifier;Lapp/cash/redwood/ui/Margin;Lapp/cash/redwood/treehouse/CodeListener;Landroidx/compose/runtime/Composer;II)V
}

Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
// - Show declarations: true

// Library unique name: <app.cash.redwood:redwood-treehouse-host-composeui>
final fun <#A: app.cash.redwood.treehouse/AppService> app.cash.redwood.treehouse.composeui/TreehouseContent(app.cash.redwood.treehouse/TreehouseApp<#A>, app.cash.redwood.treehouse/TreehouseView.WidgetSystem<kotlin/Function2<androidx.compose.runtime/Composer, kotlin/Int, kotlin/Unit>>, app.cash.redwood.treehouse/TreehouseContentSource<#A>, androidx.compose.ui/Modifier?, app.cash.redwood.treehouse/CodeListener?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int) // app.cash.redwood.treehouse.composeui/TreehouseContent|TreehouseContent(app.cash.redwood.treehouse.TreehouseApp<0:0>;app.cash.redwood.treehouse.TreehouseView.WidgetSystem<kotlin.Function2<androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>>;app.cash.redwood.treehouse.TreehouseContentSource<0:0>;androidx.compose.ui.Modifier?;app.cash.redwood.treehouse.CodeListener?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){0§<app.cash.redwood.treehouse.AppService>}[0]
final fun <#A: app.cash.redwood.treehouse/AppService> app.cash.redwood.treehouse.composeui/TreehouseContent(app.cash.redwood.treehouse/TreehouseApp<#A>, app.cash.redwood.treehouse/TreehouseView.WidgetSystem<kotlin/Function2<androidx.compose.runtime/Composer, kotlin/Int, kotlin/Unit>>, app.cash.redwood.treehouse/TreehouseContentSource<#A>, androidx.compose.ui/Modifier?, app.cash.redwood.ui/Margin?, app.cash.redwood.treehouse/CodeListener?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int) // app.cash.redwood.treehouse.composeui/TreehouseContent|TreehouseContent(app.cash.redwood.treehouse.TreehouseApp<0:0>;app.cash.redwood.treehouse.TreehouseView.WidgetSystem<kotlin.Function2<androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>>;app.cash.redwood.treehouse.TreehouseContentSource<0:0>;androidx.compose.ui.Modifier?;app.cash.redwood.ui.Margin?;app.cash.redwood.treehouse.CodeListener?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){0§<app.cash.redwood.treehouse.AppService>}[0]
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import app.cash.redwood.treehouse.TreehouseView.WidgetSystem
import app.cash.redwood.treehouse.bindWhenReady
import app.cash.redwood.ui.Density
import app.cash.redwood.ui.LayoutDirection as RedwoodLayoutDirection
import app.cash.redwood.ui.Margin
import app.cash.redwood.ui.OnBackPressedDispatcher
import app.cash.redwood.ui.Size
import app.cash.redwood.ui.UiConfiguration
Expand All @@ -55,6 +56,7 @@ public fun <A : AppService> TreehouseContent(
widgetSystem: WidgetSystem<@Composable () -> Unit>,
contentSource: TreehouseContentSource<A>,
modifier: Modifier = Modifier,
windowInsets: Margin = Margin.Zero,
codeListener: CodeListener = remember { CodeListener() },
) {
val onBackPressedDispatcher = platformOnBackPressedDispatcher()
Expand All @@ -64,6 +66,7 @@ public fun <A : AppService> TreehouseContent(
val uiConfiguration = UiConfiguration(
darkMode = isSystemInDarkTheme(),
safeAreaInsets = safeAreaInsets(),
windowInsets = windowInsets,
viewportSize = viewportSize,
density = density.density.toDouble(),
layoutDirection = when (LocalLayoutDirection.current) {
Expand All @@ -77,6 +80,7 @@ public fun <A : AppService> TreehouseContent(
override val children = ComposeWidgetChildren()
override val onBackPressedDispatcher = onBackPressedDispatcher
override val uiConfiguration = MutableStateFlow(uiConfiguration)
override var windowInsets: Margin = windowInsets

// TODO TreehouseView is a weird type and shouldn't extend from RedwoodView. The concept
// of this registry shouldn't exist for Treehouse / should be auto-wired via RedwoodContent.
Expand Down
6 changes: 6 additions & 0 deletions redwood-widget/api/android/redwood-widget.api
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,27 @@ public final class app/cash/redwood/widget/MutableListChildren : app/cash/redwoo

public class app/cash/redwood/widget/RedwoodLayout : android/widget/FrameLayout, app/cash/redwood/widget/RedwoodView {
public fun <init> (Landroid/content/Context;Landroidx/activity/OnBackPressedDispatcher;)V
public final fun consumeWindowInsets (I)V
public static synthetic fun consumeWindowInsets$default (Lapp/cash/redwood/widget/RedwoodLayout;IILjava/lang/Object;)V
public fun getChildren ()Lapp/cash/redwood/widget/Widget$Children;
public fun getOnBackPressedDispatcher ()Lapp/cash/redwood/ui/OnBackPressedDispatcher;
public fun getSavedStateRegistry ()Lapp/cash/redwood/widget/SavedStateRegistry;
public fun getUiConfiguration ()Lkotlinx/coroutines/flow/StateFlow;
public fun getWindowInsets ()Lapp/cash/redwood/ui/Margin;
protected fun onConfigurationChanged (Landroid/content/res/Configuration;)V
protected fun onLayout (ZIIII)V
public fun reset ()V
public fun setWindowInsets (Lapp/cash/redwood/ui/Margin;)V
}

public abstract interface class app/cash/redwood/widget/RedwoodView {
public abstract fun getChildren ()Lapp/cash/redwood/widget/Widget$Children;
public abstract fun getOnBackPressedDispatcher ()Lapp/cash/redwood/ui/OnBackPressedDispatcher;
public abstract fun getSavedStateRegistry ()Lapp/cash/redwood/widget/SavedStateRegistry;
public abstract fun getUiConfiguration ()Lkotlinx/coroutines/flow/StateFlow;
public abstract fun getWindowInsets ()Lapp/cash/redwood/ui/Margin;
public abstract fun reset ()V
public abstract fun setWindowInsets (Lapp/cash/redwood/ui/Margin;)V
}

public abstract interface class app/cash/redwood/widget/SavedStateRegistry {
Expand Down
2 changes: 2 additions & 0 deletions redwood-widget/api/jvm/redwood-widget.api
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ public abstract interface class app/cash/redwood/widget/RedwoodView {
public abstract fun getOnBackPressedDispatcher ()Lapp/cash/redwood/ui/OnBackPressedDispatcher;
public abstract fun getSavedStateRegistry ()Lapp/cash/redwood/widget/SavedStateRegistry;
public abstract fun getUiConfiguration ()Lkotlinx/coroutines/flow/StateFlow;
public abstract fun getWindowInsets ()Lapp/cash/redwood/ui/Margin;
public abstract fun reset ()V
public abstract fun setWindowInsets (Lapp/cash/redwood/ui/Margin;)V
}

public abstract interface class app/cash/redwood/widget/SavedStateRegistry {
Expand Down
8 changes: 8 additions & 0 deletions redwood-widget/api/redwood-widget.klib.api
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ abstract interface <#A: kotlin/Any> app.cash.redwood.widget/RedwoodView { // app
abstract val uiConfiguration // app.cash.redwood.widget/RedwoodView.uiConfiguration|{}uiConfiguration[0]
abstract fun <get-uiConfiguration>(): kotlinx.coroutines.flow/StateFlow<app.cash.redwood.ui/UiConfiguration> // app.cash.redwood.widget/RedwoodView.uiConfiguration.<get-uiConfiguration>|<get-uiConfiguration>(){}[0]

abstract var windowInsets // app.cash.redwood.widget/RedwoodView.windowInsets|{}windowInsets[0]
abstract fun <get-windowInsets>(): app.cash.redwood.ui/Margin // app.cash.redwood.widget/RedwoodView.windowInsets.<get-windowInsets>|<get-windowInsets>(){}[0]
abstract fun <set-windowInsets>(app.cash.redwood.ui/Margin) // app.cash.redwood.widget/RedwoodView.windowInsets.<set-windowInsets>|<set-windowInsets>(app.cash.redwood.ui.Margin){}[0]

abstract fun reset() // app.cash.redwood.widget/RedwoodView.reset|reset(){}[0]
}

Expand Down Expand Up @@ -127,6 +131,10 @@ open class app.cash.redwood.widget/RedwoodUIView : app.cash.redwood.widget/Redwo
open val uiConfiguration // app.cash.redwood.widget/RedwoodUIView.uiConfiguration|{}uiConfiguration[0]
open fun <get-uiConfiguration>(): kotlinx.coroutines.flow/StateFlow<app.cash.redwood.ui/UiConfiguration> // app.cash.redwood.widget/RedwoodUIView.uiConfiguration.<get-uiConfiguration>|<get-uiConfiguration>(){}[0]

open var windowInsets // app.cash.redwood.widget/RedwoodUIView.windowInsets|{}windowInsets[0]
open fun <get-windowInsets>(): app.cash.redwood.ui/Margin // app.cash.redwood.widget/RedwoodUIView.windowInsets.<get-windowInsets>|<get-windowInsets>(){}[0]
open fun <set-windowInsets>(app.cash.redwood.ui/Margin) // app.cash.redwood.widget/RedwoodUIView.windowInsets.<set-windowInsets>|<set-windowInsets>(app.cash.redwood.ui.Margin){}[0]

final fun updateUiConfiguration() // app.cash.redwood.widget/RedwoodUIView.updateUiConfiguration|updateUiConfiguration(){}[0]
open fun reset() // app.cash.redwood.widget/RedwoodUIView.reset|reset(){}[0]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ import android.widget.FrameLayout
import androidx.activity.OnBackPressedCallback as AndroidOnBackPressedCallback
import androidx.activity.OnBackPressedDispatcher as AndroidOnBackPressedDispatcher
import androidx.core.graphics.Insets
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.savedstate.findViewTreeSavedStateRegistryOwner
import app.cash.redwood.ui.Cancellable
import app.cash.redwood.ui.Density
import app.cash.redwood.ui.LayoutDirection
import app.cash.redwood.ui.Margin
import app.cash.redwood.ui.OnBackPressedCallback as RedwoodOnBackPressedCallback
import app.cash.redwood.ui.OnBackPressedDispatcher as RedwoodOnBackPressedDispatcher
import app.cash.redwood.ui.Size
Expand All @@ -48,7 +51,11 @@ public open class RedwoodLayout(
private val _children = ViewGroupChildren(this)
override val children: Widget.Children<View> get() = _children

private val mutableUiConfiguration = MutableStateFlow(computeUiConfiguration())
private val mutableUiConfiguration = MutableStateFlow(
computeUiConfiguration(
windowInsets = Margin.Zero,
),
)

override val onBackPressedDispatcher: RedwoodOnBackPressedDispatcher =
object : RedwoodOnBackPressedDispatcher {
Expand Down Expand Up @@ -77,6 +84,20 @@ public open class RedwoodLayout(
override val uiConfiguration: StateFlow<UiConfiguration>
get() = mutableUiConfiguration

override var windowInsets: Margin
get() = uiConfiguration.value.windowInsets
set(value) {
val old = uiConfiguration.value
mutableUiConfiguration.value = UiConfiguration(
darkMode = old.darkMode,
safeAreaInsets = old.safeAreaInsets,
windowInsets = value,
viewportSize = old.viewportSize,
density = old.density,
layoutDirection = old.layoutDirection,
)
}

override fun reset() {
_children.remove(0, _children.widgets.size)

Expand All @@ -86,24 +107,36 @@ public open class RedwoodLayout(

init {
setOnWindowInsetsChangeListener { insets ->
mutableUiConfiguration.value = computeUiConfiguration(insets = insets.safeDrawing)
val old = mutableUiConfiguration.value
mutableUiConfiguration.value = computeUiConfiguration(
safeAreaInsets = insets.safeDrawing,
windowInsets = old.windowInsets,
)
}
}

@SuppressLint("DrawAllocation") // It's only on layout.
override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) {
mutableUiConfiguration.value = computeUiConfiguration()
val old = mutableUiConfiguration.value
mutableUiConfiguration.value = computeUiConfiguration(
windowInsets = old.windowInsets,
)
super.onLayout(changed, left, top, right, bottom)
}

override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
mutableUiConfiguration.value = computeUiConfiguration(config = newConfig)
val old = mutableUiConfiguration.value
mutableUiConfiguration.value = computeUiConfiguration(
config = newConfig,
windowInsets = old.windowInsets,
)
}

private fun computeUiConfiguration(
config: Configuration = context.resources.configuration,
insets: Insets = rootWindowInsetsCompat.safeDrawing,
safeAreaInsets: Insets = rootWindowInsetsCompat.safeDrawing,
windowInsets: Margin,
): UiConfiguration {
val viewportSize: Size
val density: Double
Expand All @@ -113,7 +146,8 @@ public open class RedwoodLayout(
}
return UiConfiguration(
darkMode = (config.uiMode and Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES,
safeAreaInsets = insets.toMargin(Density(resources)),
safeAreaInsets = safeAreaInsets.toMargin(Density(resources)),
windowInsets = windowInsets,
viewportSize = viewportSize,
density = density,
layoutDirection = when (config.layoutDirection) {
Expand All @@ -123,6 +157,22 @@ public open class RedwoodLayout(
},
)
}

/**
* Consume the identified insets from the enclosing UI in the Redwood composition.
*
* This installs a `OnApplyWindowInsetsListener` on this view that updates [windowInsets] each
* time the window insets are updated.
*/
public fun consumeWindowInsets(
mask: Int = (WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.ime()),
) {
ViewCompat.setOnApplyWindowInsetsListener(this) { _, insets ->
val insetsForMask = insets.getInsets(mask)
windowInsets = insetsForMask.toMargin(Density(resources))
WindowInsetsCompat.CONSUMED
}
}
}

private fun RedwoodOnBackPressedCallback.toAndroid(): AndroidOnBackPressedCallback =
Expand Down
Loading
Loading