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

Commit

Permalink
Allow consuming of insets when using setOnApplyInsetsListener (#89)
Browse files Browse the repository at this point in the history
* Typo
* Improve setOnApplyInsetsListener allowing to consume insets by itself
* Use Insetter consume option when using setOnApplyInsetsListener as well
* Fix code style
* Fix test warnings
  • Loading branch information
SamYStudiO authored Jan 21, 2021
1 parent 05310d4 commit 9b1eed5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion library/src/main/java/dev/chrisbanes/insetter/Insetter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,8 @@ class Insetter private constructor(builder: Builder) {
// If we have an onApplyInsetsListener, invoke it
onApplyInsetsListener.onApplyInsets(v, insets, initialState)
// We don't know what sides have been applied, so we assume all
return@setOnApplyWindowInsetsListener WindowInsetsCompat.CONSUMED
return@setOnApplyWindowInsetsListener if (consume != CONSUME_NONE) insets
else WindowInsetsCompat.CONSUMED
}

// Otherwise we applied through applyInsetsToView()
Expand Down
2 changes: 1 addition & 1 deletion library/src/main/java/dev/chrisbanes/insetter/Types.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package dev.chrisbanes.insetter
import androidx.core.view.WindowInsetsCompat

/**
* Convenienve function for building a combination of [WindowInsetsCompat.Type] values.
* Convenience function for building a combination of [WindowInsetsCompat.Type] values.
*/
fun windowInsetTypesOf(
ime: Boolean = false,
Expand Down

0 comments on commit 9b1eed5

Please sign in to comment.