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,
|
profileName = profileName,
|
||||||
viewId = DRAWER_ITEM_TIMETABLE,
|
viewId = DRAWER_ITEM_TIMETABLE,
|
||||||
addedDate = lesson.addedDate
|
addedDate = lesson.addedDate
|
||||||
).addExtra("timetableDate", lesson.displayDate?.value?.toLong())
|
).addExtra("timetableDate", lesson.displayDate?.stringY_m_d ?: "")
|
||||||
}
|
}
|
||||||
|
|
||||||
for (event in app.db.eventDao().getNotNotifiedNow(profileId)) {
|
for (event in app.db.eventDao().getNotNotifiedNow(profileId)) {
|
||||||
|
@ -120,7 +120,7 @@ class LessonDetailsDialog(
|
|||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
val dateStr = otherLessonDate?.stringY_m_d ?: return@setOnClickListener
|
val dateStr = otherLessonDate?.stringY_m_d ?: return@setOnClickListener
|
||||||
val intent = Intent(TimetableFragment.ACTION_SCROLL_TO_DATE).apply {
|
val intent = Intent(TimetableFragment.ACTION_SCROLL_TO_DATE).apply {
|
||||||
putExtra("date", dateStr)
|
putExtra("timetableDate", dateStr)
|
||||||
}
|
}
|
||||||
activity.sendBroadcast(intent)
|
activity.sendBroadcast(intent)
|
||||||
}
|
}
|
||||||
@ -157,4 +157,4 @@ class LessonDetailsDialog(
|
|||||||
b.teamName = lesson.teamName
|
b.teamName = lesson.teamName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ class TimetableFragment : Fragment(), CoroutineScope {
|
|||||||
override fun onReceive(context: Context, i: Intent) {
|
override fun onReceive(context: Context, i: Intent) {
|
||||||
if (!isAdded)
|
if (!isAdded)
|
||||||
return
|
return
|
||||||
val dateStr = i.extras?.getString("date", null) ?: return
|
val dateStr = i.extras?.getString("timetableDate", null) ?: return
|
||||||
val date = Date.fromY_m_d(dateStr)
|
val date = Date.fromY_m_d(dateStr)
|
||||||
b.viewPager.setCurrentItem(items.indexOf(date), true)
|
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.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(
|
activity.navView.bottomSheet.prependItems(
|
||||||
BottomSheetPrimaryItem(true)
|
BottomSheetPrimaryItem(true)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user