Closed EdricChan03 closed 1 month ago
The DSL logic for setting items/other related state should instead be handled on the consumer's end rather than the fragment itself, i.e. only passing in a hard-coded list of items.
https://github.com/EdricChan03/studybuddy-android/blob/2b56189da613569f683f4ba7d28634701e3bb056/ui/widgets/modal-bottom-sheet/src/main/kotlin/com/edricchan/studybuddy/ui/widgets/modalbottomsheet/views/ModalBottomSheetFragment.kt#L69-L133
The methods above should be removed entirely, utilising Fragment arguments instead:
Fragment
class ModalBottomSheetFragment { companion object { fun newInstance( items: List<ModalBottomSheetItem>, headerTitle: String? = null, hideDragHandle: Boolean = false ) = ModalBottomSheetFragment().apply { arguments = bundleOf( TAG_ITEMS to items, // etc ) } } }
Which can then be retrieved using the Fragment arguments:
class ModalBottomSheetFragment { val items get() = arguments?.getParcelableArrayList(...) // etc }
We would need to phase out the existing APIs however 🙃
See also #737
The DSL logic for setting items/other related state should instead be handled on the consumer's end rather than the fragment itself, i.e. only passing in a hard-coded list of items.
https://github.com/EdricChan03/studybuddy-android/blob/2b56189da613569f683f4ba7d28634701e3bb056/ui/widgets/modal-bottom-sheet/src/main/kotlin/com/edricchan/studybuddy/ui/widgets/modalbottomsheet/views/ModalBottomSheetFragment.kt#L69-L133
The methods above should be removed entirely, utilising
Fragment
arguments instead:Which can then be retrieved using the
Fragment
arguments:We would need to phase out the existing APIs however 🙃
See also #737