blob: 0c19ec091ca6203b4548a108f9722f1e40683fb7 [file] [log] [blame]
Eliot Courtney2b4c3a02017-11-27 13:27:46 +09001/*
2 * Copyright (C) 2017 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
17package com.android.systemui.statusbar;
18
Selim Cinek2627d722018-01-19 12:16:49 -080019import static com.android.systemui.statusbar.notification.ActivityLaunchAnimator.ExpandAnimationParameters;
20
Eliot Courtney2b4c3a02017-11-27 13:27:46 +090021import android.view.View;
22import android.view.ViewGroup;
23
24import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper;
25
26/**
27 * Interface representing the entity that contains notifications. It can have
28 * notification views added and removed from it, and will manage displaying them to the user.
29 */
30public interface NotificationListContainer {
31
32 /**
33 * Called when a child is being transferred.
34 *
35 * @param childTransferInProgress whether child transfer is in progress
36 */
37 void setChildTransferInProgress(boolean childTransferInProgress);
38
39 /**
40 * Change the position of child to a new location
41 *
42 * @param child the view to change the position for
43 * @param newIndex the new index
44 */
45 void changeViewPosition(View child, int newIndex);
46
47 /**
48 * Called when a child was added to a group.
49 *
50 * @param row row of the group child that was added
51 */
52 void notifyGroupChildAdded(View row);
53
54 /**
55 * Called when a child was removed from a group.
56 *
57 * @param row row of the child that was removed
58 * @param childrenContainer ViewGroup of the group that the child was removed from
59 */
60 void notifyGroupChildRemoved(View row, ViewGroup childrenContainer);
61
62 /**
63 * Generate an animation for an added child view.
64 *
65 * @param child The view to be added.
66 * @param fromMoreCard Whether this add is coming from the "more" card on lockscreen.
67 */
68 void generateAddAnimation(View child, boolean fromMoreCard);
69
70 /**
71 * Generate a child order changed event.
72 */
73 void generateChildOrderChangedEvent();
74
75 /**
76 * Returns the number of children in the NotificationListContainer.
77 *
78 * @return the number of children in the NotificationListContainer
79 */
80 int getContainerChildCount();
81
82 /**
83 * Gets the ith child in the NotificationListContainer.
84 *
85 * @param i ith child to get
86 * @return the ith child in the list container
87 */
88 View getContainerChildAt(int i);
89
90 /**
91 * Remove a view from the container
92 *
93 * @param v view to remove
94 */
95 void removeContainerView(View v);
96
97 /**
98 * Add a view to the container
99 *
100 * @param v view to add
101 */
102 void addContainerView(View v);
103
104 /**
105 * Sets the maximum number of notifications to display.
106 *
107 * @param maxNotifications max number of notifications to display
108 */
109 void setMaxDisplayedNotifications(int maxNotifications);
110
111 /**
112 * Handle snapping a non-dismissable row back if the user tried to dismiss it.
113 *
114 * @param row row to snap back
115 */
116 void snapViewIfNeeded(ExpandableNotificationRow row);
117
118 /**
119 * Get the view parent for a notification entry. For example, NotificationStackScrollLayout.
120 *
121 * @param entry entry to get the view parent for
122 * @return the view parent for entry
123 */
124 ViewGroup getViewParentForNotification(NotificationData.Entry entry);
125
126 /**
127 * Called when the height of an expandable view changes.
128 *
129 * @param view view whose height changed
130 * @param animate whether this change should be animated
131 */
132 void onHeightChanged(ExpandableView view, boolean animate);
133
134 /**
135 * Resets the currently exposed menu view.
136 *
137 * @param animate whether to animate the closing/change of menu view
138 * @param force reset the menu view even if it looks like it is already reset
139 */
140 void resetExposedMenuView(boolean animate, boolean force);
141
142 /**
143 * Returns the NotificationSwipeActionHelper for the NotificationListContainer.
144 *
145 * @return swipe action helper for the list container
146 */
147 NotificationSwipeActionHelper getSwipeActionHelper();
148
149 /**
150 * Called when a notification is removed from the shade. This cleans up the state for a
151 * given view.
152 *
153 * @param view view to clean up view state for
154 */
155 void cleanUpViewState(View view);
156
157 /**
158 * Returns whether an ExpandableNotificationRow is in a visible location or not.
159 *
160 * @param row
161 * @return true if row is in a visible location
162 */
163 boolean isInVisibleLocation(ExpandableNotificationRow row);
164
165 /**
166 * Sets a listener to listen for changes in notification locations.
167 *
168 * @param listener listener to set
169 */
170 void setChildLocationsChangedListener(
171 NotificationLogger.OnChildLocationsChangedListener listener);
172
173 /**
174 * Called when an update to the notification view hierarchy is completed.
175 */
176 default void onNotificationViewUpdateFinished() {}
177
178 /**
179 * Returns true if there are pulsing notifications.
180 *
181 * @return true if has pulsing notifications
182 */
183 boolean hasPulsingNotifications();
Selim Cinek2627d722018-01-19 12:16:49 -0800184
185 /**
186 * Apply parameters of the expand animation to the layout
187 */
188 default void applyExpandAnimationParams(ExpandAnimationParameters params) {}
189
190 default void setExpandingNotification(ExpandableNotificationRow row) {}
Eliot Courtney2b4c3a02017-11-27 13:27:46 +0900191}