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

Commit 34d93b09 authored by Selim Cinek's avatar Selim Cinek
Browse files

Hiding the children backgrounds now

To avoid overdraw we are now hiding
the background of the view if it has
the same color.

Bug: 24866646
Change-Id: Ie998c9d2e6055d8e88f33300583a4b86bf35362f
parent eef84285
Loading
Loading
Loading
Loading
+18 −8
Original line number Diff line number Diff line
@@ -340,7 +340,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
            return;
        }
        mDark = dark;
        if (!dark && fade) {
        if (!dark && fade && !shouldHideBackground()) {
            if (mActivated) {
                mBackgroundDimmed.setVisibility(View.VISIBLE);
                mBackgroundNormal.setVisibility(View.VISIBLE);
@@ -428,11 +428,13 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
    private void fadeDimmedBackground() {
        mBackgroundDimmed.animate().cancel();
        mBackgroundNormal.animate().cancel();
        if (!shouldHideBackground()) {
            if (mDimmed) {
                mBackgroundDimmed.setVisibility(View.VISIBLE);
            } else {
                mBackgroundNormal.setVisibility(View.VISIBLE);
            }
        }
        float startAlpha = mDimmed ? 1f : 0;
        float endAlpha = mDimmed ? 0 : 1f;
        int duration = BACKGROUND_ANIMATION_LENGTH_MS;
@@ -466,9 +468,9 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
        mBackgroundAnimator.start();
    }

    private void updateBackground() {
    protected void updateBackground() {
        cancelFadeAnimations();
        if (mDark) {
        if (shouldHideBackground()) {
            mBackgroundDimmed.setVisibility(View.INVISIBLE);
            mBackgroundNormal.setVisibility(View.INVISIBLE);
        } else if (mDimmed) {
@@ -482,6 +484,10 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
        }
    }

    protected boolean shouldHideBackground() {
        return mDark;
    }

    private void cancelFadeAnimations() {
        if (mBackgroundAnimator != null) {
            mBackgroundAnimator.cancel();
@@ -676,7 +682,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView

    protected abstract View getContentView();

    private int getBgColor() {
    public int getBgColor() {
        if (mBgTint != 0) {
            return mBgTint;
        } else if (mShowingLegacyBackground) {
@@ -739,6 +745,10 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
        setBelowSpeedBump(false);
    }

    public boolean hasSameBgColor(ActivatableNotificationView otherView) {
        return getBgColor() == otherView.getBgColor();
    }

    public interface OnActivatedListener {
        void onActivated(ActivatableNotificationView view);
        void onActivationReset(ActivatableNotificationView view);
+8 −2
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.systemui.statusbar;

import android.app.Notification;
import android.content.Context;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.graphics.drawable.AnimationDrawable;
@@ -35,7 +34,6 @@ import android.widget.ImageView;
import com.android.systemui.R;
import com.android.systemui.classifier.FalsingManager;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
import com.android.systemui.statusbar.phone.PhoneStatusBar;
import com.android.systemui.statusbar.stack.NotificationChildrenContainer;
import com.android.systemui.statusbar.notification.NotificationHeaderView;
import com.android.systemui.statusbar.stack.StackScrollState;
@@ -104,6 +102,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {

    private boolean mJustClicked;
    private NotificationData.Entry mEntry;
    private boolean mShowNoBackground;
    private boolean mChildInGroup;

    public NotificationContentView getPrivateLayout() {
@@ -225,6 +224,13 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
     */
    public void setIsChildInGroup(boolean isChildInGroup, ExpandableNotificationRow parent) {
        mChildInGroup = BaseStatusBar.ENABLE_CHILD_NOTIFICATIONS && isChildInGroup;
        mShowNoBackground = mChildInGroup && hasSameBgColor(parent);
        updateBackground();
    }

    @Override
    protected boolean shouldHideBackground() {
        return super.shouldHideBackground() || mShowNoBackground;
    }

    @Override