mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2025-01-31 13:48:20 +01:00
[Agenda] Try to fix agenda fragment not attached crashes.
This commit is contained in:
parent
acd5e9b998
commit
930813fb8a
@ -126,6 +126,8 @@ class AgendaFragment : Fragment(), CoroutineScope {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun createDefaultAgendaView() { (b as? FragmentAgendaDefaultBinding)?.let { b -> launch {
|
private fun createDefaultAgendaView() { (b as? FragmentAgendaDefaultBinding)?.let { b -> launch {
|
||||||
|
if (!isAdded)
|
||||||
|
return@launch
|
||||||
delay(500)
|
delay(500)
|
||||||
|
|
||||||
val eventList = mutableListOf<CalendarEvent>()
|
val eventList = mutableListOf<CalendarEvent>()
|
||||||
@ -139,6 +141,8 @@ class AgendaFragment : Fragment(), CoroutineScope {
|
|||||||
/**
|
/**
|
||||||
* LESSON CHANGES
|
* LESSON CHANGES
|
||||||
*/
|
*/
|
||||||
|
if (!isAdded)
|
||||||
|
return@launch
|
||||||
|
|
||||||
val lessons = withContext(Dispatchers.Default) { app.db.timetableDao().getAllChangesNow(app.profileId) }
|
val lessons = withContext(Dispatchers.Default) { app.db.timetableDao().getAllChangesNow(app.profileId) }
|
||||||
val lessonChangeCounters = mutableListOf<LessonChangeCounter>()
|
val lessonChangeCounters = mutableListOf<LessonChangeCounter>()
|
||||||
@ -170,6 +174,8 @@ class AgendaFragment : Fragment(), CoroutineScope {
|
|||||||
/**
|
/**
|
||||||
* TEACHER ABSENCES
|
* TEACHER ABSENCES
|
||||||
*/
|
*/
|
||||||
|
if (!isAdded)
|
||||||
|
return@launch
|
||||||
|
|
||||||
val showTeacherAbsences = app.profile.getStudentData("showTeacherAbsences", true)
|
val showTeacherAbsences = app.profile.getStudentData("showTeacherAbsences", true)
|
||||||
|
|
||||||
@ -208,6 +214,8 @@ class AgendaFragment : Fragment(), CoroutineScope {
|
|||||||
/**
|
/**
|
||||||
* EVENTS
|
* EVENTS
|
||||||
*/
|
*/
|
||||||
|
if (!isAdded)
|
||||||
|
return@launch
|
||||||
|
|
||||||
val events = withContext(Dispatchers.Default) { app.db.eventDao().getAllNow(app.profileId) }
|
val events = withContext(Dispatchers.Default) { app.db.eventDao().getAllNow(app.profileId) }
|
||||||
val unreadEventDates = mutableSetOf<Int>()
|
val unreadEventDates = mutableSetOf<Int>()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user