adding an extra check to avoid scrollview stucking at max zoom out

This commit is contained in:
tibbi 2020-03-23 22:37:52 +01:00
parent 843f901e5b
commit 19d2a16cf5
1 changed files with 5 additions and 1 deletions

View File

@ -74,9 +74,9 @@ class WeekFragment : Fragment(), WeeklyCalendar {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
this.inflater = inflater
val fullHeight = context!!.getWeeklyViewItemHeight().toInt() * 24
mView = inflater.inflate(R.layout.fragment_week, container, false).apply {
scrollView = week_events_scrollview
val fullHeight = context.getWeeklyViewItemHeight().toInt() * 24
week_horizontal_grid_holder.layoutParams.height = fullHeight
week_events_columns_holder.layoutParams.height = fullHeight
@ -94,6 +94,10 @@ class WeekFragment : Fragment(), WeeklyCalendar {
})
scrollView.onGlobalLayout {
if (fullHeight < scrollView.height) {
scrollView.layoutParams.height = fullHeight - context!!.resources.getDimension(R.dimen.one_dp).toInt()
}
val initialScrollY = (rowHeight * config.startWeeklyAt).toInt()
updateScrollY(Math.max(listener?.getCurrScrollY() ?: 0, initialScrollY))
}