1 /* 2 * Copyright (C) 2022 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.shade 18 19 /** Provides certain notification panel events. */ 20 interface ShadeStateEvents { 21 22 /** Registers callbacks to be invoked when notification panel events occur. */ 23 fun addShadeStateEventsListener(listener: ShadeStateEventsListener) 24 25 /** Unregisters callbacks previously registered via [addShadeStateEventsListener] */ 26 fun removeShadeStateEventsListener(listener: ShadeStateEventsListener) 27 28 /** Callbacks for certain notification panel events. */ 29 interface ShadeStateEventsListener { 30 31 /** Invoked when the notification panel starts or stops collapsing. */ 32 @JvmDefault fun onPanelCollapsingChanged(isCollapsing: Boolean) {} 33 34 /** 35 * Invoked when the notification panel starts or stops launching an [android.app.Activity]. 36 */ 37 @JvmDefault fun onLaunchingActivityChanged(isLaunchingActivity: Boolean) {} 38 39 /** 40 * Invoked when the "expand immediate" attribute changes. 41 * 42 * An example of expanding immediately is when swiping down from the top with two fingers. 43 * Instead of going to QQS, we immediately expand to full QS. 44 * 45 * Another example is when full QS is showing, and we swipe up from the bottom. Instead of 46 * going to QQS, the panel fully collapses. 47 */ 48 @JvmDefault fun onExpandImmediateChanged(isExpandImmediateEnabled: Boolean) {} 49 } 50 } 51