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

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

Fixed an issue where the darkmode wasn't applied to all views

It was only being applied to the rows added to the layout instead
of all existing rows.

Change-Id: If1608d856659452a8c7ba7508966eb7534611b25
Fixes: 119102545
Test: enable DND, switch theme, disable DND, observe normal notifications
parent 9ba78f15
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -916,6 +916,10 @@ public class NotificationShelf extends ActivatableNotificationView implements
        updateRelativeOffset();
    }

    public void onUiModeChanged() {
        updateBackgroundColors();
    }

    private class ShelfState extends ExpandableViewState {
        private float openedAmount;
        private boolean hasItemsInStableShelf;
+1 −1
Original line number Diff line number Diff line
@@ -225,7 +225,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
        initDimens();
    }

    public void onUiModeChanged() {
    protected void updateBackgroundColors() {
        updateColors();
        initBackground();
        updateBackgroundTint();
+6 −2
Original line number Diff line number Diff line
@@ -121,6 +121,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
    private static final int MENU_VIEW_INDEX = 0;
    private static final String TAG = "ExpandableNotifRow";
    public static final float DEFAULT_HEADER_VISIBLE_AMOUNT = 1.0f;
    private boolean mUpdateBackgroundOnUpdate;

    /**
     * Listener for when {@link ExpandableNotificationRow} is laid out.
@@ -587,6 +588,10 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        updateIconVisibilities();
        updateShelfIconColor();
        updateRippleAllowed();
        if (mUpdateBackgroundOnUpdate) {
            mUpdateBackgroundOnUpdate = false;
            updateBackgroundColors();
        }
    }

    /** Called when the notification's ranking was changed (but nothing else changed). */
@@ -1208,9 +1213,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        }
    }

    @Override
    public void onUiModeChanged() {
        super.onUiModeChanged();
        mUpdateBackgroundOnUpdate = true;
        reInflateViews();
        if (mChildrenContainer != null) {
            for (ExpandableNotificationRow child : mChildrenContainer.getNotificationChildren()) {
+1 −9
Original line number Diff line number Diff line
@@ -641,15 +641,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
    public void onUiModeChanged() {
        mBgColor = mContext.getColor(R.color.notification_shade_background_color);
        updateBackgroundDimming();

        // Re-inflate all notification views
        int childCount = getChildCount();
        for (int i = 0; i < childCount; i++) {
            View child = getChildAt(i);
            if (child instanceof ActivatableNotificationView) {
                ((ActivatableNotificationView) child).onUiModeChanged();
            }
        }
        mShelf.onUiModeChanged();
    }

    @ShadeViewRefactor(RefactorComponent.DECORATOR)
+28 −0
Original line number Diff line number Diff line
@@ -67,6 +67,8 @@ import com.android.systemui.statusbar.notification.stack.NotificationListContain
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.KeyguardMonitor;

import java.util.ArrayList;

public class StatusBarNotificationPresenter implements NotificationPresenter,
        ConfigurationController.ConfigurationListener {

@@ -104,6 +106,7 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
    private final int mMaxAllowedKeyguardNotifications;
    private final IStatusBarService mBarService;
    private boolean mReinflateNotificationsOnUserSwitched;
    private boolean mDispatchUiModeChangeOnUserSwitched;
    private final UnlockMethodCache mUnlockMethodCache;
    private TextView mNotificationPanelDebugText;

@@ -183,6 +186,27 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
        }
    }

    @Override
    public void onUiModeChanged() {
        if (!KeyguardUpdateMonitor.getInstance(mContext).isSwitchingUser()) {
            updateNotificationOnUiModeChanged();
        } else {
            mDispatchUiModeChangeOnUserSwitched = true;
        }
    }

    private void updateNotificationOnUiModeChanged() {
        ArrayList<Entry> userNotifications
                = mEntryManager.getNotificationData().getNotificationsForCurrentUser();
        for (int i = 0; i < userNotifications.size(); i++) {
            Entry entry = userNotifications.get(i);
            ExpandableNotificationRow row = entry.getRow();
            if (row != null) {
                row.onUiModeChanged();
            }
        }
    }

    @Override
    public boolean isCollapsing() {
        return mNotificationPanel.isCollapsing()
@@ -298,6 +322,10 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
            mEntryManager.updateNotificationsOnDensityOrFontScaleChanged();
            mReinflateNotificationsOnUserSwitched = false;
        }
        if (mDispatchUiModeChangeOnUserSwitched) {
            updateNotificationOnUiModeChanged();
            mDispatchUiModeChangeOnUserSwitched = false;
        }
        updateNotificationViews();
        mMediaManager.clearCurrentMediaNotification();
        mShadeController.setLockscreenUser(newUserId);