1 /* 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.systemui.statusbar.notification.stack.ui.viewbinder 18 19 import android.view.LayoutInflater 20 import com.android.systemui.R 21 import com.android.systemui.flags.FeatureFlags 22 import com.android.systemui.plugins.FalsingManager 23 import com.android.systemui.statusbar.NotificationShelf 24 import com.android.systemui.statusbar.notification.shelf.ui.viewbinder.NotificationShelfViewBinder 25 import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout 26 import com.android.systemui.statusbar.notification.stack.ui.viewmodel.NotificationListViewModel 27 import com.android.systemui.statusbar.phone.NotificationIconAreaController 28 29 /** Binds a [NotificationStackScrollLayout] to its [view model][NotificationListViewModel]. */ 30 object NotificationListViewBinder { 31 @JvmStatic 32 fun bind( 33 view: NotificationStackScrollLayout, 34 viewModel: NotificationListViewModel, 35 falsingManager: FalsingManager, 36 featureFlags: FeatureFlags, 37 iconAreaController: NotificationIconAreaController, 38 ) { 39 val shelf = 40 LayoutInflater.from(view.context) 41 .inflate(R.layout.status_bar_notification_shelf, view, false) as NotificationShelf 42 NotificationShelfViewBinder.bind( 43 shelf, 44 viewModel.shelf, 45 falsingManager, 46 featureFlags, 47 iconAreaController 48 ) 49 view.setShelf(shelf) 50 } 51 } 52