adding some null checks at refreshing main viewpager

This commit is contained in:
tibbi 2017-10-11 21:25:01 +02:00
parent 5d57eea81c
commit 91ed5dbafe
1 changed files with 3 additions and 3 deletions

View File

@ -318,10 +318,10 @@ class MainActivity : SimpleActivity(), NavigationListener {
private fun refreshViewPager() {
when {
config.storedView == YEARLY_VIEW -> (main_view_pager.adapter as MyYearPagerAdapter).refreshEvents(main_view_pager.currentItem)
config.storedView == YEARLY_VIEW -> (main_view_pager.adapter as? MyYearPagerAdapter)?.refreshEvents(main_view_pager.currentItem)
config.storedView == EVENTS_LIST_VIEW -> fillEventsList()
config.storedView == WEEKLY_VIEW -> (week_view_view_pager.adapter as MyWeekPagerAdapter).refreshEvents(week_view_view_pager.currentItem)
else -> (main_view_pager.adapter as MyMonthPagerAdapter).refreshEvents(main_view_pager.currentItem)
config.storedView == WEEKLY_VIEW -> (week_view_view_pager.adapter as? MyWeekPagerAdapter)?.refreshEvents(week_view_view_pager.currentItem)
else -> (main_view_pager.adapter as? MyMonthPagerAdapter)?.refreshEvents(main_view_pager.currentItem)
}
}