blob: 20a3d8f06e501bcb512959de18b9fa776749f6ff [file] [log] [blame]
Selim Cinekd634d062016-02-02 15:47:14 -08001/*
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
17package com.android.systemui.statusbar.notification;
18
19import android.content.Context;
20import android.service.notification.StatusBarNotification;
21import android.view.View;
22
23import com.android.internal.widget.ImageFloatingTextView;
Selim Cinek7d1c63e2016-04-21 15:26:10 -070024import com.android.systemui.statusbar.ExpandableNotificationRow;
Selim Cinekd634d062016-02-02 15:47:14 -080025import com.android.systemui.statusbar.TransformableView;
26
27/**
28 * Wraps a notification containing a big text template
29 */
30public class NotificationBigTextTemplateViewWrapper extends NotificationTemplateViewWrapper {
31
32 private ImageFloatingTextView mBigtext;
33
Selim Cinek7d1c63e2016-04-21 15:26:10 -070034 protected NotificationBigTextTemplateViewWrapper(Context ctx, View view,
35 ExpandableNotificationRow row) {
36 super(ctx, view, row);
Selim Cinekd634d062016-02-02 15:47:14 -080037 }
38
39 private void resolveViews(StatusBarNotification notification) {
40 mBigtext = (ImageFloatingTextView) mView.findViewById(com.android.internal.R.id.big_text);
41 }
42
43 @Override
Selim Cinek131f1a42017-06-05 17:50:19 -070044 public void onContentUpdated(ExpandableNotificationRow row) {
Selim Cinekd634d062016-02-02 15:47:14 -080045 // 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 Cinek414ad332017-02-24 19:06:12 -080047 resolveViews(row.getStatusBarNotification());
Selim Cinek131f1a42017-06-05 17:50:19 -070048 super.onContentUpdated(row);
Selim Cinekd634d062016-02-02 15:47:14 -080049 }
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}