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

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

Fixed several bugs where the dismissview was not reachable.

Also fixes a bug where the maxExpandHeight was not correctly updated
and where notifications were wrongfully generated.
Finally it fixes an issue where initially the height of the panel was
not correct.

Bug: 17096130
Change-Id: I0f4a05187f31eef5cbbe364bfceb8806b5092cdf
parent c8316dfc
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -274,13 +274,21 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
        super.onLayout(changed, left, top, right, bottom);
        boolean updateExpandHeight = mMaxExpandHeight == 0 && !mWasReset;
        mMaxExpandHeight = mPrivateLayout.getMaxHeight();
        updateMaxExpandHeight();
        if (updateExpandHeight) {
            applyExpansionToLayout();
        }
        mWasReset = false;
    }

    private void updateMaxExpandHeight() {
        int intrinsicBefore = getIntrinsicHeight();
        mMaxExpandHeight = mPrivateLayout.getMaxHeight();
        if (intrinsicBefore != getIntrinsicHeight()) {
            notifyHeightChanged();
        }
    }

    public void setSensitive(boolean sensitive) {
        mSensitive = sensitive;
    }
+4 −1
Original line number Diff line number Diff line
@@ -96,7 +96,10 @@ public abstract class ExpandableView extends FrameLayout {
    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
        super.onLayout(changed, left, top, right, bottom);
        if (!mActualHeightInitialized && mActualHeight == 0) {
            setActualHeight(getInitialHeight());
            int initialHeight = getInitialHeight();
            if (initialHeight != 0) {
                setActualHeight(initialHeight);
            }
        }
    }

+8 −4
Original line number Diff line number Diff line
@@ -2094,15 +2094,16 @@ public class NotificationStackScrollLayout extends ViewGroup
        int oldVisibility = mEmptyShadeView.willBeGone() ? GONE : mEmptyShadeView.getVisibility();
        int newVisibility = visible ? VISIBLE : GONE;
        if (oldVisibility != newVisibility) {
            if (oldVisibility == GONE) {
            if (newVisibility != GONE) {
                if (mEmptyShadeView.willBeGone()) {
                    mEmptyShadeView.cancelAnimation();
                } else {
                    mEmptyShadeView.setInvisible();
                    mEmptyShadeView.setVisibility(newVisibility);
                }
                mEmptyShadeView.setVisibility(newVisibility);
                mEmptyShadeView.setWillBeGone(false);
                updateContentHeight();
                notifyHeightChangeListener(mDismissView);
            } else {
                mEmptyShadeView.setWillBeGone(true);
                mEmptyShadeView.performVisibilityAnimation(false, new Runnable() {
@@ -2111,6 +2112,7 @@ public class NotificationStackScrollLayout extends ViewGroup
                        mEmptyShadeView.setVisibility(GONE);
                        mEmptyShadeView.setWillBeGone(false);
                        updateContentHeight();
                        notifyHeightChangeListener(mDismissView);
                    }
                });
            }
@@ -2121,15 +2123,16 @@ public class NotificationStackScrollLayout extends ViewGroup
        int oldVisibility = mDismissView.willBeGone() ? GONE : mDismissView.getVisibility();
        int newVisibility = visible ? VISIBLE : GONE;
        if (oldVisibility != newVisibility) {
            if (oldVisibility == GONE) {
            if (newVisibility != GONE) {
                if (mDismissView.willBeGone()) {
                    mDismissView.cancelAnimation();
                } else {
                    mDismissView.setInvisible();
                    mDismissView.setVisibility(newVisibility);
                }
                mDismissView.setVisibility(newVisibility);
                mDismissView.setWillBeGone(false);
                updateContentHeight();
                notifyHeightChangeListener(mDismissView);
            } else {
                mDismissView.setWillBeGone(true);
                mDismissView.performVisibilityAnimation(false, new Runnable() {
@@ -2138,6 +2141,7 @@ public class NotificationStackScrollLayout extends ViewGroup
                        mDismissView.setVisibility(GONE);
                        mDismissView.setWillBeGone(false);
                        updateContentHeight();
                        notifyHeightChangeListener(mDismissView);
                    }
                });
            }
+38 −11
Original line number Diff line number Diff line
@@ -166,6 +166,7 @@ public class StackStateAnimator {
        boolean hasDelays = mAnimationFilter.hasDelays;
        boolean isDelayRelevant = yTranslationChanging || zTranslationChanging || scaleChanging ||
                alphaChanging || heightChanging || topInsetChanging;
        boolean noAnimation = wasAdded && !mAnimationFilter.hasGoToFullShadeEvent;
        long delay = 0;
        long duration = mCurrentLength;
        if (hasDelays && isDelayRelevant || wasAdded) {
@@ -183,46 +184,72 @@ public class StackStateAnimator {

        // start translationY animation
        if (yTranslationChanging) {
            if (noAnimation) {
                child.setTranslationY(viewState.yTranslation);
            } else {
                startYTranslationAnimation(child, viewState, duration, delay);
            }
        }

        // start translationZ animation
        if (zTranslationChanging) {
            if (noAnimation) {
                child.setTranslationZ(viewState.zTranslation);
            } else {
                startZTranslationAnimation(child, viewState, duration, delay);
            }
        }

        // start scale animation
        if (scaleChanging) {
            if (noAnimation) {
                child.setScaleX(viewState.scale);
                child.setScaleY(viewState.scale);
            } else {
                startScaleAnimation(child, viewState, duration);
            }
        }

        // start alpha animation
        if (alphaChanging && child.getTranslationX() == 0) {
            if (noAnimation) {
                child.setAlpha(viewState.alpha);
            } else {
                startAlphaAnimation(child, viewState, duration, delay);
            }
        }

        // start height animation
        if (heightChanging) {
        if (heightChanging && child.getActualHeight() != 0) {
            if (noAnimation) {
                child.setActualHeight(viewState.height, false);
            } else {
                startHeightAnimation(child, viewState, duration, delay);
            }
        }

        // start top inset animation
        if (topInsetChanging) {
            if (noAnimation) {
                child.setClipTopAmount(viewState.clipTopAmount);
            } else {
                startInsetAnimation(child, viewState, duration, delay);
            }
        }

        // start dimmed animation
        child.setDimmed(viewState.dimmed, mAnimationFilter.animateDimmed && !wasAdded);
        child.setDimmed(viewState.dimmed, mAnimationFilter.animateDimmed && !wasAdded
                && !noAnimation);

        // start dark animation
        child.setDark(viewState.dark, mAnimationFilter.animateDark);
        child.setDark(viewState.dark, mAnimationFilter.animateDark && !noAnimation);

        // apply speed bump state
        child.setBelowSpeedBump(viewState.belowSpeedBump);

        // start hiding sensitive animation
        child.setHideSensitive(viewState.hideSensitive,
                mAnimationFilter.animateHideSensitive && !wasAdded, delay, duration);
        child.setHideSensitive(viewState.hideSensitive, mAnimationFilter.animateHideSensitive &&
                !wasAdded && !noAnimation, delay, duration);

        // apply scrimming
        child.setScrimAmount(viewState.scrimAmount);