HabitCardListView: Prevent duplicate inset decorations
This commit is contained in:
parent
e121f46b61
commit
a9acbd6cab
@ -60,6 +60,7 @@ class HabitCardListView(
|
||||
) : RecyclerView(context, null, R.attr.scrollableRecyclerViewStyle) {
|
||||
|
||||
var checkmarkCount: Int = 0
|
||||
private var insetDecorationsAdded: Boolean = false
|
||||
|
||||
var dataOffset: Int = 0
|
||||
set(value) {
|
||||
@ -84,6 +85,8 @@ class HabitCardListView(
|
||||
|
||||
private fun applyBottomInset() {
|
||||
ViewCompat.setOnApplyWindowInsetsListener(this) { _, insets ->
|
||||
if (insetDecorationsAdded) return@setOnApplyWindowInsetsListener insets
|
||||
insetDecorationsAdded = true
|
||||
val systemBarsInsets = insets.getInsets(WindowInsetsCompat.Type.systemBars())
|
||||
addItemDecoration(object : ItemDecoration() {
|
||||
override fun getItemOffsets(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user