1 /* 2 * Copyright (C) 2021 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.render 18 19 import com.android.systemui.statusbar.notification.collection.GroupEntry 20 import com.android.systemui.statusbar.notification.collection.PipelineEntry 21 import com.android.systemui.statusbar.notification.collection.NotificationEntry 22 23 /** 24 * This interface and the interfaces it returns define the main API surface that must be implemented 25 * by the view implementation. The term "render" is used to indicate a handoff to the view system, 26 * whether that be to attach views to the hierarchy or to update independent view models, data 27 * stores, or adapters. 28 */ 29 interface NotifViewRenderer { 30 31 /** 32 * Hand off the list of notifications to the view implementation. This may attach views to the 33 * hierarchy or simply update an independent datastore, but once called, the implementer myst 34 * also ensure that future calls to [getStackController], [getGroupController], and 35 * [getRowController] will provide valid results. 36 */ onRenderListnull37 fun onRenderList(notifList: List<PipelineEntry>) 38 39 /** 40 * Provides an interface for the pipeline to update individual groups. This will be called at 41 * most once for each group in the most recent call to [onRenderList]. 42 */ 43 fun getGroupController(group: GroupEntry): NotifGroupController 44 45 /** 46 * Provides an interface for the pipeline to update individual entries. This will be called at 47 * most once for each entry in the most recent call to [onRenderList]. This includes top level 48 * entries, group summaries, and group children. 49 */ 50 fun getRowController(entry: NotificationEntry): NotifRowController 51 52 /** 53 * Invoked after the render stage manager has finished dispatching to all of the listeners. 54 * 55 * This is an opportunity for the view system to do any cleanup or trigger any finalization 56 * logic now that all data from the pipeline is known to have been set for this execution. 57 * 58 * When this is called, the view system can expect that no more calls will be made to the 59 * getters on this interface until after the next call to [onRenderList]. Additionally, there 60 * should be no further calls made on the objects previously returned by those getters. 61 */ 62 fun onDispatchComplete() {} 63 } 64