Selim Cinek | d634d06 | 2016-02-02 15:47:14 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 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.content.Context; |
| 20 | import android.service.notification.StatusBarNotification; |
| 21 | import android.view.View; |
| 22 | |
| 23 | import com.android.internal.widget.ImageFloatingTextView; |
Selim Cinek | 7d1c63e | 2016-04-21 15:26:10 -0700 | [diff] [blame] | 24 | import com.android.systemui.statusbar.ExpandableNotificationRow; |
Selim Cinek | d634d06 | 2016-02-02 15:47:14 -0800 | [diff] [blame] | 25 | import com.android.systemui.statusbar.TransformableView; |
| 26 | |
| 27 | /** |
| 28 | * Wraps a notification containing a big text template |
| 29 | */ |
| 30 | public class NotificationBigTextTemplateViewWrapper extends NotificationTemplateViewWrapper { |
| 31 | |
| 32 | private ImageFloatingTextView mBigtext; |
| 33 | |
Selim Cinek | 7d1c63e | 2016-04-21 15:26:10 -0700 | [diff] [blame] | 34 | protected NotificationBigTextTemplateViewWrapper(Context ctx, View view, |
| 35 | ExpandableNotificationRow row) { |
| 36 | super(ctx, view, row); |
Selim Cinek | d634d06 | 2016-02-02 15:47:14 -0800 | [diff] [blame] | 37 | } |
| 38 | |
| 39 | private void resolveViews(StatusBarNotification notification) { |
| 40 | mBigtext = (ImageFloatingTextView) mView.findViewById(com.android.internal.R.id.big_text); |
| 41 | } |
| 42 | |
| 43 | @Override |
Selim Cinek | 131f1a4 | 2017-06-05 17:50:19 -0700 | [diff] [blame^] | 44 | public void onContentUpdated(ExpandableNotificationRow row) { |
Selim Cinek | d634d06 | 2016-02-02 15:47:14 -0800 | [diff] [blame] | 45 | // Reinspect the notification. Before the super call, because the super call also updates |
| 46 | // the transformation types and we need to have our values set by then. |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 47 | resolveViews(row.getStatusBarNotification()); |
Selim Cinek | 131f1a4 | 2017-06-05 17:50:19 -0700 | [diff] [blame^] | 48 | super.onContentUpdated(row); |
Selim Cinek | d634d06 | 2016-02-02 15:47:14 -0800 | [diff] [blame] | 49 | } |
| 50 | |
| 51 | @Override |
| 52 | protected void updateTransformedTypes() { |
| 53 | // This also clears the existing types |
| 54 | super.updateTransformedTypes(); |
| 55 | if (mBigtext != null) { |
| 56 | mTransformationHelper.addTransformedView(TransformableView.TRANSFORMING_VIEW_TEXT, |
| 57 | mBigtext); |
| 58 | } |
| 59 | } |
| 60 | } |