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

Commit 73cf02a0 authored by Selim Cinek's avatar Selim Cinek
Browse files

Fixed a bug where the expanded layout would flash

When the heads up disappeared from the shade, it's layout would
switch to the expanded state. We're now delaying this until
the animation is done.

Change-Id: I6c5c970f6b471fb10b197922dfea520b07c84abc
Fixes: 	29318819
parent e9bad242
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -186,6 +186,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
                }
    };
    private OnClickListener mOnClickListener;
    private boolean mHeadsupDisappearRunning;
    private View mChildAfterViewWhenDismissed;
    private View mGroupParentWhenDismissed;
    private boolean mRefocusOnDismiss;
@@ -769,6 +770,11 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
        return mChildrenContainer;
    }

    public void setHeadsupDisappearRunning(boolean running) {
        mHeadsupDisappearRunning = running;
        mPrivateLayout.setHeadsupDisappearRunning(running);
    }

    public View getChildAfterViewWhenDismissed() {
        return mChildAfterViewWhenDismissed;
    }
@@ -1174,8 +1180,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
            return getMinHeight();
        } else if (mIsSummaryWithChildren && !mOnKeyguard) {
            return mChildrenContainer.getIntrinsicHeight();
        } else if (mIsHeadsUp) {
            if (isPinned()) {
        } else if (mIsHeadsUp || mHeadsupDisappearRunning) {
            if (isPinned() || mHeadsupDisappearRunning) {
                return getPinnedHeadsUpHeight(true /* atLeastMinHeight */);
            } else if (isExpanded()) {
                return Math.max(getMaxExpandHeight(), mHeadsUpHeight);
+9 −2
Original line number Diff line number Diff line
@@ -119,6 +119,7 @@ public class NotificationContentView extends FrameLayout {

    private int mContentHeightAtAnimationStart = UNDEFINED;
    private boolean mFocusOnVisibilityChange;
    private boolean mHeadsupDisappearRunning;


    public NotificationContentView(Context context, AttributeSet attrs) {
@@ -446,7 +447,8 @@ public class NotificationContentView extends FrameLayout {
            boolean transitioningBetweenHunAndExpanded =
                    isTransitioningFromTo(VISIBLE_TYPE_HEADSUP, VISIBLE_TYPE_EXPANDED) ||
                    isTransitioningFromTo(VISIBLE_TYPE_EXPANDED, VISIBLE_TYPE_HEADSUP);
            boolean pinned = !isVisibleOrTransitioning(VISIBLE_TYPE_CONTRACTED) && mIsHeadsUp;
            boolean pinned = !isVisibleOrTransitioning(VISIBLE_TYPE_CONTRACTED)
                    && (mIsHeadsUp || mHeadsupDisappearRunning);
            if (transitioningBetweenHunAndExpanded || pinned) {
                return Math.min(mHeadsUpChild.getHeight(), mExpandedChild.getHeight());
            }
@@ -830,7 +832,7 @@ public class NotificationContentView extends FrameLayout {
            return VISIBLE_TYPE_SINGLELINE;
        }

        if (mIsHeadsUp && mHeadsUpChild != null) {
        if ((mIsHeadsUp || mHeadsupDisappearRunning) && mHeadsUpChild != null) {
            if (viewHeight <= mHeadsUpChild.getHeight() || noExpandedChild) {
                return VISIBLE_TYPE_HEADSUP;
            } else {
@@ -1153,6 +1155,11 @@ public class NotificationContentView extends FrameLayout {
        }
    }

    public void setHeadsupDisappearRunning(boolean headsupDisappearRunning) {
        mHeadsupDisappearRunning = headsupDisappearRunning;
        selectLayout(false /* animate */, true /* force */);
    }

    public void setFocusOnVisibilityChange() {
        mFocusOnVisibilityChange = true;
    }
+3 −0
Original line number Diff line number Diff line
@@ -3690,6 +3690,9 @@ public class NotificationStackScrollLayout extends ViewGroup
        if (mAnimationsEnabled) {
            mHeadsUpChangeAnimations.add(new Pair<>(row, isHeadsUp));
            mNeedsAnimation = true;
            if (!mIsExpanded && !isHeadsUp) {
                row.setHeadsupDisappearRunning(true);
            }
            requestChildrenUpdate();
        }
    }
+4 −0
Original line number Diff line number Diff line
@@ -733,6 +733,7 @@ public class StackStateAnimator {
            animator.setStartDelay(delay);
        }
        animator.addListener(getGlobalAnimationFinishedListener());
        final boolean isHeadsUpDisappear = mHeadsUpDisappearChildren.contains(child);
        // remove the tag when the animation is finished
        animator.addListener(new AnimatorListenerAdapter() {
            @Override
@@ -741,6 +742,9 @@ public class StackStateAnimator {
                child.setTag(TAG_ANIMATOR_TRANSLATION_Y, null);
                child.setTag(TAG_START_TRANSLATION_Y, null);
                child.setTag(TAG_END_TRANSLATION_Y, null);
                if (isHeadsUpDisappear) {
                    ((ExpandableNotificationRow) child).setHeadsupDisappearRunning(false);
                }
            }
        });
        startAnimator(animator);