1 /* 2 * Copyright (C) 2024 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.stack.ui.view 18 19 import android.view.View 20 import com.android.systemui.statusbar.notification.stack.shared.model.ShadeScrimShape 21 import java.util.function.Consumer 22 23 /** 24 * This view (interface) is the view which scrolls and positions the heads up notification and 25 * notification stack, but is otherwise agnostic to the content. 26 */ 27 interface NotificationScrollView { 28 29 /** 30 * Height in view pixels at which the Notification Stack would like to be laid out, including 31 * Notification rows, paddings the Shelf and the Footer. 32 */ 33 val intrinsicStackHeight: Int 34 35 /** Height in pixels required to display the top HeadsUp Notification. */ 36 val topHeadsUpHeight: Int 37 38 /** 39 * Since this is an interface rather than a literal View, this provides cast-like access to the 40 * underlying view. 41 */ asViewnull42 fun asView(): View 43 44 /** Max alpha for this view */ 45 fun setMaxAlpha(alpha: Float) 46 47 /** Set the clipping bounds used when drawing */ 48 fun setScrimClippingShape(shape: ShadeScrimShape?) 49 50 /** set the y position in px of the top of the stack in this view's coordinates */ 51 fun setStackTop(stackTop: Float) 52 53 /** set the y position in px of the bottom of the stack in this view's coordinates */ 54 fun setStackBottom(stackBottom: Float) 55 56 /** set the y position in px of the top of the HUN in this view's coordinates */ 57 fun setHeadsUpTop(headsUpTop: Float) 58 59 /** set whether the view has been scrolled all the way to the top */ 60 fun setScrolledToTop(scrolledToTop: Boolean) 61 62 /** Set a consumer for synthetic scroll events */ 63 fun setSyntheticScrollConsumer(consumer: Consumer<Float>?) 64 /** Set a consumer for current gesture overscroll events */ 65 fun setCurrentGestureOverscrollConsumer(consumer: Consumer<Boolean>?) 66 /** Set a consumer for heads up height changed events */ 67 fun setHeadsUpHeightConsumer(consumer: Consumer<Float>?) 68 69 /** sets that scrolling is allowed */ 70 fun setScrollingEnabled(enabled: Boolean) 71 72 /** sets the current expand fraction */ 73 fun setExpandFraction(expandFraction: Float) 74 75 /** Sets whether the view is displayed in doze mode. */ 76 fun setDozing(dozing: Boolean) 77 78 /** Adds a listener to be notified, when the stack height might have changed. */ 79 fun addStackHeightChangedListener(runnable: Runnable) 80 81 /** @see addStackHeightChangedListener */ 82 fun removeStackHeightChangedListener(runnable: Runnable) 83 84 /** 85 * Adds a listener to be notified, when the height of the top heads up notification might have 86 * changed. 87 */ 88 fun addHeadsUpHeightChangedListener(runnable: Runnable) 89 90 /** @see addHeadsUpHeightChangedListener */ 91 fun removeHeadsUpHeightChangedListener(runnable: Runnable) 92 } 93