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.stack;
18 
19 import android.annotation.NonNull;
20 import android.annotation.Nullable;
21 import android.view.View;
22 
23 import com.android.systemui.statusbar.notification.VisualStabilityManager;
24 import com.android.systemui.statusbar.notification.collection.NotificationEntry;
25 
26 import java.util.List;
27 
28 /**
29 * A NotificationListItem is a child view of the notification list that can yield a
30 * NotificationEntry when asked. I.e., it's an ExpandableNotificationRow but doesn't require us
31 * to strictly rely on ExpandableNotificationRow as our consumed type
32  */
33 public interface NotificationListItem {
34     /** @return entry for this item */
35     @NonNull
getEntry()36     NotificationEntry getEntry();
37 
38     /** @return true if the blocking helper is showing */
isBlockingHelperShowing()39     boolean isBlockingHelperShowing();
40 
41     /** @return true if this list item is a summary with children */
isSummaryWithChildren()42     boolean isSummaryWithChildren();
43 
44     // This generic is kind of ugly - we should change this once the old VHM is gone
45     /** @return list of the children of this item */
getAttachedChildren()46     List<? extends NotificationListItem> getAttachedChildren();
47 
48     /** remove all children from this list item */
removeAllChildren()49     void removeAllChildren();
50 
51     /** remove particular child */
removeChildNotification(NotificationListItem child)52     void removeChildNotification(NotificationListItem child);
53 
54     /** add an item as a child */
addChildNotification(NotificationListItem child, int childIndex)55     void addChildNotification(NotificationListItem child, int childIndex);
56 
57     /** set the child count view should display */
setUntruncatedChildCount(int count)58     void setUntruncatedChildCount(int count);
59 
60     /** Update the order of the children with the new list */
applyChildOrder( List<? extends NotificationListItem> childOrderList, VisualStabilityManager vsm, @Nullable VisualStabilityManager.Callback callback)61     boolean applyChildOrder(
62             List<? extends NotificationListItem> childOrderList,
63             VisualStabilityManager vsm,
64             @Nullable VisualStabilityManager.Callback callback);
65 
66     /** return the associated view for this list item */
67     @NonNull
getView()68     View getView();
69 }
70