chrisbanes / insetter

Insetter is a library to help apps handle WindowInsets more easily
https://chrisbanes.github.io/insetter
Apache License 2.0
1.13k stars 42 forks source link

Request: CONSUME_AUTO support in Kotlin DSL #104

Closed SteinerOk closed 3 years ago

SteinerOk commented 3 years ago

Right now using Kotlin DSL possible only if I use consume with boolean arg, like this:

view.applyInsetter {
    consume(false)
}

witch equals CONSUME_ALL or CONSUME_NONE, but in some cases I need CONSUME_AUTO, like this:

        Insetter.builder()
            .applySystemWindowInsetsToPadding(Side.RIGHT or Side.LEFT)
            .consumeSystemWindowInsets(Insetter.CONSUME_AUTO)
            .applyToView(view)

and is impossible with Kotlin DSL :(

SteinerOk commented 3 years ago

@chrisbanes I think easy way to solve it - just add this function to InsetterDsl:

fun consume(@ConsumeOptions consume: Int) {
    builder = builder.consume(consume)
}