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 import com.android.systemui.statusbar.notification.collection.NotificationEntry; 19 import com.android.systemui.statusbar.notification.collection.coordinator.PreparationCoordinator; 20 21 /** 22 * Used by the {@link PreparationCoordinator}. When notifications are added or updated, the 23 * NotifInflater is asked to (re)inflated and prepare their views. This inflation occurs off the 24 * main thread. When the inflation is finished, NotifInflater will trigger its InflationCallback. 25 */ 26 public interface NotifInflater { 27 /** 28 * Called to rebind the entry's views. 29 * 30 * @param callback callback called after inflation finishes 31 */ rebindViews(NotificationEntry entry, InflationCallback callback)32 void rebindViews(NotificationEntry entry, InflationCallback callback); 33 34 /** 35 * Called to inflate the views of an entry. Views are not considered inflated until all of its 36 * views are bound. Once all views are inflated, the InflationCallback is triggered. 37 * 38 * @param callback callback called after inflation finishes 39 */ inflateViews(NotificationEntry entry, InflationCallback callback)40 void inflateViews(NotificationEntry entry, InflationCallback callback); 41 42 /** 43 * Request to stop the inflation of an entry. For example, called when a notification is 44 * removed and no longer needs to be inflated. 45 */ abortInflation(NotificationEntry entry)46 void abortInflation(NotificationEntry entry); 47 48 /** 49 * Callback once all the views are inflated and bound for a given NotificationEntry. 50 */ 51 interface InflationCallback { onInflationFinished(NotificationEntry entry)52 void onInflationFinished(NotificationEntry entry); 53 } 54 } 55