blob: fafea9856db25ee1a336f82798fb00fc5980f196 [file] [log] [blame]
Selim Cinek83bc7832015-10-22 13:26:54 -07001/*
2 * Copyright (C) 2015 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
17package com.android.systemui.statusbar.notification;
18
19import android.annotation.Nullable;
20import android.content.Context;
Selim Cinek83bc7832015-10-22 13:26:54 -070021import android.util.AttributeSet;
22import android.widget.TextView;
23
Selim Cinek7b836392015-12-04 20:02:59 -080024import com.android.keyguard.AlphaOptimizedLinearLayout;
Selim Cinek83bc7832015-10-22 13:26:54 -070025import com.android.systemui.R;
Selim Cinek83bc7832015-10-22 13:26:54 -070026
27/**
28 * A hybrid view which may contain information about one ore more notifications.
29 */
Selim Cinek7b836392015-12-04 20:02:59 -080030public class HybridNotificationView extends AlphaOptimizedLinearLayout {
Selim Cinek83bc7832015-10-22 13:26:54 -070031
Selim Cinek83bc7832015-10-22 13:26:54 -070032 protected TextView mTitleView;
33 protected TextView mTextView;
34
35 public HybridNotificationView(Context context) {
36 this(context, null);
37 }
38
39 public HybridNotificationView(Context context, @Nullable AttributeSet attrs) {
40 this(context, attrs, 0);
41 }
42
43 public HybridNotificationView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
44 this(context, attrs, defStyleAttr, 0);
45 }
46
47 public HybridNotificationView(Context context, @Nullable AttributeSet attrs, int defStyleAttr,
48 int defStyleRes) {
49 super(context, attrs, defStyleAttr, defStyleRes);
Selim Cinek83bc7832015-10-22 13:26:54 -070050 }
51
52 @Override
53 protected void onFinishInflate() {
54 super.onFinishInflate();
55 mTitleView = (TextView) findViewById(R.id.notification_title);
56 mTextView = (TextView) findViewById(R.id.notification_text);
57 }
58
59 public void bind(CharSequence title) {
60 bind(title, null);
61 }
62
63 public void bind(CharSequence title, CharSequence text) {
64 mTitleView.setText(title);
65 mTextView.setText(text);
66 requestLayout();
67 }
68}