diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/DataNotifications.kt b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/DataNotifications.kt index 6dd29ccd..12c10dcd 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/DataNotifications.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/api/v2/DataNotifications.kt @@ -55,7 +55,7 @@ class DataNotifications(val data: Data) { profileName = profileName, viewId = DRAWER_ITEM_TIMETABLE, addedDate = lesson.addedDate - ).addExtra("timetableDate", lesson.displayDate?.value?.toLong()) + ).addExtra("timetableDate", lesson.displayDate?.stringY_m_d ?: "") } for (event in app.db.eventDao().getNotNotifiedNow(profileId)) { diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/timetable/LessonDetailsDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/timetable/LessonDetailsDialog.kt index 05de34ea..46464fc1 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/timetable/LessonDetailsDialog.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/timetable/LessonDetailsDialog.kt @@ -120,7 +120,7 @@ class LessonDetailsDialog( dialog.dismiss() val dateStr = otherLessonDate?.stringY_m_d ?: return@setOnClickListener val intent = Intent(TimetableFragment.ACTION_SCROLL_TO_DATE).apply { - putExtra("date", dateStr) + putExtra("timetableDate", dateStr) } activity.sendBroadcast(intent) } @@ -157,4 +157,4 @@ class LessonDetailsDialog( b.teamName = lesson.teamName } } -} \ No newline at end of file +} diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/v2/TimetableFragment.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/v2/TimetableFragment.kt index 3362cb54..5944f591 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/v2/TimetableFragment.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/timetable/v2/TimetableFragment.kt @@ -67,7 +67,7 @@ class TimetableFragment : Fragment(), CoroutineScope { override fun onReceive(context: Context, i: Intent) { if (!isAdded) return - val dateStr = i.extras?.getString("date", null) ?: return + val dateStr = i.extras?.getString("timetableDate", null) ?: return val date = Date.fromY_m_d(dateStr) b.viewPager.setCurrentItem(items.indexOf(date), true) } @@ -155,10 +155,10 @@ class TimetableFragment : Fragment(), CoroutineScope { } }) - val selectedDate = arguments?.getLong("timetableDate", -1)?.let { if (it == -1L) null else it.toInt() } + val selectedDate = arguments?.getString("timetableDate", "")?.let { if (it.isBlank()) null else Date.fromY_m_d(it) } b.tabLayout.setUpWithViewPager(b.viewPager) - b.tabLayout.setCurrentItem(items.indexOfFirst { it.value == selectedDate ?: today }, false) + b.tabLayout.setCurrentItem(items.indexOfFirst { it.value == selectedDate?.value ?: today }, false) activity.navView.bottomSheet.prependItems( BottomSheetPrimaryItem(true)