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.Dumpable; 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 extends Dumpable { 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 * Set whether the group associated with this notification is expanded or not. 43 */ setGroupExpanded(NotificationEntry entry, boolean expanded)44 void setGroupExpanded(NotificationEntry entry, boolean expanded); 45 46 /** @return group expansion state after toggling. */ toggleGroupExpansion(NotificationEntry entry)47 boolean toggleGroupExpansion(NotificationEntry entry); 48 49 /** 50 * Set expanded=false for all groups 51 */ collapseGroups()52 void collapseGroups(); 53 54 /** 55 * Listener for group expansion changes. 56 */ 57 interface OnGroupExpansionChangeListener { 58 /** 59 * The expansion of a group has changed. 60 * 61 * @param changedRow the row for which the expansion has changed, which is also the summary 62 * @param expanded a boolean indicating the new expanded state 63 */ onGroupExpansionChange(ExpandableNotificationRow changedRow, boolean expanded)64 void onGroupExpansionChange(ExpandableNotificationRow changedRow, boolean expanded); 65 } 66 } 67