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

Commit 8d35a119 authored by Joshua Tsuji's avatar Joshua Tsuji
Browse files

Null-check the desaturating view, it might be gone.

Fixes: 155652953
Test: manual
Change-Id: Ic43cb2f8ed0cb3e3b7c32217657f068ee1ffc4ad
parent 322b748b
Loading
Loading
Loading
Loading
+15 −3
Original line number Original line Diff line number Diff line
@@ -261,7 +261,7 @@ public class BubbleStackView extends FrameLayout
    private boolean mShowingDismiss = false;
    private boolean mShowingDismiss = false;


    /** The view to desaturate/darken when magneted to the dismiss target. */
    /** The view to desaturate/darken when magneted to the dismiss target. */
    private View mDesaturateAndDarkenTargetView;
    @Nullable private View mDesaturateAndDarkenTargetView;


    private LayoutInflater mInflater;
    private LayoutInflater mInflater;


@@ -886,7 +886,10 @@ public class BubbleStackView extends FrameLayout


            // Update the paint and apply it to the bubble container.
            // Update the paint and apply it to the bubble container.
            mDesaturateAndDarkenPaint.setColorFilter(new ColorMatrixColorFilter(animatedMatrix));
            mDesaturateAndDarkenPaint.setColorFilter(new ColorMatrixColorFilter(animatedMatrix));

            if (mDesaturateAndDarkenTargetView != null) {
                mDesaturateAndDarkenTargetView.setLayerPaint(mDesaturateAndDarkenPaint);
                mDesaturateAndDarkenTargetView.setLayerPaint(mDesaturateAndDarkenPaint);
            }
        });
        });


        // If the stack itself is touched, it means none of its touchable views (bubbles, flyouts,
        // If the stack itself is touched, it means none of its touchable views (bubbles, flyouts,
@@ -1827,6 +1830,10 @@ public class BubbleStackView extends FrameLayout
    private void animateDesaturateAndDarken(View targetView, boolean desaturateAndDarken) {
    private void animateDesaturateAndDarken(View targetView, boolean desaturateAndDarken) {
        mDesaturateAndDarkenTargetView = targetView;
        mDesaturateAndDarkenTargetView = targetView;


        if (mDesaturateAndDarkenTargetView == null) {
            return;
        }

        if (desaturateAndDarken) {
        if (desaturateAndDarken) {
            // Use the animated paint for the bubbles.
            // Use the animated paint for the bubbles.
            mDesaturateAndDarkenTargetView.setLayerType(
            mDesaturateAndDarkenTargetView.setLayerType(
@@ -1848,9 +1855,14 @@ public class BubbleStackView extends FrameLayout
    }
    }


    private void resetDesaturationAndDarken() {
    private void resetDesaturationAndDarken() {

        mDesaturateAndDarkenAnimator.removeAllListeners();
        mDesaturateAndDarkenAnimator.removeAllListeners();
        mDesaturateAndDarkenAnimator.cancel();
        mDesaturateAndDarkenAnimator.cancel();

        if (mDesaturateAndDarkenTargetView != null) {
            mDesaturateAndDarkenTargetView.setLayerType(View.LAYER_TYPE_NONE, null);
            mDesaturateAndDarkenTargetView.setLayerType(View.LAYER_TYPE_NONE, null);
            mDesaturateAndDarkenTargetView = null;
        }
    }
    }


    /** Animates in the dismiss target. */
    /** Animates in the dismiss target. */