Merge "Reset the alpha value of ALL notification content views" into sc-v2-dev
This commit is contained in:
@@ -579,14 +579,24 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
|
|||||||
if (contentView.hasOverlappingRendering()) {
|
if (contentView.hasOverlappingRendering()) {
|
||||||
int layerType = contentAlpha == 0.0f || contentAlpha == 1.0f ? LAYER_TYPE_NONE
|
int layerType = contentAlpha == 0.0f || contentAlpha == 1.0f ? LAYER_TYPE_NONE
|
||||||
: LAYER_TYPE_HARDWARE;
|
: LAYER_TYPE_HARDWARE;
|
||||||
int currentLayerType = contentView.getLayerType();
|
contentView.setLayerType(layerType, null);
|
||||||
if (currentLayerType != layerType) {
|
|
||||||
contentView.setLayerType(layerType, null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
contentView.setAlpha(contentAlpha);
|
contentView.setAlpha(contentAlpha);
|
||||||
|
// After updating the current view, reset all views.
|
||||||
|
if (contentAlpha == 1f) {
|
||||||
|
resetAllContentAlphas();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If a subclass's {@link #getContentView()} returns different views depending on state,
|
||||||
|
* this method is an opportunity to reset the alpha of ALL content views, not just the
|
||||||
|
* current one, which may prevent a content view that is temporarily hidden from being reset.
|
||||||
|
*
|
||||||
|
* This should setAlpha(1.0f) and setLayerType(LAYER_TYPE_NONE) for all content views.
|
||||||
|
*/
|
||||||
|
protected void resetAllContentAlphas() {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void applyRoundness() {
|
protected void applyRoundness() {
|
||||||
super.applyRoundness();
|
super.applyRoundness();
|
||||||
|
|||||||
@@ -2130,15 +2130,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setExpandAnimationRunning(boolean expandAnimationRunning) {
|
public void setExpandAnimationRunning(boolean expandAnimationRunning) {
|
||||||
View contentView;
|
|
||||||
if (mIsSummaryWithChildren) {
|
|
||||||
contentView = mChildrenContainer;
|
|
||||||
} else {
|
|
||||||
contentView = getShowingLayout();
|
|
||||||
}
|
|
||||||
if (mGuts != null && mGuts.isExposed()) {
|
|
||||||
contentView = mGuts;
|
|
||||||
}
|
|
||||||
if (expandAnimationRunning) {
|
if (expandAnimationRunning) {
|
||||||
setAboveShelf(true);
|
setAboveShelf(true);
|
||||||
mExpandAnimationRunning = true;
|
mExpandAnimationRunning = true;
|
||||||
@@ -2151,9 +2142,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
|||||||
if (mGuts != null) {
|
if (mGuts != null) {
|
||||||
mGuts.setAlpha(1.0f);
|
mGuts.setAlpha(1.0f);
|
||||||
}
|
}
|
||||||
if (contentView != null) {
|
resetAllContentAlphas();
|
||||||
contentView.setAlpha(1.0f);
|
|
||||||
}
|
|
||||||
setExtraWidthForClipping(0.0f);
|
setExtraWidthForClipping(0.0f);
|
||||||
if (mNotificationParent != null) {
|
if (mNotificationParent != null) {
|
||||||
mNotificationParent.setExtraWidthForClipping(0.0f);
|
mNotificationParent.setExtraWidthForClipping(0.0f);
|
||||||
@@ -2601,10 +2590,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
|||||||
mPrivateLayout.animate().cancel();
|
mPrivateLayout.animate().cancel();
|
||||||
if (mChildrenContainer != null) {
|
if (mChildrenContainer != null) {
|
||||||
mChildrenContainer.animate().cancel();
|
mChildrenContainer.animate().cancel();
|
||||||
mChildrenContainer.setAlpha(1f);
|
|
||||||
}
|
}
|
||||||
mPublicLayout.setAlpha(1f);
|
resetAllContentAlphas();
|
||||||
mPrivateLayout.setAlpha(1f);
|
|
||||||
mPublicLayout.setVisibility(mShowingPublic ? View.VISIBLE : View.INVISIBLE);
|
mPublicLayout.setVisibility(mShowingPublic ? View.VISIBLE : View.INVISIBLE);
|
||||||
updateChildrenVisibility();
|
updateChildrenVisibility();
|
||||||
} else {
|
} else {
|
||||||
@@ -2631,7 +2618,10 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
|||||||
.alpha(0f)
|
.alpha(0f)
|
||||||
.setStartDelay(delay)
|
.setStartDelay(delay)
|
||||||
.setDuration(duration)
|
.setDuration(duration)
|
||||||
.withEndAction(() -> hiddenView.setVisibility(View.INVISIBLE));
|
.withEndAction(() -> {
|
||||||
|
hiddenView.setVisibility(View.INVISIBLE);
|
||||||
|
resetAllContentAlphas();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
for (View showView : shownChildren) {
|
for (View showView : shownChildren) {
|
||||||
showView.setVisibility(View.VISIBLE);
|
showView.setVisibility(View.VISIBLE);
|
||||||
@@ -2754,12 +2744,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
|||||||
if (wasAppearing) {
|
if (wasAppearing) {
|
||||||
// During the animation the visible view might have changed, so let's make sure all
|
// During the animation the visible view might have changed, so let's make sure all
|
||||||
// alphas are reset
|
// alphas are reset
|
||||||
if (mChildrenContainer != null) {
|
resetAllContentAlphas();
|
||||||
mChildrenContainer.setAlpha(1.0f);
|
|
||||||
}
|
|
||||||
for (NotificationContentView l : mLayouts) {
|
|
||||||
l.setAlpha(1.0f);
|
|
||||||
}
|
|
||||||
if (FADE_LAYER_OPTIMIZATION_ENABLED) {
|
if (FADE_LAYER_OPTIMIZATION_ENABLED) {
|
||||||
setNotificationFaded(false);
|
setNotificationFaded(false);
|
||||||
} else {
|
} else {
|
||||||
@@ -2770,6 +2755,18 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void resetAllContentAlphas() {
|
||||||
|
mPrivateLayout.setAlpha(1f);
|
||||||
|
mPrivateLayout.setLayerType(LAYER_TYPE_NONE, null);
|
||||||
|
mPublicLayout.setAlpha(1f);
|
||||||
|
mPublicLayout.setLayerType(LAYER_TYPE_NONE, null);
|
||||||
|
if (mChildrenContainer != null) {
|
||||||
|
mChildrenContainer.setAlpha(1f);
|
||||||
|
mChildrenContainer.setLayerType(LAYER_TYPE_NONE, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Gets the last value set with {@link #setNotificationFaded(boolean)} */
|
/** Gets the last value set with {@link #setNotificationFaded(boolean)} */
|
||||||
@Override
|
@Override
|
||||||
public boolean isNotificationFaded() {
|
public boolean isNotificationFaded() {
|
||||||
|
|||||||
Reference in New Issue
Block a user