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

Commit addba1b8 authored by Yining Liu's avatar Yining Liu Committed by Android (Google) Code Review
Browse files

Merge "Avoid adding transparency to Shelf Background View" into main

parents 986c5797 f7e83965
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import android.content.res.ColorStateList;
import android.graphics.Canvas;
import android.graphics.Path;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
@@ -87,7 +86,7 @@ public class NotificationBackgroundView extends View implements Dumpable,
                R.color.notification_state_color_light);
        mDarkColoredStatefulColors = getResources().getColorStateList(
                R.color.notification_state_color_dark);
        if (notificationRowTransparency()) {
        if (backgroundTransparency()) {
            mNormalColor = SurfaceEffectColors.surfaceEffect1(getContext());
        } else  {
            mNormalColor = mContext.getColor(
@@ -108,6 +107,13 @@ public class NotificationBackgroundView extends View implements Dumpable,
        }
    }

    /**
     * @return Whether to apply transparency to the background.
     */
    protected boolean backgroundTransparency() {
        return notificationRowTransparency();
    }

    @Override
    protected void onDraw(Canvas canvas) {
        float clipTop = Math.max(mClipTopAmount, mTopOverlap);
@@ -301,7 +307,7 @@ public class NotificationBackgroundView extends View implements Dumpable,

    public void setTint(int tintColor) {
        Drawable baseLayer = getBaseBackgroundLayer();
        if (notificationRowTransparency()) {
        if (backgroundTransparency()) {
            ((GradientDrawable) baseLayer.mutate()).setColor(tintColor);

        } else {
+4 −0
Original line number Diff line number Diff line
@@ -43,4 +43,8 @@ constructor(context: Context, attrs: AttributeSet? = null) :
    override fun toDumpString(): String {
        return super.toDumpString() + " alignToEnd=" + alignToEnd
    }

    override fun backgroundTransparency(): Boolean {
        return false
    }
}