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 android.view.ViewGroup
22 import androidx.constraintlayout.widget.ConstraintSet
23 import com.android.systemui.R
24 import com.android.systemui.keyguard.data.repository.KeyguardSection
25 import javax.inject.Inject
26 
27 class DefaultIndicationAreaSection @Inject constructor(private val context: Context) :
28     KeyguardSection {
29     private val indicationAreaViewId = R.id.keyguard_indication_area
30 
31     override fun apply(constraintSet: ConstraintSet) {
32         constraintSet.apply {
33             constrainWidth(indicationAreaViewId, ViewGroup.LayoutParams.MATCH_PARENT)
34             constrainHeight(indicationAreaViewId, ViewGroup.LayoutParams.WRAP_CONTENT)
35             connect(
36                 indicationAreaViewId,
37                 ConstraintSet.BOTTOM,
38                 ConstraintSet.PARENT_ID,
39                 ConstraintSet.BOTTOM,
40                 context.resources.getDimensionPixelSize(R.dimen.keyguard_indication_margin_bottom)
41             )
42             connect(
43                 indicationAreaViewId,
44                 ConstraintSet.START,
45                 ConstraintSet.PARENT_ID,
46                 ConstraintSet.START
47             )
48             connect(
49                 indicationAreaViewId,
50                 ConstraintSet.END,
51                 ConstraintSet.PARENT_ID,
52                 ConstraintSet.END
53             )
54         }
55     }
56 }
57