mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-01-27 17:09:19 +01:00
couple weekly view scrolling related fixes
This commit is contained in:
parent
90168af9f4
commit
1290883716
@ -261,6 +261,7 @@ class MainActivity : SimpleActivity(), EventListFragment.DeleteListener {
|
||||
weeklyAdapter.updateScrollY(week_view_view_pager.currentItem, y)
|
||||
}
|
||||
})
|
||||
week_view_hours_scrollview.setOnTouchListener({ view, motionEvent -> true })
|
||||
}
|
||||
|
||||
fun updateHoursTopMargin(margin: Int) {
|
||||
|
@ -27,7 +27,7 @@ class MyWeekPagerAdapter(fm: FragmentManager, val mWeekTimestamps: List<Int>, va
|
||||
}
|
||||
|
||||
fun updateScrollY(pos: Int, y: Int) {
|
||||
(-1..1).map { mFragments[pos + it] }
|
||||
.forEach { it?.updateScrollY(y) }
|
||||
mFragments[pos - 1].updateScrollY(y)
|
||||
mFragments[pos + 1].updateScrollY(y)
|
||||
}
|
||||
}
|
||||
|
@ -60,8 +60,8 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
||||
|
||||
week_events_scrollview.viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener {
|
||||
override fun onGlobalLayout() {
|
||||
updateScrollY(Math.max(MainActivity.mWeekScrollY, minScrollY))
|
||||
week_events_scrollview.viewTreeObserver.removeOnGlobalLayoutListener(this)
|
||||
updateScrollY(Math.max(MainActivity.mWeekScrollY, minScrollY))
|
||||
}
|
||||
})
|
||||
|
||||
@ -145,7 +145,8 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
||||
} else if (maxScrollY != -1 && y > maxScrollY) {
|
||||
mView.week_events_scrollview.scrollY = maxScrollY
|
||||
} else {
|
||||
mListener?.scrollTo(y)
|
||||
if (isFragmentVisible)
|
||||
mListener?.scrollTo(y)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user