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.END
23 import androidx.constraintlayout.widget.ConstraintSet.PARENT_ID
24 import androidx.constraintlayout.widget.ConstraintSet.START
25 import androidx.constraintlayout.widget.ConstraintSet.TOP
26 import com.android.systemui.keyguard.MigrateClocksToBlueprint
27 import com.android.systemui.res.R
28 import com.android.systemui.shade.NotificationPanelView
29 import com.android.systemui.statusbar.notification.stack.ui.view.SharedNotificationContainer
30 import com.android.systemui.statusbar.notification.stack.ui.viewbinder.SharedNotificationContainerBinder
31 import com.android.systemui.statusbar.notification.stack.ui.viewmodel.SharedNotificationContainerViewModel
32 import javax.inject.Inject
33 
34 /** Large-screen format for notifications, shown as two columns on the device */
35 class SplitShadeNotificationStackScrollLayoutSection
36 @Inject
37 constructor(
38     context: Context,
39     notificationPanelView: NotificationPanelView,
40     sharedNotificationContainer: SharedNotificationContainer,
41     sharedNotificationContainerViewModel: SharedNotificationContainerViewModel,
42     sharedNotificationContainerBinder: SharedNotificationContainerBinder,
43 ) :
44     NotificationStackScrollLayoutSection(
45         context,
46         notificationPanelView,
47         sharedNotificationContainer,
48         sharedNotificationContainerViewModel,
49         sharedNotificationContainerBinder,
50     ) {
applyConstraintsnull51     override fun applyConstraints(constraintSet: ConstraintSet) {
52         if (!MigrateClocksToBlueprint.isEnabled) {
53             return
54         }
55         constraintSet.apply {
56             connect(
57                 R.id.nssl_placeholder,
58                 TOP,
59                 PARENT_ID,
60                 TOP,
61                 context.resources.getDimensionPixelSize(R.dimen.keyguard_split_shade_top_margin)
62             )
63             connect(R.id.nssl_placeholder, START, PARENT_ID, START)
64             connect(R.id.nssl_placeholder, END, PARENT_ID, END)
65 
66             addNotificationPlaceholderBarrier(this)
67         }
68     }
69 }
70