forked from github/szkolny
[Timetable] Change date
receiver argument to timetableDate
.
This commit is contained in:
parent
285b7e9b9e
commit
d274a2fed1
@ -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)) {
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user