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

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

Fixed a bug when a notification was quickly added and removed.

Change-Id: Id9b1cb771a2b6d1f42b61ef40a637e15c8d8f3b7
parent 5f81193f
Loading
Loading
Loading
Loading
+17 −9
Original line number Diff line number Diff line
@@ -265,11 +265,8 @@ public class NotificationStackScrollLayout extends ViewGroup
        mStackScrollAlgorithm.getStackScrollState(mCurrentStackScrollState);
        if (!isCurrentlyAnimating() && !mChildHierarchyDirty) {
            applyCurrentState();
            if (mListener != null) {
                mListener.onChildLocationsChanged(this);
            }
        } else {
            startAnimationToState(mCurrentStackScrollState);
            startAnimationToState();
        }
    }

@@ -831,9 +828,13 @@ public class NotificationStackScrollLayout extends ViewGroup
        updateScrollStateForRemovedChild(child);
        if (mIsExpanded) {

            if (!mChildrenToAddAnimated.contains(child)) {
                // Generate Animations
                mChildrenToRemoveAnimated.add(child);
                mChildHierarchyDirty = true;
            } else {
                mChildrenToAddAnimated.remove(child);
            }
        }
    }

@@ -905,12 +906,16 @@ public class NotificationStackScrollLayout extends ViewGroup
        }
    }

    private void startAnimationToState(StackScrollState finalState) {
    private void startAnimationToState() {
        if (mChildHierarchyDirty) {
            generateChildHierarchyEvents();
            mChildHierarchyDirty = false;
        }
        mStateAnimator.startAnimationForEvents(mAnimationEvents, finalState);
        if (!mAnimationEvents.isEmpty()) {
            mStateAnimator.startAnimationForEvents(mAnimationEvents, mCurrentStackScrollState);
        } else {
            applyCurrentState();
        }
    }

    private void generateChildHierarchyEvents() {
@@ -1128,6 +1133,9 @@ public class NotificationStackScrollLayout extends ViewGroup
        mListenForHeightChanges = false;
        mCurrentStackScrollState.apply();
        mListenForHeightChanges = true;
        if (mListener != null) {
            mListener.onChildLocationsChanged(this);
        }
    }

    /**