fix monthly view grid with visible week numbers
This commit is contained in:
parent
b28b35cc40
commit
15719b6430
|
@ -46,7 +46,7 @@ ext {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:3.18.19'
|
||||
implementation 'com.simplemobiletools:commons:3.18.22'
|
||||
implementation 'joda-time:joda-time:2.9.9'
|
||||
implementation 'com.facebook.stetho:stetho:1.5.0'
|
||||
implementation 'com.android.support:multidex:1.0.3'
|
||||
|
|
|
@ -151,10 +151,16 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con
|
|||
}
|
||||
|
||||
private fun drawGrid(canvas: Canvas) {
|
||||
// vertical lines
|
||||
for (i in 0..6) {
|
||||
canvas.drawLine(i * dayWidth, 0f, i * dayWidth, canvas.height.toFloat(), gridPaint)
|
||||
var lineX = i * dayWidth
|
||||
if (showWeekNumbers) {
|
||||
lineX += horizontalOffset
|
||||
}
|
||||
canvas.drawLine(lineX, 0f, lineX, canvas.height.toFloat(), gridPaint)
|
||||
}
|
||||
|
||||
// horizontal lines
|
||||
canvas.drawLine(0f, 0f, canvas.width.toFloat(), 0f, gridPaint)
|
||||
for (i in 0..5) {
|
||||
canvas.drawLine(0f, i * dayHeight + weekDaysLetterHeight, canvas.width.toFloat(), i * dayHeight + weekDaysLetterHeight, gridPaint)
|
||||
|
@ -182,7 +188,7 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con
|
|||
val id = "$weekOfYear:"
|
||||
|
||||
val yPos = i * dayHeight + weekDaysLetterHeight
|
||||
canvas.drawText(id, horizontalOffset.toFloat(), yPos + paint.textSize, weekNumberPaint)
|
||||
canvas.drawText(id, horizontalOffset.toFloat() * 0.9f, yPos + paint.textSize, weekNumberPaint)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue