Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2b55149a authored by András Kurucz's avatar András Kurucz
Browse files

[Flexiglass] Set headsUpTop directly on the NSSL

Instead of looping through a Flow or State, we wan't to set the
headsUpTop value from the composable placeholder to the NSSL, so we have
better control over when does this value reachign the NSSL.

Bug: 339181697
Test: post HUNs, open the shade, open quick settings, check if the value
is set on the NSSL
Flag: com.android.systemui.scene_container

Change-Id: I73afc333de8a15d0cb938bc13c65cacffd425988
parent 174c9fe3
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -126,7 +126,8 @@ fun SceneScope.HeadsUpNotificationSpace(
                            " size=${coordinates.size}" +
                            " bounds=$boundsInWindow"
                    }
                    viewModel.onHeadsUpTopChanged(boundsInWindow.top)
                    // Note: boundsInWindow doesn't scroll off the screen
                    stackScrollView.setHeadsUpTop(boundsInWindow.top)
                }
    ) {
        content {}
+0 −3
Original line number Diff line number Diff line
@@ -38,9 +38,6 @@ class NotificationPlaceholderRepository @Inject constructor() {
     */
    val shadeScrimBounds = MutableStateFlow<ShadeScrimBounds?>(null)

    /** the y position of the top of the HUN area */
    val headsUpTop = MutableStateFlow(0f)

    /** height made available to the notifications in the size-constrained mode of lock screen. */
    val constrainedAvailableSpace = MutableStateFlow(0)

+0 −7
Original line number Diff line number Diff line
@@ -79,9 +79,6 @@ constructor(
     */
    val scrolledToTop: StateFlow<Boolean> = placeholderRepository.scrolledToTop.asStateFlow()

    /** The y-coordinate in px of bottom of the contents of the HUN. */
    val headsUpTop: StateFlow<Float> = placeholderRepository.headsUpTop.asStateFlow()

    /**
     * The amount in px that the notification stack should scroll due to internal expansion. This
     * should only happen when a notification expansion hits the bottom of the screen, so it is
@@ -125,8 +122,4 @@ constructor(
    fun setConstrainedAvailableSpace(height: Int) {
        placeholderRepository.constrainedAvailableSpace.value = height
    }

    fun setHeadsUpTop(headsUpTop: Float) {
        placeholderRepository.headsUpTop.value = headsUpTop
    }
}
+0 −2
Original line number Diff line number Diff line
@@ -139,8 +139,6 @@ constructor(
     */
    val scrolledToTop: Flow<Boolean> =
        stackAppearanceInteractor.scrolledToTop.dumpValue("scrolledToTop")
    /** The y-coordinate in px of bottom of the contents of the HUN. */
    val headsUpTop: Flow<Float> = stackAppearanceInteractor.headsUpTop.dumpValue("headsUpTop")

    /** Receives the amount (px) that the stack should scroll due to internal expansion. */
    val syntheticScrollConsumer: (Float) -> Unit = stackAppearanceInteractor::setSyntheticScroll
+0 −4
Original line number Diff line number Diff line
@@ -60,10 +60,6 @@ constructor(
        interactor.setConstrainedAvailableSpace(height)
    }

    fun onHeadsUpTopChanged(headsUpTop: Float) {
        interactor.setHeadsUpTop(headsUpTop)
    }

    /** Sets the content alpha for the current state of the brightness mirror */
    fun setAlphaForBrightnessMirror(alpha: Float) {
        interactor.setAlphaForBrightnessMirror(alpha)