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.shade.carrier;
18 
19 import android.annotation.StyleRes;
20 import android.content.Context;
21 import android.util.AttributeSet;
22 import android.view.View;
23 import android.widget.LinearLayout;
24 import android.widget.TextView;
25 
26 import com.android.systemui.FontSizeUtils;
27 import com.android.systemui.res.R;
28 
29 /**
30  * Displays Carrier name and network status in the shade header
31  */
32 public class ShadeCarrierGroup extends LinearLayout {
ShadeCarrierGroup(Context context, AttributeSet attrs)33     public ShadeCarrierGroup(Context context, AttributeSet attrs) {
34         super(context, attrs);
35     }
36 
getNoSimTextView()37     TextView getNoSimTextView() {
38         return findViewById(R.id.no_carrier_text);
39     }
40 
getCarrier1View()41     ShadeCarrier getCarrier1View() {
42         return findViewById(R.id.carrier1);
43     }
44 
getCarrier2View()45     ShadeCarrier getCarrier2View() {
46         return findViewById(R.id.carrier2);
47     }
48 
getCarrier3View()49     ShadeCarrier getCarrier3View() {
50         return findViewById(R.id.carrier3);
51     }
52 
getCarrierDivider1()53     View getCarrierDivider1() {
54         return findViewById(R.id.shade_carrier_divider1);
55     }
56 
getCarrierDivider2()57     View getCarrierDivider2() {
58         return findViewById(R.id.shade_carrier_divider2);
59     }
60 
updateTextAppearance(@tyleRes int resId)61     public void updateTextAppearance(@StyleRes int resId) {
62         FontSizeUtils.updateFontSizeFromStyle(getNoSimTextView(), resId);
63         getCarrier1View().updateTextAppearance(resId);
64         getCarrier2View().updateTextAppearance(resId);
65         getCarrier3View().updateTextAppearance(resId);
66     }
67 }
68