Skip to content

Commit 3960d4b

Browse files
committed
Fixes #5 highlighting of the current day.
1 parent d74c352 commit 3960d4b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

library/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ android {
1010
defaultConfig {
1111
minSdkVersion 16
1212
targetSdkVersion 28
13-
versionCode 4
14-
versionName "1.4.1"
13+
versionCode 5
14+
versionName "1.4.2"
1515

1616
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1717

library/src/main/java/de/tobiasschuerg/weekview/view/WeekBackgroundView.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ import de.tobiasschuerg.weekview.util.dipToPixelI
1313
import de.tobiasschuerg.weekview.util.toLocalString
1414
import org.threeten.bp.DayOfWeek
1515
import org.threeten.bp.Duration
16+
import org.threeten.bp.LocalDate
1617
import org.threeten.bp.LocalTime
1718
import org.threeten.bp.format.TextStyle
1819
import org.threeten.bp.temporal.ChronoUnit
19-
import org.threeten.bp.temporal.WeekFields
2020
import java.util.Locale
2121
import kotlin.math.roundToInt
2222

@@ -125,7 +125,7 @@ internal class WeekBackgroundView constructor(context: Context) : View(context)
125125

126126
private fun Canvas.drawColumnsWithHeaders() {
127127
Log.v(TAG, "Drawing vertical dividers on canvas")
128-
val todayDay: DayOfWeek = WeekFields.of(Locale.getDefault()).firstDayOfWeek
128+
val todayDay: DayOfWeek = LocalDate.now().dayOfWeek
129129
for ((column, dayId) in days.withIndex()) {
130130
drawLeftColumnDivider(column)
131131
drawWeekDayName(dayId, column)
@@ -191,7 +191,7 @@ internal class WeekBackgroundView constructor(context: Context) : View(context)
191191

192192
override fun onMeasure(widthMeasureSpec: Int, hms: Int) {
193193
val height = topOffsetPx + context.dipToPixelF(getDurationMinutes() * scalingFactor) + paddingBottom
194-
val heightMeasureSpec2 = View.MeasureSpec.makeMeasureSpec(height.roundToInt(), View.MeasureSpec.EXACTLY)
194+
val heightMeasureSpec2 = MeasureSpec.makeMeasureSpec(height.roundToInt(), MeasureSpec.EXACTLY)
195195
super.onMeasure(widthMeasureSpec, heightMeasureSpec2)
196196
}
197197

0 commit comments

Comments
 (0)