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

Unverified Commit 337589ee authored by ReallySnow's avatar ReallySnow Committed by Michael Bestas
Browse files

SystemUI: Follow light/dark theme in SplitShade Header



* Google's default implementation is dark, which means
  it doesn't need to follow the light/dark color change,
  but we broke it, so add it to complete the SplitShade
  Header color change

Co-authored-by: default avatarCol_or <col_or@qq.com>
Change-Id: I5464039885197eeb43bd31b822bfcba7a1b08776
parent 24865069
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -133,6 +133,14 @@ public class QSCarrier extends LinearLayout {
                        com.android.settingslib.R.string.not_default_data_content_description));
    }

    public void updateColors(ColorStateList colorStateList) {
        final boolean visible = !mIsSingleCarrier;
        if (visible) {
            mMobileRoaming.setImageTintList(colorStateList);
            mMobileSignal.setImageTintList(colorStateList);
        }
    }

    @VisibleForTesting
    View getRSSIView() {
        return mMobileGroup;
+16 −0
Original line number Diff line number Diff line
@@ -18,8 +18,11 @@ package com.android.systemui.qs.carrier;

import android.annotation.StyleRes;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

@@ -58,6 +61,19 @@ public class QSCarrierGroup extends LinearLayout {
        return findViewById(R.id.qs_carrier_divider2);
    }

    public void updateColors(int color, ColorStateList colorStateList) {
        getNoSimTextView().setTextColor(color);
        QSCarrier[] qsCarriers = { getCarrier1View(), getCarrier2View(), getCarrier3View() };
        for (QSCarrier qsCarrier : qsCarriers) {
            for (int i = 0; i < qsCarrier.getChildCount(); i++) {
                qsCarrier.updateColors(colorStateList);
                if (qsCarrier.getChildAt(i) instanceof TextView) {
                    ((TextView) qsCarrier.getChildAt(i)).setTextColor(color);
                }
            }
        }
    }

    public void updateTextAppearance(@StyleRes int resId) {
        FontSizeUtils.updateFontSizeFromStyle(getNoSimTextView(), resId);
        getCarrier1View().updateTextAppearance(resId);
+27 −0
Original line number Diff line number Diff line
@@ -18,7 +18,10 @@ package com.android.systemui.shade

import android.annotation.IdRes
import android.app.StatusBarManager
import android.content.Context
import android.content.res.ColorStateList
import android.content.res.Configuration
import android.graphics.Color
import android.os.Bundle
import android.os.Trace
import android.os.Trace.TRACE_TAG_APP
@@ -84,6 +87,7 @@ class LargeScreenShadeHeaderController @Inject constructor(
    private val privacyIconsController: HeaderPrivacyIconsController,
    private val insetsProvider: StatusBarContentInsetsProvider,
    private val configurationController: ConfigurationController,
    private val context: Context,
    private val variableDateViewControllerFactory: VariableDateViewController.Factory,
    @Named(LARGE_SCREEN_BATTERY_CONTROLLER)
    private val batteryMeterViewController: BatteryMeterViewController,
@@ -133,6 +137,7 @@ class LargeScreenShadeHeaderController @Inject constructor(
    private var cutoutRight = 0
    private var roundedCorners = 0
    private var lastInsets: WindowInsets? = null
    private var textColorPrimary = Color.TRANSPARENT

    private var qsDisabled = false
    private var visible = false
@@ -259,6 +264,10 @@ class LargeScreenShadeHeaderController @Inject constructor(
            }
            updateResources()
        }

        override fun onUiModeChanged() {
            updateResources()
        }
    }

    override fun onInit() {
@@ -304,6 +313,7 @@ class LargeScreenShadeHeaderController @Inject constructor(

        updateVisibility()
        updateTransition()
        updateResources()
    }

    override fun onViewDetached() {
@@ -480,6 +490,23 @@ class LargeScreenShadeHeaderController @Inject constructor(
        val padding = resources.getDimensionPixelSize(R.dimen.qs_panel_padding)
        header.setPadding(padding, header.paddingTop, padding, header.paddingBottom)
        updateQQSPaddings()

        val fillColor = Utils.getColorAttrDefaultColor(context, android.R.attr.textColorPrimary)
        iconManager.setTint(fillColor)
        val textColor = Utils.getColorAttrDefaultColor(context, android.R.attr.textColorPrimary)
        val colorStateList = Utils.getColorAttr(context, android.R.attr.textColorPrimary)
        if (textColor != textColorPrimary) {
            val textColorSecondary = Utils.getColorAttrDefaultColor(context,
                    android.R.attr.textColorSecondary)
            textColorPrimary = textColor
            if (iconManager != null) {
                iconManager.setTint(textColor)
            }
            clock.setTextColor(textColorPrimary)
            date.setTextColor(textColorPrimary)
            qsCarrierGroup.updateColors(textColorPrimary, colorStateList)
            batteryIcon.updateColors(textColorPrimary, textColorSecondary, textColorPrimary)
        }
    }

    private fun updateQQSPaddings() {