Skip to content

Commit a9acbd6

Browse files
committed
HabitCardListView: Prevent duplicate inset decorations
1 parent e121f46 commit a9acbd6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

uhabits-android/src/main/java/org/isoron/uhabits/activities/habits/list/views/HabitCardListView.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class HabitCardListView(
6060
) : RecyclerView(context, null, R.attr.scrollableRecyclerViewStyle) {
6161

6262
var checkmarkCount: Int = 0
63+
private var insetDecorationsAdded: Boolean = false
6364

6465
var dataOffset: Int = 0
6566
set(value) {
@@ -84,6 +85,8 @@ class HabitCardListView(
8485

8586
private fun applyBottomInset() {
8687
ViewCompat.setOnApplyWindowInsetsListener(this) { _, insets ->
88+
if (insetDecorationsAdded) return@setOnApplyWindowInsetsListener insets
89+
insetDecorationsAdded = true
8790
val systemBarsInsets = insets.getInsets(WindowInsetsCompat.Type.systemBars())
8891
addItemDecoration(object : ItemDecoration() {
8992
override fun getItemOffsets(

0 commit comments

Comments
 (0)