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

Commit 5685c124 authored by Selim Cinek's avatar Selim Cinek Committed by Android Git Automerger
Browse files

am 68597329: Merge "Fixed an animation bug with inline view updates" into lmp-dev

* commit '68597329a7259333f56a856032f71f0ee44b493a':
  Fixed an animation bug with inline view updates
parents 544333ee e4e2cc3c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -660,6 +660,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
    }

    public void reset() {
        super.reset();
        setTintColor(0);
        setShowingLegacyBackground(false);
        setBelowSpeedBump(false);
+4 −1
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
    private boolean mClearable;
    private ExpansionLogger mLogger;
    private String mLoggingKey;
    private boolean mWasReset;

    public interface ExpansionLogger {
        public void logNotificationExpansion(String key, boolean userAction, boolean expanded);
@@ -88,6 +89,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
        mPublicLayout.reset();
        mPrivateLayout.reset();
        mMaxExpandHeight = 0;
        mWasReset = true;
        logExpansionEvent(false, wasExpanded);
    }

@@ -246,11 +248,12 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
    @Override
    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
        super.onLayout(changed, left, top, right, bottom);
        boolean updateExpandHeight = mMaxExpandHeight == 0;
        boolean updateExpandHeight = mMaxExpandHeight == 0 && !mWasReset;
        mMaxExpandHeight = mPrivateLayout.getMaxHeight();
        if (updateExpandHeight) {
            applyExpansionToLayout();
        }
        mWasReset = false;
    }

    public void setSensitive(boolean sensitive) {
+11 −0
Original line number Diff line number Diff line
@@ -255,6 +255,10 @@ public abstract class ExpandableView extends FrameLayout {
    public void setBelowSpeedBump(boolean below) {
    }

    public void reset() {
        mOnHeightChangedListener.onReset(this);
    }

    /**
     * A listener notifying when {@link #getActualHeight} changes.
     */
@@ -265,5 +269,12 @@ public abstract class ExpandableView extends FrameLayout {
         *             padding or the padding between the elements changed
         */
        void onHeightChanged(ExpandableView view);

        /**
         * Called when the view is reset and therefore the height will change abruptly
         *
         * @param view The view which was reset.
         */
        void onReset(ExpandableView view);
    }
}
+4 −0
Original line number Diff line number Diff line
@@ -1468,6 +1468,10 @@ public class NotificationPanelView extends PanelView implements
        requestPanelHeightUpdate();
    }

    @Override
    public void onReset(ExpandableView view) {
    }

    @Override
    public void onScrollChanged() {
        if (mQsExpanded) {
+37 −0
Original line number Diff line number Diff line
@@ -163,6 +163,8 @@ public class NotificationStackScrollLayout extends ViewGroup
    private int mNotificationTopPadding;
    private float mTopPaddingOverflow;
    private boolean mDontReportNextOverScroll;
    private boolean mRequestViewResizeAnimationOnLayout;
    private boolean mNeedViewResizeAnimation;

    /**
     * The maximum scrollPosition which we are allowed to reach when a notification was expanded.
@@ -319,9 +321,18 @@ public class NotificationStackScrollLayout extends ViewGroup
        setMaxLayoutHeight(getHeight());
        updateContentHeight();
        clampScrollPosition();
        requestAnimationOnViewResize();
        requestChildrenUpdate();
    }

    private void requestAnimationOnViewResize() {
        if (mRequestViewResizeAnimationOnLayout && mIsExpanded && mAnimationsEnabled) {
            mNeedViewResizeAnimation = true;
            mNeedsAnimation = true;
        }
        mRequestViewResizeAnimationOnLayout = false;
    }

    public void updateSpeedBumpIndex(int newIndex) {
        int currentIndex = indexOfChild(mSpeedBumpView);

@@ -1598,9 +1609,18 @@ public class NotificationStackScrollLayout extends ViewGroup
        generateHideSensitiveEvent();
        generateDarkEvent();
        generateGoToFullShadeEvent();
        generateViewResizeEvent();
        mNeedsAnimation = false;
    }

    private void generateViewResizeEvent() {
        if (mNeedViewResizeAnimation) {
            mAnimationEvents.add(
                    new AnimationEvent(null, AnimationEvent.ANIMATION_TYPE_VIEW_RESIZE));
        }
        mNeedViewResizeAnimation = false;
    }

    private void generateSnapBackEvents() {
        for (View child : mSnappedBackChildren) {
            mAnimationEvents.add(new AnimationEvent(child,
@@ -1892,6 +1912,11 @@ public class NotificationStackScrollLayout extends ViewGroup
        requestChildrenUpdate();
    }

    @Override
    public void onReset(ExpandableView view) {
        mRequestViewResizeAnimationOnLayout = true;
    }

    private void updateScrollPositionOnExpandInBottom(ExpandableView view) {
        if (view instanceof ExpandableNotificationRow) {
            ExpandableNotificationRow row = (ExpandableNotificationRow) view;
@@ -2258,6 +2283,14 @@ public class NotificationStackScrollLayout extends ViewGroup
                // ANIMATION_TYPE_HIDE_SENSITIVE
                new AnimationFilter()
                        .animateHideSensitive(),

                // ANIMATION_TYPE_VIEW_RESIZE
                new AnimationFilter()
                        .animateAlpha()
                        .animateHeight()
                        .animateTopInset()
                        .animateY()
                        .animateZ(),
        };

        static int[] LENGTHS = new int[] {
@@ -2297,6 +2330,9 @@ public class NotificationStackScrollLayout extends ViewGroup

                // ANIMATION_TYPE_HIDE_SENSITIVE
                StackStateAnimator.ANIMATION_DURATION_STANDARD,

                // ANIMATION_TYPE_VIEW_RESIZE
                StackStateAnimator.ANIMATION_DURATION_STANDARD,
        };

        static final int ANIMATION_TYPE_ADD = 0;
@@ -2311,6 +2347,7 @@ public class NotificationStackScrollLayout extends ViewGroup
        static final int ANIMATION_TYPE_DARK = 9;
        static final int ANIMATION_TYPE_GO_TO_FULL_SHADE = 10;
        static final int ANIMATION_TYPE_HIDE_SENSITIVE = 11;
        static final int ANIMATION_TYPE_VIEW_RESIZE = 12;

        final long eventStartTime;
        final View changingView;