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

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

Fixed a crash where we were getting the viewstate

Because we're now getting the viewstate directly from the
view, this was introducing an issue where the viewstate
being null was actually a symbol of the view being null,
which now lead to a nullpointer.

Change-Id: I1d171449034422d25a6e7ba7dca5154db3ce20b3
Fixes: 120230161
Test: remove last notification, no crash
parent e59ac13c
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -375,12 +375,9 @@ public class StackStateAnimator {

                // Find the amount to translate up. This is needed in order to understand the
                // direction of the remove animation (either downwards or upwards)
                ExpandableViewState viewState =
                        ((ExpandableView) event.viewAfterChangingView).getViewState();
                int actualHeight = changingView.getActualHeight();
                // upwards by default
                float translationDirection = -1.0f;
                if (viewState != null) {
                if (event.viewAfterChangingView != null) {
                    float ownPosition = changingView.getTranslationY();
                    if (changingView instanceof ExpandableNotificationRow
                            && event.viewAfterChangingView instanceof ExpandableNotificationRow) {
@@ -396,8 +393,11 @@ public class StackStateAnimator {
                            ownPosition = changingRow.getTranslationWhenRemoved();
                        }
                    }
                    int actualHeight = changingView.getActualHeight();
                    // there was a view after this one, Approximate the distance the next child
                    // travelled
                    ExpandableViewState viewState =
                            ((ExpandableView) event.viewAfterChangingView).getViewState();
                    translationDirection = ((viewState.yTranslation
                            - (ownPosition + actualHeight / 2.0f)) * 2 /
                            actualHeight);