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.render; 18 19 import com.android.systemui.statusbar.notification.collection.EntryAdapter; 20 import com.android.systemui.statusbar.notification.collection.NotificationEntry; 21 import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; 22 23 /** 24 * Tracks expanded notification states for groups. This expanded state should not be confused by the 25 * expanded/collapsed state of a single notification which is tracked within each 26 * ExpandableNotificationRow. 27 */ 28 public interface GroupExpansionManager { 29 30 /** 31 * Register a listener for group expansion changes 32 */ registerGroupExpansionChangeListener(OnGroupExpansionChangeListener listener)33 void registerGroupExpansionChangeListener(OnGroupExpansionChangeListener listener); 34 35 /** 36 * Whether the group associated with this notification is expanded. 37 * If this notification is not part of a group, it will always return false. 38 */ isGroupExpanded(NotificationEntry entry)39 boolean isGroupExpanded(NotificationEntry entry); 40 41 /** 42 * Whether the parent associated with this notification is expanded. 43 * If this notification is not part of a group or bundle, it will always return false. 44 */ isGroupExpanded(EntryAdapter entry)45 boolean isGroupExpanded(EntryAdapter entry); 46 47 /** 48 * Set whether the group/bundle associated with this notification is expanded or not. 49 */ setGroupExpanded(EntryAdapter entry, boolean expanded)50 void setGroupExpanded(EntryAdapter entry, boolean expanded); 51 52 /** @return group/bundle expansion state after toggling. */ toggleGroupExpansion(EntryAdapter entry)53 boolean toggleGroupExpansion(EntryAdapter entry); 54 55 /** 56 * Set whether the group associated with this notification is expanded or not. 57 */ setGroupExpanded(NotificationEntry entry, boolean expanded)58 void setGroupExpanded(NotificationEntry entry, boolean expanded); 59 60 /** @return group expansion state after toggling. */ toggleGroupExpansion(NotificationEntry entry)61 boolean toggleGroupExpansion(NotificationEntry entry); 62 63 /** 64 * Set expanded=false for all groups 65 */ collapseGroups()66 void collapseGroups(); 67 68 /** 69 * Listener for group expansion changes. 70 */ 71 interface OnGroupExpansionChangeListener { 72 /** 73 * The expansion of a group has changed. 74 * 75 * @param changedRow the row for which the expansion has changed, which is also the summary 76 * @param expanded a boolean indicating the new expanded state 77 */ onGroupExpansionChange(ExpandableNotificationRow changedRow, boolean expanded)78 void onGroupExpansionChange(ExpandableNotificationRow changedRow, boolean expanded); 79 } 80 } 81