Home | History | Annotate | Download | only in notification
      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;
     24 import com.android.systemui.statusbar.ExpandableNotificationRow;
     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 
     34     protected NotificationBigTextTemplateViewWrapper(Context ctx, View view,
     35             ExpandableNotificationRow row) {
     36         super(ctx, view, row);
     37     }
     38 
     39     private void resolveViews(StatusBarNotification notification) {
     40         mBigtext = (ImageFloatingTextView) mView.findViewById(com.android.internal.R.id.big_text);
     41     }
     42 
     43     @Override
     44     public void notifyContentUpdated(StatusBarNotification notification) {
     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.
     47         resolveViews(notification);
     48         super.notifyContentUpdated(notification);
     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 }
     61