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

Commit 96dc1638 authored by Selim Cinek's avatar Selim Cinek Committed by Android (Google) Code Review
Browse files

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

parents 04ac23c7 ab9c7b2c
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). */
@@ -1212,9 +1217,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 {

@@ -105,6 +107,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;

@@ -186,6 +189,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()
@@ -301,6 +325,10 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
            mEntryManager.updateNotificationsOnDensityOrFontScaleChanged();
            mReinflateNotificationsOnUserSwitched = false;
        }
        if (mDispatchUiModeChangeOnUserSwitched) {
            updateNotificationOnUiModeChanged();
            mDispatchUiModeChangeOnUserSwitched = false;
        }
        updateNotificationViews();
        mMediaManager.clearCurrentMediaNotification();
        mShadeController.setLockscreenUser(newUserId);