Fixed layer trashing when opening / closing the shade
Bug: 21445574 Change-Id: I67ed5f28581a366a4fa7fdc6355371c1fdd0dac3
This commit is contained in:
@@ -196,6 +196,7 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
private boolean mCollapsedOnDown;
|
private boolean mCollapsedOnDown;
|
||||||
private int mPositionMinSideMargin;
|
private int mPositionMinSideMargin;
|
||||||
private int mLastOrientation = -1;
|
private int mLastOrientation = -1;
|
||||||
|
private boolean mClosingWithAlphaFadeOut;
|
||||||
|
|
||||||
private Runnable mHeadsUpExistenceChangedRunnable = new Runnable() {
|
private Runnable mHeadsUpExistenceChangedRunnable = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@@ -527,6 +528,7 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
protected void flingToHeight(float vel, boolean expand, float target,
|
protected void flingToHeight(float vel, boolean expand, float target,
|
||||||
float collapseSpeedUpFactor, boolean expandBecauseOfFalsing) {
|
float collapseSpeedUpFactor, boolean expandBecauseOfFalsing) {
|
||||||
mHeadsUpTouchHelper.notifyFling(!expand);
|
mHeadsUpTouchHelper.notifyFling(!expand);
|
||||||
|
setClosingWithAlphaFadeout(!expand && getFadeoutAlpha() == 1.0f);
|
||||||
super.flingToHeight(vel, expand, target, collapseSpeedUpFactor, expandBecauseOfFalsing);
|
super.flingToHeight(vel, expand, target, collapseSpeedUpFactor, expandBecauseOfFalsing);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1584,26 +1586,22 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void updateNotificationTranslucency() {
|
private void updateNotificationTranslucency() {
|
||||||
float alpha;
|
float alpha = 1f;
|
||||||
if (mExpandingFromHeadsUp || mHeadsUpManager.hasPinnedHeadsUp()) {
|
if (mClosingWithAlphaFadeOut && !mExpandingFromHeadsUp && !mHeadsUpManager.hasPinnedHeadsUp()) {
|
||||||
alpha = 1f;
|
alpha = getFadeoutAlpha();
|
||||||
} else {
|
|
||||||
alpha = (getNotificationsTopY() + mNotificationStackScroller.getItemHeight())
|
|
||||||
/ (mQsMinExpansionHeight + mNotificationStackScroller.getBottomStackPeekSize()
|
|
||||||
- mNotificationStackScroller.getCollapseSecondCardPadding());
|
|
||||||
alpha = Math.max(0, Math.min(alpha, 1));
|
|
||||||
alpha = (float) Math.pow(alpha, 0.75);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (alpha != 1f && mNotificationStackScroller.getLayerType() != LAYER_TYPE_HARDWARE) {
|
|
||||||
mNotificationStackScroller.setLayerType(LAYER_TYPE_HARDWARE, null);
|
|
||||||
} else if (alpha == 1f
|
|
||||||
&& mNotificationStackScroller.getLayerType() == LAYER_TYPE_HARDWARE) {
|
|
||||||
mNotificationStackScroller.setLayerType(LAYER_TYPE_NONE, null);
|
|
||||||
}
|
}
|
||||||
mNotificationStackScroller.setAlpha(alpha);
|
mNotificationStackScroller.setAlpha(alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private float getFadeoutAlpha() {
|
||||||
|
float alpha = (getNotificationsTopY() + mNotificationStackScroller.getItemHeight())
|
||||||
|
/ (mQsMinExpansionHeight + mNotificationStackScroller.getBottomStackPeekSize()
|
||||||
|
- mNotificationStackScroller.getCollapseSecondCardPadding());
|
||||||
|
alpha = Math.max(0, Math.min(alpha, 1));
|
||||||
|
alpha = (float) Math.pow(alpha, 0.75);
|
||||||
|
return alpha;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected float getOverExpansionAmount() {
|
protected float getOverExpansionAmount() {
|
||||||
return mNotificationStackScroller.getCurrentOverScrollAmount(true /* top */);
|
return mNotificationStackScroller.getCurrentOverScrollAmount(true /* top */);
|
||||||
@@ -2260,6 +2258,12 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
protected void onClosingFinished() {
|
protected void onClosingFinished() {
|
||||||
super.onClosingFinished();
|
super.onClosingFinished();
|
||||||
resetVerticalPanelPosition();
|
resetVerticalPanelPosition();
|
||||||
|
setClosingWithAlphaFadeout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setClosingWithAlphaFadeout(boolean closing) {
|
||||||
|
mClosingWithAlphaFadeOut = closing;
|
||||||
|
mNotificationStackScroller.forceNoOverlappingRendering(closing);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -225,6 +225,7 @@ public class NotificationStackScrollLayout extends ViewGroup
|
|||||||
private HeadsUpManager mHeadsUpManager;
|
private HeadsUpManager mHeadsUpManager;
|
||||||
private boolean mTrackingHeadsUp;
|
private boolean mTrackingHeadsUp;
|
||||||
private ScrimController mScrimController;
|
private ScrimController mScrimController;
|
||||||
|
private boolean mForceNoOverlappingRendering;
|
||||||
|
|
||||||
public NotificationStackScrollLayout(Context context) {
|
public NotificationStackScrollLayout(Context context) {
|
||||||
this(context, null);
|
this(context, null);
|
||||||
@@ -2732,6 +2733,15 @@ public class NotificationStackScrollLayout extends ViewGroup
|
|||||||
mScrimController = scrimController;
|
mScrimController = scrimController;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void forceNoOverlappingRendering(boolean force) {
|
||||||
|
mForceNoOverlappingRendering = force;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasOverlappingRendering() {
|
||||||
|
return !mForceNoOverlappingRendering && super.hasOverlappingRendering();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A listener that is notified when some child locations might have changed.
|
* A listener that is notified when some child locations might have changed.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user