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

Commit 5d3d2d05 authored by Eliot Courtney's avatar Eliot Courtney
Browse files

Make NotificationShelf nullable in StackScrollAlgorithm.

Bug: 63874929
Bug: 62602530
Test: runtest systemui
Test: Compile and run
Change-Id: Id6e73fd45bfee6575e680f129a57004b16f87712
parent d01ec8fe
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.statusbar.stack;

import android.annotation.Nullable;
import android.content.Context;
import android.view.View;

@@ -236,6 +237,7 @@ public class AmbientState {
        mShelf = shelf;
    }

    @Nullable
    public NotificationShelf getShelf() {
        return mShelf;
    }
+9 −2
Original line number Diff line number Diff line
@@ -122,8 +122,10 @@ public class StackScrollAlgorithm {
    }
    private void updateShelfState(StackScrollState resultState, AmbientState ambientState) {
        NotificationShelf shelf = ambientState.getShelf();
        if (shelf != null) {
            shelf.updateState(resultState, ambientState);
        }
    }

    private void updateClipping(StackScrollState resultState,
            StackScrollAlgorithmState algorithmState, AmbientState ambientState) {
@@ -495,6 +497,10 @@ public class StackScrollAlgorithm {
     */
    private void clampPositionToShelf(ExpandableViewState childViewState,
            AmbientState ambientState) {
        if (ambientState.getShelf() == null) {
            return;
        }

        int shelfStart = ambientState.getInnerHeight()
                - ambientState.getShelf().getIntrinsicHeight();
        childViewState.yTranslation = Math.min(childViewState.yTranslation, shelfStart);
@@ -556,7 +562,8 @@ public class StackScrollAlgorithm {
        } else if (i == 0 && ambientState.isAboveShelf(child)) {
            // In case this is a new view that has never been measured before, we don't want to
            // elevate if we are currently expanded more then the notification
            int shelfHeight = ambientState.getShelf().getIntrinsicHeight();
            int shelfHeight = ambientState.getShelf() == null ? 0 :
                    ambientState.getShelf().getIntrinsicHeight();
            float shelfStart = ambientState.getInnerHeight()
                    - shelfHeight + ambientState.getTopPadding()
                    + ambientState.getStackTranslation();