fixing some offset glitches at the yearly view

This commit is contained in:
tibbi 2020-05-17 10:38:04 +02:00
parent fbad874f5d
commit 3f9bbb443f
1 changed files with 5 additions and 5 deletions

View File

@ -41,9 +41,9 @@ class SmallMonthView(context: Context, attrs: AttributeSet, defStyle: Int) : Vie
init {
val attributes = context.theme.obtainStyledAttributes(
attrs,
R.styleable.SmallMonthView,
0, 0)
attrs,
R.styleable.SmallMonthView,
0, 0)
try {
days = attributes.getInt(R.styleable.SmallMonthView_days, 31)
@ -79,11 +79,11 @@ class SmallMonthView(context: Context, attrs: AttributeSet, defStyle: Int) : Vie
for (y in 1..6) {
for (x in 1..7) {
if (curId in 1..days) {
canvas.drawText(curId.toString(), x * dayWidth, y * dayWidth, getPaint(curId))
canvas.drawText(curId.toString(), x * dayWidth - (dayWidth / 4), y * dayWidth, getPaint(curId))
if (curId == todaysId) {
val dividerConstant = if (isLandscape) 6 else 4
canvas.drawCircle(x * dayWidth - dayWidth / dividerConstant, y * dayWidth - dayWidth / dividerConstant, dayWidth * 0.41f, todayCirclePaint)
canvas.drawCircle(x * dayWidth - dayWidth / 2, y * dayWidth - dayWidth / dividerConstant, dayWidth * 0.41f, todayCirclePaint)
}
}
curId++