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

Commit b55386d6 authored by Selim Cinek's avatar Selim Cinek
Browse files

Fixed the minimum height of groups on the lockscreen

Also caching the notification minheight in the algorithm
far less agressively, because it led to bugs.

Change-Id: I57155103bf2700be2e98e686fdd0077ce8e8405b
parent af0dc318
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ import android.view.NotificationHeaderView;
import android.view.View;
import android.view.ViewStub;
import android.view.accessibility.AccessibilityEvent;
import android.view.animation.LinearInterpolator;
import android.widget.Chronometer;
import android.widget.ImageView;
import android.widget.RemoteViews;
@@ -965,6 +964,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {

    @Override
    public int getMinHeight() {
        if (mIsSummaryWithChildren && !isGroupExpanded() && !mShowingPublic) {
            return mChildrenContainer.getMinHeight();
        }
        NotificationContentView showingLayout = getShowingLayout();
        return showingLayout.getMinHeight();
    }
@@ -972,7 +974,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
    @Override
    public int getMinExpandHeight() {
        if (mIsSummaryWithChildren && !mOnKeyguard) {
            return mChildrenContainer.getMinHeight();
            return mChildrenContainer.getMinExpandHeight();
        }
        return getMinHeight();
    }
+4 −0
Original line number Diff line number Diff line
@@ -463,6 +463,10 @@ public class NotificationChildrenContainer extends ViewGroup {
    }

    public int getMinHeight() {
        return getIntrinsicHeight(NUMBER_OF_CHILDREN_WHEN_COLLAPSED);
    }

    public int getMinExpandHeight() {
        return getIntrinsicHeight(getMaxAllowedVisibleChildren(true /* forceCollapsed */));
    }

+3 −5
Original line number Diff line number Diff line
@@ -367,7 +367,6 @@ public class NotificationStackScrollLayout extends ViewGroup
            mRequestViewResizeAnimationOnLayout = false;
        }
        requestChildrenUpdate();
        mStackScrollAlgorithm.notifyChildrenSizesChanged(this);
    }

    private void requestAnimationOnViewResize() {
@@ -1339,7 +1338,7 @@ public class NotificationStackScrollLayout extends ViewGroup
    /**
     * @return the first child which has visibility unequal to GONE
     */
    private ExpandableView getFirstChildNotGone() {
    public ExpandableView getFirstChildNotGone() {
        int childCount = getChildCount();
        for (int i = 0; i < childCount; i++) {
            View child = getChildAt(i);
@@ -1640,7 +1639,7 @@ public class NotificationStackScrollLayout extends ViewGroup
    }

    private void onViewRemovedInternal(View child) {
        mStackScrollAlgorithm.notifyChildrenSizesChanged(this);
        mStackScrollAlgorithm.notifyChildrenChanged(this);
        if (mChangePositionInProgress) {
            // This is only a position change, don't do anything special
            return;
@@ -1794,7 +1793,7 @@ public class NotificationStackScrollLayout extends ViewGroup

    private void onViewAddedInternal(View child) {
        updateHideSensitiveForChild(child);
        mStackScrollAlgorithm.notifyChildrenSizesChanged(this);
        mStackScrollAlgorithm.notifyChildrenChanged(this);
        ((ExpandableView) child).setOnHeightChangedListener(this);
        generateAddAnimation(child, false /* fromMoreCard */);
        updateAnimationState(child);
@@ -2837,7 +2836,6 @@ public class NotificationStackScrollLayout extends ViewGroup
    public void setHeadsUpManager(HeadsUpManager headsUpManager) {
        mHeadsUpManager = headsUpManager;
        mAmbientState.setHeadsUpManager(headsUpManager);
        mStackScrollAlgorithm.setHeadsUpManager(headsUpManager);
    }

    public void generateHeadsUpAnimation(ExpandableNotificationRow row, boolean isHeadsUp) {
+4 −15
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ import android.view.ViewGroup;
import com.android.systemui.R;
import com.android.systemui.statusbar.ExpandableNotificationRow;
import com.android.systemui.statusbar.ExpandableView;
import com.android.systemui.statusbar.policy.HeadsUpManager;

import java.util.ArrayList;
import java.util.List;
@@ -68,10 +67,8 @@ public class StackScrollAlgorithm {
    private int mBottomStackSlowDownLength;
    private int mTopStackSlowDownLength;
    private int mCollapseSecondCardPadding;
    private boolean mIsSmallScreen;
    private int mMaxNotificationHeight;
    private boolean mScaleDimmed;
    private HeadsUpManager mHeadsUpManager;
    private ExpandableView mFirstChild;
    private int mFirstChildMinHeight;
    private boolean mDimmed;

@@ -115,8 +112,6 @@ public class StackScrollAlgorithm {
                .getDimensionPixelSize(R.dimen.notifications_top_padding);
        mCollapsedSize = context.getResources()
                .getDimensionPixelSize(R.dimen.notification_min_height);
        mMaxNotificationHeight = context.getResources()
                .getDimensionPixelSize(R.dimen.notification_max_height);
        mTopStackPeekSize = context.getResources()
                .getDimensionPixelSize(R.dimen.top_stack_peek_amount);
        mBottomStackPeekSize = context.getResources()
@@ -154,6 +149,7 @@ public class StackScrollAlgorithm {
        algorithmState.scrolledPixelsTop = 0;
        algorithmState.itemsInBottomStack = 0.0f;
        algorithmState.partialInBottom = 0.0f;
        mFirstChildMinHeight = mFirstChild == null ? 0 : mFirstChild.getMinHeight();
        float bottomOverScroll = ambientState.getOverScrollAmount(false /* onTop */);

        int scrollY = ambientState.getScrollY();
@@ -937,11 +933,8 @@ public class StackScrollAlgorithm {
        this.mIsExpanded = isExpanded;
    }

    public void notifyChildrenSizesChanged(final NotificationStackScrollLayout hostView) {
        int firstItemMinHeight = hostView.getFirstItemMinHeight();
        if (firstItemMinHeight != mFirstChildMinHeight) {
            mFirstChildMinHeight = firstItemMinHeight;
        }
    public void notifyChildrenChanged(final NotificationStackScrollLayout hostView) {
        mFirstChild = hostView.getFirstChildNotGone();
        if (mIsExpansionChanging) {
            hostView.post(new Runnable() {
                @Override
@@ -963,10 +956,6 @@ public class StackScrollAlgorithm {
        }
    }

    public void setHeadsUpManager(HeadsUpManager headsUpManager) {
        mHeadsUpManager = headsUpManager;
    }

    class StackScrollAlgorithmState {

        /**