Converted all bottom sheets to use blank constructors and instead rely on bundles to retrieve data/objects, or custom view models to execute functions

This commit is contained in:
denizk0461
2023-05-02 15:02:47 +02:00
parent 5a9ab267aa
commit 2f4b205703
23 changed files with 491 additions and 314 deletions
@@ -74,7 +74,6 @@ class EventPageFragment : AppFragment(), StudIPEventItemAdapter.OnClickListener
// Set up LiveData observer to refresh the view on update
viewModel.getEventsForDay(currentDay).observe(viewLifecycleOwner) { events ->
eventAdapter.setNewData(events)
}
}
@@ -85,11 +84,13 @@ class EventPageFragment : AppFragment(), StudIPEventItemAdapter.OnClickListener
override fun onLongClick(event: StudIPEvent): Boolean {
// Open a bottom sheet to edit the event
openBottomSheet(ScheduleUpdateSheet(event, onUpdate = { eventToUpdate ->
viewModel.update(eventToUpdate)
}, onDelete = { eventToDelete ->
viewModel.delete(eventToDelete)
}))
openBottomSheet(
ScheduleUpdateSheet().also { sheet ->
val bundle = Bundle()
bundle.putParcelable("event", event)
sheet.arguments = bundle
}
)
return true
}
}