fix(MarkableTimeBar): align segments to timebar (#7055)

Due to a error in the timebar position calculation, segments could
be msialigned by a pixel. This is fixed by using a caculation that more
closely matches how the actual timebar is drawn.
This commit is contained in:
Bnyro 2025-02-17 21:07:32 +01:00 committed by GitHub
commit 47c3bf0ffe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -38,7 +38,7 @@ class MarkableTimeBar(
canvas.save()
val horizontalOffset = (parent as View).marginLeft
length = canvas.width - horizontalOffset * 2
val marginY = canvas.height / 2 - progressBarHeight / 2
val marginY = (canvas.height - progressBarHeight) / 2
val themeColor = ThemeHelper.getThemeColor(context, R.attr.colorOnSecondary)
segments.forEach {
@ -49,7 +49,7 @@ class MarkableTimeBar(
start.toLength() + horizontalOffset,
marginY,
end.toLength() + horizontalOffset,
canvas.height - marginY
marginY + progressBarHeight
),
Paint().apply {
color = if (PreferenceHelper.getBoolean("sb_enable_custom_colors", false)) {