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.data.repository 18 19 import com.android.systemui.dagger.SysUISingleton 20 import com.android.systemui.statusbar.notification.stack.shared.model.AccessibilityScrollEvent 21 import com.android.systemui.statusbar.notification.stack.shared.model.ShadeScrimBounds 22 import com.android.systemui.statusbar.notification.stack.shared.model.ShadeScrimShape 23 import com.android.systemui.statusbar.notification.stack.shared.model.ShadeScrollState 24 import java.util.function.Consumer 25 import javax.inject.Inject 26 import kotlinx.coroutines.flow.MutableStateFlow 27 28 /** 29 * This repository contains state generated by the composable placeholders to define the position 30 * and appearance of the notification stack and related visual elements 31 */ 32 @SysUISingleton 33 class NotificationPlaceholderRepository @Inject constructor() { 34 35 /** The alpha of the shade in order to show brightness. */ 36 val alphaForBrightnessMirror = MutableStateFlow(1f) 37 38 /** The alpha of the Notification Stack for lockscreen fade-in */ 39 val alphaForLockscreenFadeIn = MutableStateFlow(0f) 40 41 /** 42 * The bounds of the notification shade scrim / container in the current scene. 43 * 44 * When `null`, clipping should not be applied to notifications. 45 */ 46 val notificationShadeScrimBounds = MutableStateFlow<ShadeScrimBounds?>(null) 47 48 /** height made available to the notifications in the size-constrained mode of lock screen. */ 49 val constrainedAvailableSpace = MutableStateFlow(0) 50 51 /** Scroll state of the notification shade. */ 52 val shadeScrollState = MutableStateFlow(ShadeScrollState()) 53 54 /** A consumer of [AccessibilityScrollEvent]s. */ 55 var accessibilityScrollEventConsumer: Consumer<AccessibilityScrollEvent>? = null 56 57 /** 58 * A consumer of [ShadeScrimShape], to be updated when the bounds of the QuickSettings Overlay 59 * panel changes. 60 */ 61 var qsPanelShapeConsumer: ((ShadeScrimShape?) -> Unit)? = null 62 } 63