add a couple null checks to viewpager pages
This commit is contained in:
parent
539d1ba3d7
commit
daffc7fc1d
|
@ -30,7 +30,7 @@ class MyDayPagerAdapter(fm: FragmentManager, private val mCodes: List<String>, p
|
|||
|
||||
fun checkDayEvents(pos: Int) {
|
||||
for (i in -1..1) {
|
||||
mFragments[pos + i].checkEvents()
|
||||
mFragments[pos + i]?.checkEvents()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ class MyMonthPagerAdapter(fm: FragmentManager, private val mCodes: List<String>,
|
|||
|
||||
fun refreshEvents(pos: Int) {
|
||||
for (i in -1..1) {
|
||||
mFragments[pos + i].updateCalendar()
|
||||
mFragments[pos + i]?.updateCalendar()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,13 +27,13 @@ class MyWeekPagerAdapter(fm: FragmentManager, val mWeekTimestamps: List<Int>, va
|
|||
}
|
||||
|
||||
fun updateScrollY(pos: Int, y: Int) {
|
||||
mFragments[pos - 1].updateScrollY(y)
|
||||
mFragments[pos + 1].updateScrollY(y)
|
||||
mFragments[pos - 1]?.updateScrollY(y)
|
||||
mFragments[pos + 1]?.updateScrollY(y)
|
||||
}
|
||||
|
||||
fun refreshEvents(pos: Int) {
|
||||
for (i in -1..1) {
|
||||
mFragments[pos + i].updateEvents()
|
||||
mFragments[pos + i]?.updateEvents()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ class MyYearPagerAdapter(fm: FragmentManager, val mYears: List<Int>, val mListen
|
|||
|
||||
fun refreshEvents(pos: Int) {
|
||||
for (i in -1..1) {
|
||||
mFragments[pos + i].updateEvents()
|
||||
mFragments[pos + i]?.updateEvents()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue