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

Commit e1902d9e authored by Jeff DeCew's avatar Jeff DeCew Committed by Automerger Merge Worker
Browse files

Merge "Reset the alpha value of ALL notification content views" into sc-v2-dev...

Merge "Reset the alpha value of ALL notification content views" into sc-v2-dev am: f49cf8a4 am: 1dc72ae9

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

Change-Id: Ic8bdd811f656d40074f55c917b8e2cdd389f0742
parents 504d791c 1dc72ae9
Loading
Loading
Loading
Loading
+14 −4
Original line number Original line Diff line number Diff line
@@ -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();
            if (currentLayerType != layerType) {
            contentView.setLayerType(layerType, null);
            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();
+19 −22
Original line number Original line Diff line number Diff line
@@ -2160,15 +2160,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;
@@ -2181,9 +2172,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);
@@ -2632,10 +2621,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 {
@@ -2662,7 +2649,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);
@@ -2785,12 +2775,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 {
@@ -2801,6 +2786,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() {