• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.graphics.Typeface
21 import android.util.AttributeSet
22 import android.widget.LinearLayout
23 import com.android.keyguard.BouncerKeyguardMessageArea
24 import com.android.keyguard.KeyguardMessageArea
25 import com.android.keyguard.KeyguardMessageAreaController
26 import com.android.systemui.Flags
27 import com.android.systemui.FontStyles
28 import com.android.systemui.res.R
29 
30 class BouncerMessageView : LinearLayout {
31     constructor(context: Context?) : super(context)
32 
33     constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
34 
35     init {
36         inflate(context, R.layout.bouncer_message_view, this)
37     }
38 
39     var primaryMessageView: BouncerKeyguardMessageArea? = null
40     var secondaryMessageView: BouncerKeyguardMessageArea? = null
41     var primaryMessage: KeyguardMessageAreaController<KeyguardMessageArea>? = null
42     var secondaryMessage: KeyguardMessageAreaController<KeyguardMessageArea>? = null
43 
onFinishInflatenull44     override fun onFinishInflate() {
45         super.onFinishInflate()
46         primaryMessageView = findViewById(R.id.bouncer_primary_message_area)
47         secondaryMessageView = findViewById(R.id.bouncer_secondary_message_area)
48 
49         if (Flags.bouncerUiRevamp2()) {
50             primaryMessageView?.apply {
51                 typeface = Typeface.create(FontStyles.GSF_TITLE_LARGE_EMPHASIZED, Typeface.NORMAL)
52             }
53             secondaryMessageView?.apply {
54                 typeface = Typeface.create(FontStyles.GSF_TITLE_MEDIUM_EMPHASIZED, Typeface.NORMAL)
55             }
56         }
57     }
58 
initnull59     fun init(factory: KeyguardMessageAreaController.Factory) {
60         primaryMessage = factory.create(primaryMessageView)
61         primaryMessage?.init()
62         secondaryMessage = factory.create(secondaryMessageView)
63         secondaryMessage?.init()
64     }
65 }
66