diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt index e1044b372..e146f7d8b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt @@ -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) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/WeeklyViewGrid.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/WeeklyViewGrid.kt index 4b7db7db5..f4d1ee6a1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/WeeklyViewGrid.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/views/WeeklyViewGrid.kt @@ -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)