Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a9b6beb8 authored by Ioana Alexandru's avatar Ioana Alexandru
Browse files

Set the footer on the NSSL in the binder.

Turns out this part got lost on the way in the previous CL...

Test: running e2e tests in another CL with the flag on
Bug: 293167744
Flag: ACONFIG com.android.systemui.notifications_footer_view_refactor DEVELOPMENT
Change-Id: I9f935a4c59923044a3beafaacdb6b3a9ced79035
parent 82516899
Loading
Loading
Loading
Loading
+39 −8
Original line number Diff line number Diff line
@@ -44,31 +44,62 @@ object NotificationListViewBinder {
        falsingManager: FalsingManager,
        iconAreaController: NotificationIconAreaController,
        shelfIconViewStore: ShelfNotificationIconViewStore,
    ) {
        bindShelf(
            view,
            viewModel,
            configuration,
            configurationController,
            falsingManager,
            iconAreaController,
            shelfIconViewStore
        )

        bindFooter(view, viewModel, configuration)
    }

    private fun bindShelf(
        parentView: NotificationStackScrollLayout,
        parentViewModel: NotificationListViewModel,
        configuration: ConfigurationState,
        configurationController: ConfigurationController,
        falsingManager: FalsingManager,
        iconAreaController: NotificationIconAreaController,
        shelfIconViewStore: ShelfNotificationIconViewStore
    ) {
        val shelf =
            LayoutInflater.from(view.context)
                .inflate(R.layout.status_bar_notification_shelf, view, false) as NotificationShelf
            LayoutInflater.from(parentView.context)
                .inflate(R.layout.status_bar_notification_shelf, parentView, false)
                as NotificationShelf
        NotificationShelfViewBinder.bind(
            shelf,
            viewModel.shelf,
            parentViewModel.shelf,
            configuration,
            configurationController,
            falsingManager,
            iconAreaController,
            shelfIconViewStore,
        )
        view.setShelf(shelf)
        parentView.setShelf(shelf)
    }

        viewModel.footer.ifPresent { footerViewModel ->
    private fun bindFooter(
        parentView: NotificationStackScrollLayout,
        parentViewModel: NotificationListViewModel,
        configuration: ConfigurationState
    ) {
        parentViewModel.footer.ifPresent { footerViewModel ->
            // The footer needs to be re-inflated every time the theme or the font size changes.
            view.repeatWhenAttached {
            parentView.repeatWhenAttached {
                configuration.reinflateAndBindLatest(
                    R.layout.status_bar_notification_footer,
                    view,
                    parentView,
                    attachToRoot = false,
                ) { footerView: FooterView ->
                    traceSection("bind FooterView") {
                        FooterViewBinder.bind(footerView, footerViewModel)
                        val disposableHandle = FooterViewBinder.bind(footerView, footerViewModel)
                        parentView.setFooterView(footerView)
                        return@reinflateAndBindLatest disposableHandle
                    }
                }
            }