fixing some offset glitches at the yearly view
This commit is contained in:
parent
fbad874f5d
commit
3f9bbb443f
|
@ -41,9 +41,9 @@ class SmallMonthView(context: Context, attrs: AttributeSet, defStyle: Int) : Vie
|
||||||
|
|
||||||
init {
|
init {
|
||||||
val attributes = context.theme.obtainStyledAttributes(
|
val attributes = context.theme.obtainStyledAttributes(
|
||||||
attrs,
|
attrs,
|
||||||
R.styleable.SmallMonthView,
|
R.styleable.SmallMonthView,
|
||||||
0, 0)
|
0, 0)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
days = attributes.getInt(R.styleable.SmallMonthView_days, 31)
|
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 (y in 1..6) {
|
||||||
for (x in 1..7) {
|
for (x in 1..7) {
|
||||||
if (curId in 1..days) {
|
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) {
|
if (curId == todaysId) {
|
||||||
val dividerConstant = if (isLandscape) 6 else 4
|
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++
|
curId++
|
||||||
|
|
Loading…
Reference in New Issue