Selim Cinek | 83bc783 | 2015-10-22 13:26:54 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package com.android.systemui.statusbar.notification; |
| 18 | |
| 19 | import android.annotation.Nullable; |
| 20 | import android.content.Context; |
Selim Cinek | 83bc783 | 2015-10-22 13:26:54 -0700 | [diff] [blame] | 21 | import android.util.AttributeSet; |
| 22 | import android.widget.TextView; |
| 23 | |
Selim Cinek | 7b83639 | 2015-12-04 20:02:59 -0800 | [diff] [blame^] | 24 | import com.android.keyguard.AlphaOptimizedLinearLayout; |
Selim Cinek | 83bc783 | 2015-10-22 13:26:54 -0700 | [diff] [blame] | 25 | import com.android.systemui.R; |
Selim Cinek | 83bc783 | 2015-10-22 13:26:54 -0700 | [diff] [blame] | 26 | |
| 27 | /** |
| 28 | * A hybrid view which may contain information about one ore more notifications. |
| 29 | */ |
Selim Cinek | 7b83639 | 2015-12-04 20:02:59 -0800 | [diff] [blame^] | 30 | public class HybridNotificationView extends AlphaOptimizedLinearLayout { |
Selim Cinek | 83bc783 | 2015-10-22 13:26:54 -0700 | [diff] [blame] | 31 | |
Selim Cinek | 83bc783 | 2015-10-22 13:26:54 -0700 | [diff] [blame] | 32 | 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 Cinek | 83bc783 | 2015-10-22 13:26:54 -0700 | [diff] [blame] | 50 | } |
| 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 | } |