mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-02-17 04:10:45 +01:00
fixing some rounding errors at the weekly view drawing
This commit is contained in:
parent
ea7f027b2a
commit
5666357d9f
@ -259,10 +259,12 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
||||
|
||||
private fun updateViewScale() {
|
||||
rowHeight = context!!.getWeeklyViewItemHeight()
|
||||
listener?.updateRowHeight(rowHeight.toInt())
|
||||
val fullHeight = Math.max(rowHeight.toInt() * 24, scrollView.height + context!!.resources.getDimension(R.dimen.one_dp).toInt())
|
||||
|
||||
val oneDp = context!!.resources.getDimension(R.dimen.one_dp).toInt()
|
||||
val fullHeight = Math.max(rowHeight.toInt() * 24, scrollView.height + oneDp)
|
||||
mView.week_horizontal_grid_holder.layoutParams.height = fullHeight
|
||||
mView.week_events_columns_holder.layoutParams.height = fullHeight
|
||||
listener?.updateRowHeight(rowHeight.toInt())
|
||||
addEvents(currEvents)
|
||||
}
|
||||
|
||||
@ -276,8 +278,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
||||
|
||||
addNewLine()
|
||||
|
||||
val fullHeight = rowHeight * 24
|
||||
val minuteHeight = fullHeight / (24 * 60)
|
||||
val minuteHeight = rowHeight / 60
|
||||
val minimalHeight = res.getDimension(R.dimen.weekly_view_minimal_event_height).toInt()
|
||||
val density = Math.round(res.displayMetrics.density)
|
||||
|
||||
|
@ -6,6 +6,7 @@ import android.graphics.Paint
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import com.simplemobiletools.calendar.pro.R
|
||||
import com.simplemobiletools.calendar.pro.extensions.getWeeklyViewItemHeight
|
||||
|
||||
class WeeklyViewGrid(context: Context, attrs: AttributeSet, defStyle: Int) : View(context, attrs, defStyle) {
|
||||
private val ROWS_CNT = 24
|
||||
@ -20,7 +21,7 @@ class WeeklyViewGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Vie
|
||||
|
||||
override fun onDraw(canvas: Canvas) {
|
||||
super.onDraw(canvas)
|
||||
val rowHeight = height / ROWS_CNT.toFloat()
|
||||
val rowHeight = context.getWeeklyViewItemHeight()
|
||||
for (i in 0 until ROWS_CNT) {
|
||||
val y = rowHeight * i.toFloat()
|
||||
canvas.drawLine(0f, y, width.toFloat(), y, paint)
|
||||
|
Loading…
x
Reference in New Issue
Block a user