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

Commit f7e83965 authored by Yining Liu's avatar Yining Liu
Browse files

Avoid adding transparency to Shelf Background View

NotificationBackgroundView is a super class for both notification rows,
and the NotificationShelfBackgroundView. The notificationRowTransparency
feature adds transparency to notification rows, which caused a
side-effect that made the shelf transparent or semi-transparent.

Bug: 420181235
Flag: EXEMPT bugfix
Test: manual, open shade, close shade without swiping to the end, check
      shelf on lockscreen.
Change-Id: Id780e45d730217be34462722de831f5b7155d11d
parent 7647de67
Loading
Loading
Loading
Loading
+9 −3
Original line number Original line Diff line number Diff line
@@ -24,7 +24,6 @@ import android.content.res.ColorStateList;
import android.graphics.Canvas;
import android.graphics.Canvas;
import android.graphics.Path;
import android.graphics.Path;
import android.graphics.PorterDuff;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.GradientDrawable;
@@ -87,7 +86,7 @@ public class NotificationBackgroundView extends View implements Dumpable,
                R.color.notification_state_color_light);
                R.color.notification_state_color_light);
        mDarkColoredStatefulColors = getResources().getColorStateList(
        mDarkColoredStatefulColors = getResources().getColorStateList(
                R.color.notification_state_color_dark);
                R.color.notification_state_color_dark);
        if (notificationRowTransparency()) {
        if (backgroundTransparency()) {
            mNormalColor = SurfaceEffectColors.surfaceEffect1(getContext());
            mNormalColor = SurfaceEffectColors.surfaceEffect1(getContext());
        } else  {
        } else  {
            mNormalColor = mContext.getColor(
            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
    @Override
    protected void onDraw(Canvas canvas) {
    protected void onDraw(Canvas canvas) {
        float clipTop = Math.max(mClipTopAmount, mTopOverlap);
        float clipTop = Math.max(mClipTopAmount, mTopOverlap);
@@ -301,7 +307,7 @@ public class NotificationBackgroundView extends View implements Dumpable,


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


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

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