use a local variable for accessing resources on the weekly view

This commit is contained in:
tibbi 2020-06-09 16:33:49 +02:00
parent 0f51133e6d
commit 60cfe182e1
1 changed files with 2 additions and 2 deletions

View File

@ -116,7 +116,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
scrollView.onGlobalLayout { scrollView.onGlobalLayout {
if (fullHeight < scrollView.height) { if (fullHeight < scrollView.height) {
scrollView.layoutParams.height = fullHeight - context!!.resources.getDimension(R.dimen.one_dp).toInt() scrollView.layoutParams.height = fullHeight - res.getDimension(R.dimen.one_dp).toInt()
} }
val initialScrollY = (rowHeight * config.startWeeklyAt).toInt() val initialScrollY = (rowHeight * config.startWeeklyAt).toInt()
@ -350,7 +350,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
private fun updateViewScale() { private fun updateViewScale() {
rowHeight = context?.getWeeklyViewItemHeight() ?: return rowHeight = context?.getWeeklyViewItemHeight() ?: return
val oneDp = context!!.resources.getDimension(R.dimen.one_dp).toInt() val oneDp = res.getDimension(R.dimen.one_dp).toInt()
val fullHeight = Math.max(rowHeight.toInt() * 24, scrollView.height + oneDp) val fullHeight = Math.max(rowHeight.toInt() * 24, scrollView.height + oneDp)
scrollView.layoutParams.height = fullHeight - oneDp scrollView.layoutParams.height = fullHeight - oneDp
mView.week_horizontal_grid_holder.layoutParams.height = fullHeight mView.week_horizontal_grid_holder.layoutParams.height = fullHeight