Skip to content

Commit fa670b1

Browse files
committed
HabitCardView: Fix confetti position in API 36+
1 parent 45b100a commit fa670b1

File tree

1 file changed

+7
-1
lines changed
  • uhabits-android/src/main/java/org/isoron/uhabits/activities/habits/list/views

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,15 @@ class HabitCardView(
234234
val containerLocation = IntArray(2)
235235
this.getLocationOnScreen(containerLocation)
236236
val relButtonLocation = getRelativeButtonLocation(timestamp)
237+
val windowInsets = rootWindowInsets
238+
val statusBarHeight = if (SDK_INT <= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
239+
windowInsets?.systemWindowInsetTop ?: 0
240+
} else {
241+
0
242+
}
237243
return PointF(
238244
containerLocation[0].toFloat() + relButtonLocation.x,
239-
containerLocation[1].toFloat() - relButtonLocation.y
245+
containerLocation[1].toFloat() + relButtonLocation.y - statusBarHeight
240246
)
241247
}
242248

0 commit comments

Comments
 (0)