Merge "Null-check the desaturating view, it might be gone." into rvc-dev am: b19c92dcdd

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11708789

Change-Id: I65c2f1ab06478c4d9fce0b12e4446bc0cc619d45
This commit is contained in:
TreeHugger Robot
2020-06-05 17:58:07 +00:00
committed by Automerger Merge Worker

View File

@@ -270,7 +270,7 @@ public class BubbleStackView extends FrameLayout
private boolean mShowingDismiss = false;
/** The view to desaturate/darken when magneted to the dismiss target. */
private View mDesaturateAndDarkenTargetView;
@Nullable private View mDesaturateAndDarkenTargetView;
private LayoutInflater mInflater;
@@ -908,7 +908,10 @@ public class BubbleStackView extends FrameLayout
// Update the paint and apply it to the bubble container.
mDesaturateAndDarkenPaint.setColorFilter(new ColorMatrixColorFilter(animatedMatrix));
mDesaturateAndDarkenTargetView.setLayerPaint(mDesaturateAndDarkenPaint);
if (mDesaturateAndDarkenTargetView != null) {
mDesaturateAndDarkenTargetView.setLayerPaint(mDesaturateAndDarkenPaint);
}
});
// If the stack itself is touched, it means none of its touchable views (bubbles, flyouts,
@@ -1894,6 +1897,10 @@ public class BubbleStackView extends FrameLayout
private void animateDesaturateAndDarken(View targetView, boolean desaturateAndDarken) {
mDesaturateAndDarkenTargetView = targetView;
if (mDesaturateAndDarkenTargetView == null) {
return;
}
if (desaturateAndDarken) {
// Use the animated paint for the bubbles.
mDesaturateAndDarkenTargetView.setLayerType(
@@ -1915,9 +1922,14 @@ public class BubbleStackView extends FrameLayout
}
private void resetDesaturationAndDarken() {
mDesaturateAndDarkenAnimator.removeAllListeners();
mDesaturateAndDarkenAnimator.cancel();
mDesaturateAndDarkenTargetView.setLayerType(View.LAYER_TYPE_NONE, null);
if (mDesaturateAndDarkenTargetView != null) {
mDesaturateAndDarkenTargetView.setLayerType(View.LAYER_TYPE_NONE, null);
mDesaturateAndDarkenTargetView = null;
}
}
/** Animates in the dismiss target. */