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

Commit 9cbadd3c authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Always use algorithm to set the children height.

This makes possible to animate between different children heights
between the states.

Change-Id: I5d74814a84c7ff5406481c3ab0553530ee20997b
parent 98fb09c2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1289,7 +1289,7 @@ public abstract class BaseStatusBar extends SystemUI implements
            if (userChangedExpansion) {
                boolean userExpanded = oldEntry.row.isUserExpanded();
                newEntry.row.setUserExpanded(userExpanded);
                newEntry.row.applyExpansionToLayout();
                newEntry.row.notifyHeightChanged();
            }
        }

+5 −10
Original line number Diff line number Diff line
@@ -137,7 +137,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
     */
    public void setSystemExpanded(boolean expand) {
        mIsSystemExpanded = expand;
        applyExpansionToLayout();
        notifyHeightChanged();
    }

    /**
@@ -145,7 +145,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
     */
    public void setExpansionDisabled(boolean expansionDisabled) {
        mExpansionDisabled = expansionDisabled;
        applyExpansionToLayout();
        notifyHeightChanged();
    }

    /**
@@ -160,13 +160,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
        }
    }

    /**
     * If {@link #isExpanded()} then this is the greatest possible height this view can
     * get and otherwise it is {@link #mRowMinHeight}.
     *
     * @return the maximum allowed expansion height of this view.
     */
    public int getMaximumAllowedExpandHeight() {
    @Override
    public int getIntrinsicHeight() {
        if (isUserLocked()) {
            return getActualHeight();
        }
@@ -234,7 +229,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
     * @return the potential height this view could expand in addition.
     */
    public int getExpandPotential() {
        return getMaximumAllowedExpandHeight() - getActualHeight();
        return getIntrinsicHeight() - getActualHeight();
    }

    @Override
+15 −4
Original line number Diff line number Diff line
@@ -55,15 +55,13 @@ public abstract class ExpandableView extends FrameLayout {
     */
    public void setActualHeight(int actualHeight) {
        mActualHeight = actualHeight;
        if (mOnHeightChangedListener != null) {
            mOnHeightChangedListener.onHeightChanged(this);
        }
        notifyHeightChanged();
    }

    /**
     * See {@link #setActualHeight}.
     *
     * @return The actual height of this notification.
     * @return The current actual height of this notification.
     */
    public int getActualHeight() {
        return mActualHeight;
@@ -83,6 +81,13 @@ public abstract class ExpandableView extends FrameLayout {
        return getHeight();
    }

    /**
     * @return The desired notification height.
     */
    public int getIntrinsicHeight() {
        return mActualHeight;
    }

    /**
     * Sets the amount this view should be clipped from the top. This is used when an expanded
     * notification is scrolling in the top or bottom stack.
@@ -104,6 +109,12 @@ public abstract class ExpandableView extends FrameLayout {
        return false;
    }

    public void notifyHeightChanged() {
        if (mOnHeightChangedListener != null) {
            mOnHeightChangedListener.onHeightChanged(this);
        }
    }

    /**
     * A listener notifying when {@link #getActualHeight} changes.
     */
+2 −2
Original line number Diff line number Diff line
@@ -757,7 +757,7 @@ public class NotificationStackScrollLayout extends ViewGroup
    private int getMaxExpandHeight(View view) {
        if (view instanceof ExpandableNotificationRow) {
            ExpandableNotificationRow row = (ExpandableNotificationRow) view;
            return row.getMaximumAllowedExpandHeight();
            return row.getIntrinsicHeight();
        }
        return view.getHeight();
    }
@@ -777,7 +777,7 @@ public class NotificationStackScrollLayout extends ViewGroup
                }
                if (child instanceof ExpandableNotificationRow) {
                    ExpandableNotificationRow row = (ExpandableNotificationRow) child;
                    height += row.getMaximumAllowedExpandHeight();
                    height += row.getIntrinsicHeight();
                } else if (child instanceof ExpandableView) {
                    ExpandableView expandableView = (ExpandableView) child;
                    height += expandableView.getActualHeight();
+1 −1
Original line number Diff line number Diff line
@@ -275,7 +275,7 @@ public class StackScrollAlgorithm {
    private int getMaxAllowedChildHeight(View child) {
        if (child instanceof ExpandableNotificationRow) {
            ExpandableNotificationRow row = (ExpandableNotificationRow) child;
            return row.getMaximumAllowedExpandHeight();
            return row.getIntrinsicHeight();
        } else if (child instanceof ExpandableView) {
            ExpandableView expandableView = (ExpandableView) child;
            return expandableView.getActualHeight();
Loading