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 18 package com.android.systemui.keyguard.ui.view.layout.sections 19 20 import android.content.Context 21 import androidx.constraintlayout.widget.ConstraintSet 22 import androidx.constraintlayout.widget.ConstraintSet.BOTTOM 23 import androidx.constraintlayout.widget.ConstraintSet.END 24 import androidx.constraintlayout.widget.ConstraintSet.PARENT_ID 25 import androidx.constraintlayout.widget.ConstraintSet.START 26 import androidx.constraintlayout.widget.ConstraintSet.TOP 27 import com.android.systemui.res.R 28 import com.android.systemui.shade.LargeScreenHeaderHelper 29 import com.android.systemui.shade.NotificationPanelView 30 import com.android.systemui.shade.ShadeDisplayAware 31 import com.android.systemui.statusbar.notification.stack.ui.view.SharedNotificationContainer 32 import com.android.systemui.statusbar.notification.stack.ui.viewbinder.SharedNotificationContainerBinder 33 import com.android.systemui.statusbar.notification.stack.ui.viewmodel.SharedNotificationContainerViewModel 34 import dagger.Lazy 35 import javax.inject.Inject 36 37 /** Single column format for notifications (default for phones) */ 38 class DefaultNotificationStackScrollLayoutSection 39 @Inject 40 constructor( 41 @ShadeDisplayAware context: Context, 42 notificationPanelView: NotificationPanelView, 43 sharedNotificationContainer: SharedNotificationContainer, 44 sharedNotificationContainerViewModel: SharedNotificationContainerViewModel, 45 sharedNotificationContainerBinder: SharedNotificationContainerBinder, 46 private val largeScreenHeaderHelperLazy: Lazy<LargeScreenHeaderHelper>, 47 ) : 48 NotificationStackScrollLayoutSection( 49 context, 50 notificationPanelView, 51 sharedNotificationContainer, 52 sharedNotificationContainerViewModel, 53 sharedNotificationContainerBinder, 54 ) { applyConstraintsnull55 override fun applyConstraints(constraintSet: ConstraintSet) { 56 constraintSet.apply { 57 val bottomMargin = 58 context.resources.getDimensionPixelSize(R.dimen.keyguard_status_view_bottom_margin) 59 val useLargeScreenHeader = 60 context.resources.getBoolean(R.bool.config_use_large_screen_shade_header) 61 val marginTopLargeScreen = 62 largeScreenHeaderHelperLazy.get().getLargeScreenHeaderHeight() 63 connect( 64 R.id.nssl_placeholder, 65 TOP, 66 R.id.smart_space_barrier_bottom, 67 BOTTOM, 68 bottomMargin + 69 if (useLargeScreenHeader) { 70 marginTopLargeScreen 71 } else { 72 0 73 }, 74 ) 75 connect(R.id.nssl_placeholder, START, PARENT_ID, START) 76 connect(R.id.nssl_placeholder, END, PARENT_ID, END) 77 78 addNotificationPlaceholderBarrier(this) 79 } 80 } 81 } 82