1 /* 2 * Copyright (C) 2020 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.collection.inflation; 18 19 import android.annotation.NonNull; 20 21 import com.android.systemui.statusbar.notification.InflationException; 22 import com.android.systemui.statusbar.notification.collection.NotificationEntry; 23 import com.android.systemui.statusbar.notification.row.NotificationRowContentBinder; 24 25 /** 26 * Used by the {@link NotifInflater}. When notifications are added or updated, the binder 27 * is asked to (re)inflate and prepare their views. This inflation must occur off the main thread. 28 */ 29 public interface NotificationRowBinder { 30 /** 31 * Called when a notification has been added or updated. The binder must asynchronously inflate 32 * and bind the views associated with the notification. 33 */ inflateViews( NotificationEntry entry, @NonNull NotifInflater.Params params, NotificationRowContentBinder.InflationCallback callback)34 void inflateViews( 35 NotificationEntry entry, 36 @NonNull NotifInflater.Params params, 37 NotificationRowContentBinder.InflationCallback callback) 38 throws InflationException; 39 40 /** 41 * Called when a notification is no longer likely to be displayed and can have its views freed. 42 */ releaseViews(NotificationEntry entry)43 void releaseViews(NotificationEntry entry); 44 } 45