diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/v2/day/TimetableDayFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/v2/day/TimetableDayFragment.kt index 4642aa9e..dc4f4d76 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/v2/day/TimetableDayFragment.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/v2/day/TimetableDayFragment.kt @@ -12,6 +12,8 @@ import androidx.fragment.app.Fragment import androidx.lifecycle.Observer import com.linkedin.android.tachyon.DayView import pl.szczodrzynski.edziennik.* +import pl.szczodrzynski.edziennik.MainActivity.Companion.DRAWER_ITEM_TIMETABLE +import pl.szczodrzynski.edziennik.api.v2.LOGIN_TYPE_LIBRUS import pl.szczodrzynski.edziennik.api.v2.events.task.EdziennikTask import pl.szczodrzynski.edziennik.data.db.modules.timetable.Lesson import pl.szczodrzynski.edziennik.data.db.modules.timetable.LessonFull @@ -69,6 +71,9 @@ class TimetableDayFragment(val date: Date) : Fragment() { b.noTimetableSync.setOnClickListener { EdziennikTask.syncProfile( profileId = App.profileId, + viewIds = listOf( + DRAWER_ITEM_TIMETABLE to 0 + ), arguments = JsonObject( "weekStart" to date.clone().stepForward(0, 0, -date.weekDay).stringY_m_d ) @@ -83,6 +88,13 @@ class TimetableDayFragment(val date: Date) : Fragment() { return } + // reload the fragment when: no lessons, user wants to sync the week, the timetable is not public, pager gets removed + if (app.profile.loginStoreType == LOGIN_TYPE_LIBRUS && app.profile.getLoginData("timetableNotPublic", false)) { + activity.reloadTarget() + // TODO fix for (not really)possible infinite loops + return + } + b.dayScroll.visibility = View.VISIBLE b.noTimetableLayout.visibility = View.GONE b.noLessonsLayout.visibility = View.GONE