Skip to content

Commit

Permalink
Fix consume flag when using listener
Browse files Browse the repository at this point in the history
Fixes #102
  • Loading branch information
chrisbanes committed Mar 16, 2021
1 parent 2724d46 commit de19152
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions library/src/main/java/dev/chrisbanes/insetter/Insetter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,10 @@ 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 if (consume != CONSUME_NONE) insets
else WindowInsetsCompat.CONSUMED
return@setOnApplyWindowInsetsListener when (consume) {
CONSUME_NONE -> insets
else -> WindowInsetsCompat.CONSUMED
}
}

// Otherwise we applied through applyInsetsToView()
Expand Down

0 comments on commit de19152

Please sign in to comment.