adding some type checks at updating viepager fragments

This commit is contained in:
tibbi 2018-05-27 14:35:12 +02:00
parent 8005fe1fae
commit 3a95fe601b

View File

@ -39,14 +39,14 @@ class ViewPagerAdapter(fm: FragmentManager) : FragmentStatePagerAdapter(fm) {
} }
fun updateClockTabAlarm() { fun updateClockTabAlarm() {
(fragments[TAB_CLOCK] as ClockFragment).updateAlarm() (fragments[TAB_CLOCK] as? ClockFragment)?.updateAlarm()
} }
fun updateAlarmTabAlarmSound(alarmSound: AlarmSound) { fun updateAlarmTabAlarmSound(alarmSound: AlarmSound) {
(fragments[TAB_ALARM] as AlarmFragment).updateAlarmSound(alarmSound) (fragments[TAB_ALARM] as? AlarmFragment)?.updateAlarmSound(alarmSound)
} }
fun updateTimerTabAlarmSound(alarmSound: AlarmSound) { fun updateTimerTabAlarmSound(alarmSound: AlarmSound) {
(fragments[TAB_TIMER] as TimerFragment).updateAlarmSound(alarmSound) (fragments[TAB_TIMER] as? TimerFragment)?.updateAlarmSound(alarmSound)
} }
} }