[Timetable] Fix showing "no timetable" when all nearest lessons are cancelled. Fix a crash in timetable fragment.

This commit is contained in:
Kuba Szczodrzyński 2020-03-10 22:01:30 +01:00
parent ae89b33fb7
commit df1a241b2b
3 changed files with 6 additions and 4 deletions

View File

@ -166,8 +166,8 @@ class HomeTimetableCard(
&& !(it.isCancelled && ignoreCancelled) && !(it.isCancelled && ignoreCancelled)
} }
if (lessons.isEmpty() && timetableDate.weekDay <= 5) //if (lessons.isEmpty() && timetableDate.weekDay <= 5)
break // break
checkedDays++ checkedDays++
} }

View File

@ -124,6 +124,8 @@ class TimetableFragment : Fragment(), CoroutineScope {
endHour = lessonRanges.map { it.endTime.hour }.max()?.plus(1) ?: DEFAULT_END_HOUR endHour = lessonRanges.map { it.endTime.hour }.max()?.plus(1) ?: DEFAULT_END_HOUR
} }
deferred.await() deferred.await()
if (!isAdded)
return@launch
val pagerAdapter = TimetablePagerAdapter( val pagerAdapter = TimetablePagerAdapter(
fragmentManager ?: return@launch, fragmentManager ?: return@launch,

View File

@ -229,8 +229,8 @@ class WidgetTimetableProvider : AppWidgetProvider() {
&& !(it.isCancelled && ignoreCancelled) && !(it.isCancelled && ignoreCancelled)
} }
if (lessons.isEmpty() && timetableDate.weekDay <= 5) //if (lessons.isEmpty() && timetableDate.weekDay <= 5)
break // break
checkedDays++ checkedDays++
} }