one more correction to weekly view height

This commit is contained in:
tibbi 2017-02-04 15:00:20 +01:00
parent 1290883716
commit cc407072ee
1 changed files with 12 additions and 1 deletions

View File

@ -40,6 +40,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
private var primaryColor = 0
private var isFragmentVisible = false
private var wasFragmentInit = false
private var wasExtraHeightAdded = false
lateinit var mView: View
lateinit var mCalendar: WeeklyCalendarImpl
@ -84,9 +85,15 @@ class WeekFragment : Fragment(), WeeklyCalendar {
isFragmentVisible = menuVisible
if (isFragmentVisible && wasFragmentInit) {
(activity as MainActivity).updateHoursTopMargin(mView.week_top_holder.height)
checkScrollLimits(mView.week_events_scrollview.scrollY)
}
}
override fun onPause() {
super.onPause()
wasExtraHeightAdded = true
}
override fun onResume() {
super.onResume()
setupDayLabels()
@ -229,6 +236,9 @@ class WeekFragment : Fragment(), WeeklyCalendar {
if (isFragmentVisible) {
(activity as MainActivity).updateHoursTopMargin(mView.week_top_holder.height)
}
if (!wasExtraHeightAdded)
maxScrollY += mView.week_all_day_holder.height
}
})
}
@ -253,7 +263,8 @@ class WeekFragment : Fragment(), WeeklyCalendar {
}
fun updateScrollY(y: Int) {
mView.week_events_scrollview.scrollY = y
if (wasFragmentInit)
mView.week_events_scrollview.scrollY = y
}
interface WeekScrollListener {