2 * Copyright (C) 2017 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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
17 package com.android.systemui.statusbar.notification.stack;
19 import static com.android.systemui.statusbar.notification.ActivityLaunchAnimator.ExpandAnimationParameters;
21 import android.view.View;
22 import android.view.ViewGroup;
24 import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper;
25 import com.android.systemui.statusbar.notification.VisibilityLocationProvider;
26 import com.android.systemui.statusbar.notification.collection.NotificationEntry;
27 import com.android.systemui.statusbar.notification.logging.NotificationLogger;
28 import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
29 import com.android.systemui.statusbar.notification.row.ExpandableView;
32 * Interface representing the entity that contains notifications. It can have
33 * notification views added and removed from it, and will manage displaying them to the user.
35 public interface NotificationListContainer extends ExpandableView.OnHeightChangedListener,
36 VisibilityLocationProvider {
39 * Called when a child is being transferred.
41 * @param childTransferInProgress whether child transfer is in progress
43 void setChildTransferInProgress(boolean childTransferInProgress);
46 * Change the position of child to a new location
47 * @param child the view to change the position for
48 * @param newIndex the new index
50 void changeViewPosition(ExpandableView child, int newIndex);
53 * Called when a child was added to a group.
55 * @param row row of the group child that was added
57 void notifyGroupChildAdded(ExpandableView row);
60 * Called when a child was removed from a group.
61 * @param row row of the child that was removed
62 * @param childrenContainer ViewGroup of the group that the child was removed from
64 void notifyGroupChildRemoved(ExpandableView row, ViewGroup childrenContainer);
67 * Generate an animation for an added child view.
68 * @param child The view to be added.
69 * @param fromMoreCard Whether this add is coming from the "more" card on lockscreen.
71 void generateAddAnimation(ExpandableView child, boolean fromMoreCard);
74 * Generate a child order changed event.
76 void generateChildOrderChangedEvent();
79 * Returns the number of children in the NotificationListContainer.
81 * @return the number of children in the NotificationListContainer
83 int getContainerChildCount();
86 * Gets the ith child in the NotificationListContainer.
88 * @param i ith child to get
89 * @return the ith child in the list container
91 View getContainerChildAt(int i);
94 * Remove a view from the container
96 * @param v view to remove
98 void removeContainerView(View v);
101 * Add a view to the container
103 * @param v view to add
105 void addContainerView(View v);
108 * Sets the maximum number of notifications to display.
110 * @param maxNotifications max number of notifications to display
112 void setMaxDisplayedNotifications(int maxNotifications);
115 * Get the view parent for a notification entry. For example, NotificationStackScrollLayout.
117 * @param entry entry to get the view parent for
118 * @return the view parent for entry
120 ViewGroup getViewParentForNotification(NotificationEntry entry);
123 * Resets the currently exposed menu view.
125 * @param animate whether to animate the closing/change of menu view
126 * @param force reset the menu view even if it looks like it is already reset
128 void resetExposedMenuView(boolean animate, boolean force);
131 * Returns the NotificationSwipeActionHelper for the NotificationListContainer.
133 * @return swipe action helper for the list container
135 NotificationSwipeActionHelper getSwipeActionHelper();
138 * Called when a notification is removed from the shade. This cleans up the state for a
141 * @param entry the entry whose view's view state needs to be cleaned up (say that 5 times fast)
143 void cleanUpViewStateForEntry(NotificationEntry entry);
147 * Sets a listener to listen for changes in notification locations.
149 * @param listener listener to set
151 void setChildLocationsChangedListener(
152 NotificationLogger.OnChildLocationsChangedListener listener);
155 * Called when an update to the notification view hierarchy is completed.
157 default void onNotificationViewUpdateFinished() {}
160 * Returns true if there are pulsing notifications.
162 * @return true if has pulsing notifications
164 boolean hasPulsingNotifications();
167 * Apply parameters of the expand animation to the layout
169 default void applyExpandAnimationParams(ExpandAnimationParameters params) {}
171 default void setExpandingNotification(ExpandableNotificationRow row) {}
174 * Bind a newly created row.
176 * @param row The notification to bind.
178 default void bindRow(ExpandableNotificationRow row) {}
181 * Does this list contain a given view. True by default is fine, since we only ask this if the
184 default boolean containsView(View v) {
188 default void setWillExpand(boolean willExpand) {};