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.bouncer.ui
18 
19 import android.content.Context
20 import android.util.AttributeSet
21 import android.widget.LinearLayout
22 import com.android.keyguard.BouncerKeyguardMessageArea
23 import com.android.keyguard.KeyguardMessageArea
24 import com.android.keyguard.KeyguardMessageAreaController
25 import com.android.systemui.res.R
26 
27 class BouncerMessageView : LinearLayout {
28     constructor(context: Context?) : super(context)
29 
30     constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
31 
32     init {
33         inflate(context, R.layout.bouncer_message_view, this)
34     }
35 
36     var primaryMessageView: BouncerKeyguardMessageArea? = null
37     var secondaryMessageView: BouncerKeyguardMessageArea? = null
38     var primaryMessage: KeyguardMessageAreaController<KeyguardMessageArea>? = null
39     var secondaryMessage: KeyguardMessageAreaController<KeyguardMessageArea>? = null
onFinishInflatenull40     override fun onFinishInflate() {
41         super.onFinishInflate()
42         primaryMessageView = findViewById(R.id.bouncer_primary_message_area)
43         secondaryMessageView = findViewById(R.id.bouncer_secondary_message_area)
44     }
45 
initnull46     fun init(factory: KeyguardMessageAreaController.Factory) {
47         primaryMessage = factory.create(primaryMessageView)
48         primaryMessage?.init()
49         secondaryMessage = factory.create(secondaryMessageView)
50         secondaryMessage?.init()
51     }
52 }
53