Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Add CONSUME_AUTO support in Kotlin DSL #112

Merged
merged 2 commits into from
May 27, 2021
Merged
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
1 change: 1 addition & 0 deletions library/api/library.api
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public final class dev/chrisbanes/insetter/InsetterApplyTypeDsl {
}

public final class dev/chrisbanes/insetter/InsetterDsl {
public final fun consume (I)V
public final fun consume (Z)V
public final fun syncTranslationTo ([Landroid/view/View;)V
public final fun type (ILkotlin/jvm/functions/Function1;)V
Expand Down
9 changes: 9 additions & 0 deletions library/src/main/java/dev/chrisbanes/insetter/InsetterDsl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,15 @@ class InsetterDsl internal constructor() {
builder = builder.consume(if (consume) Insetter.CONSUME_ALL else Insetter.CONSUME_NONE)
}

/**
* @param consume how the window insets should be consumed.
* @see Insetter.Builder.consume
* @see Insetter.ConsumeOptions
*/
fun consume(@Insetter.ConsumeOptions consume: Int) {
builder = builder.consume(consume)
}

/**
* When reacting to window insets animations it is often useful to apply the same
* animated translation X and Y to other views. The views provided to this function
Expand Down