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

Commit 397e411a authored by Selim Cinek's avatar Selim Cinek Committed by Android (Google) Code Review
Browse files

Merge "Fix first child handling with GONE children." into master-lockscreen-dev

parents 3c149391 9f347ae2
Loading
Loading
Loading
Loading
+13 −5
Original line number Original line Diff line number Diff line
@@ -415,11 +415,9 @@ public class StackScrollAlgorithm {
     */
     */
    private void updateZValuesForState(StackScrollState resultState,
    private void updateZValuesForState(StackScrollState resultState,
            StackScrollAlgorithmState algorithmState) {
            StackScrollAlgorithmState algorithmState) {
        ViewGroup hostView = resultState.getHostView();
        int childCount = algorithmState.visibleChildren.size();
        int childCount = algorithmState.visibleChildren.size();
        for (int i = 0; i < childCount; i++) {
        for (int i = 0; i < childCount; i++) {
            View child = algorithmState.visibleChildren.get(i);
            View child = algorithmState.visibleChildren.get(i);
            if (child.getVisibility() == View.GONE) continue;
            StackScrollState.ViewState childViewState = resultState.getViewStateForView(child);
            StackScrollState.ViewState childViewState = resultState.getViewStateForView(child);
            if (i < algorithmState.itemsInTopStack) {
            if (i < algorithmState.itemsInTopStack) {
                float stackIndex = algorithmState.itemsInTopStack - i;
                float stackIndex = algorithmState.itemsInTopStack - i;
@@ -453,8 +451,8 @@ public class StackScrollAlgorithm {
    }
    }


    private void updateFirstChildHeightWhileExpanding(ViewGroup hostView) {
    private void updateFirstChildHeightWhileExpanding(ViewGroup hostView) {
        if (hostView.getChildCount() > 0) {
        mFirstChildWhileExpanding = findFirstVisibleChild(hostView);
            mFirstChildWhileExpanding = hostView.getChildAt(0);
        if (mFirstChildWhileExpanding != null) {
            if (mExpandedOnStart) {
            if (mExpandedOnStart) {


                // We are collapsing the shade, so the first child can get as most as high as the
                // We are collapsing the shade, so the first child can get as most as high as the
@@ -466,11 +464,21 @@ public class StackScrollAlgorithm {
                mFirstChildMaxHeight = getMaxAllowedChildHeight(mFirstChildWhileExpanding);
                mFirstChildMaxHeight = getMaxAllowedChildHeight(mFirstChildWhileExpanding);
            }
            }
        } else {
        } else {
            mFirstChildWhileExpanding = null;
            mFirstChildMaxHeight = 0;
            mFirstChildMaxHeight = 0;
        }
        }
    }
    }


    private View findFirstVisibleChild(ViewGroup container) {
        int childCount = container.getChildCount();
        for (int i = 0; i < childCount; i++) {
            View child = container.getChildAt(i);
            if (child.getVisibility() != View.GONE) {
                return child;
            }
        }
        return null;
    }

    public void onExpansionStopped() {
    public void onExpansionStopped() {
        mIsExpansionChanging = false;
        mIsExpansionChanging = false;
        mFirstChildWhileExpanding = null;
        mFirstChildWhileExpanding = null;