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

Commit ec29d34e authored by Selim Cinek's avatar Selim Cinek
Browse files

Don't flash colors when hinting

We're not flashing the colors anymore while hinting.
This also fixes a bug where the background wasn't
transforming properly when the last view was colorized.

Fixes: 37924486
Fixes: 36413876
Test: hint on lockscreen while the last notification is colorized
Change-Id: Ic9c4bf3c65e5d688ba43d71fb2843ebb7855c4f1
parent f323e3a5
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.animation.TimeAnimator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.view.MotionEvent;
@@ -177,6 +178,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
     * Similar to mDimmed but is also true if it's not dimmable but should be
     */
    private boolean mNeedsDimming;
    private int mDimmedAlpha;

    public ActivatableNotificationView(Context context, AttributeSet attrs) {
        super(context, attrs);
@@ -214,6 +216,8 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
        mBackgroundDimmed = findViewById(R.id.backgroundDimmed);
        mBackgroundNormal.setCustomBackground(R.drawable.notification_material_bg);
        mBackgroundDimmed.setCustomBackground(R.drawable.notification_material_bg_dim);
        mDimmedAlpha = Color.alpha(mContext.getColor(
                R.color.notification_material_background_dimmed_color));
        updateBackground();
        updateBackgroundTint();
        updateOutlineAlpha();
@@ -492,10 +496,21 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
     *                       used and the background color not at all.
     */
    public void setOverrideTintColor(int color, float overrideAmount) {
        if (mDark) {
            color = NO_COLOR;
            overrideAmount = 0;
        }
        mOverrideTint = color;
        mOverrideAmount = overrideAmount;
        int newColor = calculateBgColor();
        setBackgroundTintColor(newColor);
        if (!isDimmable() && mNeedsDimming) {
           mBackgroundNormal.setDrawableAlpha((int) NotificationUtils.interpolate(255,
                   mDimmedAlpha,
                   overrideAmount));
        } else {
            mBackgroundNormal.setDrawableAlpha(255);
        }
    }

    protected void updateBackgroundTint() {
+4 −0
Original line number Diff line number Diff line
@@ -144,4 +144,8 @@ public class NotificationBackgroundView extends View {
            ripple.setColor(ColorStateList.valueOf(color));
        }
    }

    public void setDrawableAlpha(int drawableAlpha) {
        mBackground.setAlpha(drawableAlpha);
    }
}
+8 −4
Original line number Diff line number Diff line
@@ -200,7 +200,7 @@ public class NotificationShelf extends ActivatableNotificationView implements
        //  find the first view that doesn't overlap with the shelf
        int notificationIndex = 0;
        int notGoneIndex = 0;
        int colorOfViewBeforeLast = 0;
        int colorOfViewBeforeLast = NO_COLOR;
        boolean backgroundForceHidden = false;
        if (mHideBackground && !mShelfState.hasItemsInStableShelf) {
            backgroundForceHidden = true;
@@ -254,7 +254,10 @@ public class NotificationShelf extends ActivatableNotificationView implements
                colorTwoBefore = previousColor;
                transitionAmount = inShelfAmount;
            }
            if (isLastChild && colorOfViewBeforeLast != NO_COLOR) {
            if (isLastChild) {
                if (colorOfViewBeforeLast == NO_COLOR) {
                    colorOfViewBeforeLast = ownColorUntinted;
                }
                row.setOverrideTintColor(colorOfViewBeforeLast, inShelfAmount);
            } else {
                colorOfViewBeforeLast = ownColorUntinted;
@@ -308,7 +311,8 @@ public class NotificationShelf extends ActivatableNotificationView implements
        float fullTransitionAmount;
        float iconTransitionAmount;
        float shelfStart = getTranslationY();
        if (viewEnd >= shelfStart && (mAmbientState.isShadeExpanded()
        if (viewEnd >= shelfStart && (!mAmbientState.isUnlockHintRunning() || row.isInShelf())
                && (mAmbientState.isShadeExpanded()
                        || (!row.isPinned() && !row.isHeadsUpAnimatingAway()))) {
            if (viewStart < shelfStart) {

+12 −0
Original line number Diff line number Diff line
@@ -1967,6 +1967,18 @@ public class NotificationPanelView extends PanelView implements
        }
    }

    @Override
    protected void onUnlockHintFinished() {
        super.onUnlockHintFinished();
        mNotificationStackScroller.setUnlockHintRunning(false);
    }

    @Override
    protected void onUnlockHintStarted() {
        super.onUnlockHintStarted();
        mNotificationStackScroller.setUnlockHintRunning(true);
    }

    @Override
    public KeyguardAffordanceView getLeftIcon() {
        return getLayoutDirection() == LAYOUT_DIRECTION_RTL
+10 −3
Original line number Diff line number Diff line
@@ -35,7 +35,6 @@ import android.widget.FrameLayout;

import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.systemui.DejankUtils;
import com.android.systemui.EventLogConstants;
import com.android.systemui.EventLogTags;
import com.android.systemui.Interpolators;
import com.android.keyguard.LatencyTracker;
@@ -1017,14 +1016,22 @@ public abstract class PanelView extends FrameLayout {
            @Override
            public void run() {
                notifyExpandingFinished();
                mStatusBar.onHintFinished();
                onUnlockHintFinished();
                mHintAnimationRunning = false;
            }
        });
        mStatusBar.onUnlockHintStarted();
        onUnlockHintStarted();
        mHintAnimationRunning = true;
    }

    protected void onUnlockHintFinished() {
        mStatusBar.onHintFinished();
    }

    protected void onUnlockHintStarted() {
        mStatusBar.onUnlockHintStarted();
    }

    /**
     * Phase 1: Move everything upwards.
     */
Loading