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

Commit a4af3dcd authored by rmp22's avatar rmp22 Committed by Nishith Khanna
Browse files

SystemUI: apply light/dark theme to shade header elements



Change-Id: I112dd0f79b3998f6b5d7ab619c6edf2dc9fad585
Signed-off-by: default avatarrmp22 <195054967+rmp22@users.noreply.github.com>
Signed-off-by: default avatarDmitrii <bankersenator@gmail.com>
Signed-off-by: default avatarPranav Vashi <neobuddy89@gmail.com>
Signed-off-by: default avataralthafvly <althafvly@gmail.com>
parent a159afcd
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -18,6 +18,9 @@
  -->
<resources xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">

    <color name="shade_header_text_color">#FFFFFFFF</color>

    <!-- The dark background color behind the shade -->
    <color name="shade_scrim_background_dark">@androidprv:color/system_under_surface_dark</color>

+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@
    <color name="qs_tile_divider">#29ffffff</color><!-- 16% white -->
    <color name="qs_detail_button_white">#B3FFFFFF</color><!-- 70% white -->
    <color name="status_bar_clock_color">#FFFFFFFF</color>
    <color name="shade_header_text_color">#FFFFFFFF</color>
    <color name="shade_header_text_color">#000000</color>
    <color name="qs_tile_disabled_color">#9E9E9E</color> <!-- 38% black -->
    <color name="status_bar_icons_hover_color_light">#38FFFFFF</color> <!-- 22% white -->
    <color name="status_bar_icons_hover_color_dark">#38000000</color> <!-- 22% black -->
+29 −18
Original line number Diff line number Diff line
@@ -336,13 +336,37 @@ constructor(
            }

            override fun onThemeChanged() {
                updateShadeHeaderColors()
            }

            override fun onUiModeChanged() {
                updateShadeHeaderColors()
            }
        }

    fun updateShadeHeaderColors() {
        clock.setTextAppearance(R.style.TextAppearance_QS_Status)
        date.setTextAppearance(R.style.TextAppearance_QS_Status)
        mShadeCarrierGroup.updateTextAppearance(R.style.TextAppearance_QS_Status)
        updateIconManagerColors()
        updateResources()
    }

            override fun onUiModeChanged() {
                updateResources()
    private fun updateIconManagerColors() {
        val fgColor =
            Utils.getColorAttrDefaultColor(context, android.R.attr.textColorPrimary)
        val bgColor =
            Utils.getColorAttrDefaultColor(context, android.R.attr.textColorPrimaryInverse)

        iconManager.setTint(fgColor, bgColor)

        if (!NewStatusBarIcons.isEnabled) {
            batteryIcon.isVisible = true
            batteryIcon.updateColors(
                fgColor, // foreground
                bgColor, // background
                fgColor  // single tone (default)
            )
        }
    }

@@ -354,26 +378,13 @@ constructor(
    override fun onInit() {
        variableDateViewControllerFactory.create(date as VariableDateView).init()

        val fgColor =
            Utils.getColorAttrDefaultColor(header.context, android.R.attr.textColorPrimary)
        val bgColor =
            Utils.getColorAttrDefaultColor(header.context, android.R.attr.textColorPrimaryInverse)

        iconManager = tintedIconManagerFactory.create(iconContainer, StatusBarLocation.QS)
        iconManager.setTint(fgColor, bgColor)
        updateIconManagerColors()

        if (!NewStatusBarIcons.isEnabled) {
            batteryMeterViewController.init()

            // battery settings same as in QS icons
            batteryMeterViewController.ignoreTunerUpdates()

            batteryIcon.isVisible = true
            batteryIcon.updateColors(
                fgColor /* foreground */,
                bgColor /* background */,
                fgColor, /* single tone (current default) */
            )
        } else {
            // Configure the compose battery view
            val batteryComposeView =