Merge "Fix possible NPE" into rvc-dev am: 1d63b6c88a am: 0c4c77c4e0

Change-Id: I9f7332ef06ad681d0aa2d85ccc74e59b87f2258a
This commit is contained in:
TreeHugger Robot
2020-04-01 03:14:25 +00:00
committed by Automerger Merge Worker
2 changed files with 8 additions and 3 deletions

View File

@@ -543,7 +543,8 @@ public class BubbleStackView extends FrameLayout {
.setStiffness(SpringForce.STIFFNESS_LOW) .setStiffness(SpringForce.STIFFNESS_LOW)
.setDampingRatio(SpringForce.DAMPING_RATIO_LOW_BOUNCY)); .setDampingRatio(SpringForce.DAMPING_RATIO_LOW_BOUNCY));
mExpandedViewYAnim.addEndListener((anim, cancelled, value, velocity) -> { mExpandedViewYAnim.addEndListener((anim, cancelled, value, velocity) -> {
if (mIsExpanded && mExpandedBubble != null) { if (mIsExpanded && mExpandedBubble != null
&& mExpandedBubble.getExpandedView() != null) {
mExpandedBubble.getExpandedView().updateView(); mExpandedBubble.getExpandedView().updateView();
} }
}); });
@@ -562,7 +563,7 @@ public class BubbleStackView extends FrameLayout {
// Update the insets after we're done translating otherwise position // Update the insets after we're done translating otherwise position
// calculation for them won't be correct. // calculation for them won't be correct.
() -> { () -> {
if (mExpandedBubble != null) { if (mExpandedBubble != null && mExpandedBubble.getExpandedView() != null) {
mExpandedBubble.getExpandedView().updateInsets(insets); mExpandedBubble.getExpandedView().updateInsets(insets);
} }
}); });
@@ -577,7 +578,7 @@ public class BubbleStackView extends FrameLayout {
// Reposition & adjust the height for new orientation // Reposition & adjust the height for new orientation
if (mIsExpanded) { if (mIsExpanded) {
mExpandedViewContainer.setTranslationY(getExpandedViewY()); mExpandedViewContainer.setTranslationY(getExpandedViewY());
if (mExpandedBubble != null) { if (mExpandedBubble != null && mExpandedBubble.getExpandedView() != null) {
mExpandedBubble.getExpandedView().updateView(); mExpandedBubble.getExpandedView().updateView();
} }
} }
@@ -1264,6 +1265,7 @@ public class BubbleStackView extends FrameLayout {
void showExpandedViewContents(int displayId) { void showExpandedViewContents(int displayId) {
if (mExpandedBubble != null if (mExpandedBubble != null
&& mExpandedBubble.getExpandedView() != null
&& mExpandedBubble.getExpandedView().getVirtualDisplayId() == displayId) { && mExpandedBubble.getExpandedView().getVirtualDisplayId() == displayId) {
mExpandedBubble.setContentVisibility(true); mExpandedBubble.setContentVisibility(true);
} }

View File

@@ -356,6 +356,9 @@ public class PhysicsAnimationLayout extends FrameLayout {
/** Immediately re-orders the view to the given index. */ /** Immediately re-orders the view to the given index. */
public void reorderView(View view, int index) { public void reorderView(View view, int index) {
if (view == null) {
return;
}
final int oldIndex = indexOfChild(view); final int oldIndex = indexOfChild(view);
super.removeView(view); super.removeView(view);