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

Commit 076df248 authored by Ioana Alexandru's avatar Ioana Alexandru Committed by Android (Google) Code Review
Browse files

Merge "Set the footer on the NSSL in the binder." into main

parents 3a012809 a9b6beb8
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
                    }
                }
            }