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

Commit 4c27a879 authored by Darrell Shi's avatar Darrell Shi
Browse files

Set UMO settings icon to dynamic color on communal

This changes sets the tint of the settings gear icon of UMO to a dynamic
color when UMO is on the communal / glanceable hub, and sets it back to
the previous default color whenever UMO leave communal. This is for
accessibility reason so that the icon has sufficient contrast with the
background of communal, which is a materical dynamic color.

Fix: 378797118
Test: manually tested that the tint of the settings button is set; see
      bug for a video
Flag: EXEMPT simple UI change
Change-Id: Ie27f0026fc35b4438a6e022624d60f52d7ae2b35
parent d0194996
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.PathInterpolator
import android.widget.ImageView
import android.widget.LinearLayout
import androidx.annotation.VisibleForTesting
import androidx.lifecycle.Lifecycle
@@ -207,7 +208,7 @@ constructor(
    val mediaFrame: ViewGroup

    @VisibleForTesting
    lateinit var settingsButton: View
    lateinit var settingsButton: ImageView
        private set

    private val mediaContent: ViewGroup
@@ -650,7 +651,7 @@ constructor(
    private fun inflateSettingsButton() {
        val settings =
            LayoutInflater.from(context)
                .inflate(R.layout.media_carousel_settings_button, mediaFrame, false) as View
                .inflate(R.layout.media_carousel_settings_button, mediaFrame, false) as ImageView
        if (this::settingsButton.isInitialized) {
            mediaFrame.removeView(settingsButton)
        }
@@ -1493,6 +1494,17 @@ constructor(
                this.desiredHostState = it
                currentlyExpanded = it.expansion > 0

                // Set color of the settings button to material "on primary" color when media is on
                // communal for aesthetic and accessibility purposes since the background of
                // Glanceable Hub is a dynamic color.
                if (desiredLocation == MediaHierarchyManager.LOCATION_COMMUNAL_HUB) {
                    settingsButton.setColorFilter(
                        context.getColor(com.android.internal.R.color.materialColorOnPrimary)
                    )
                } else {
                    settingsButton.setColorFilter(context.getColor(R.color.notification_gear_color))
                }

                val shouldCloseGuts =
                    !currentlyExpanded &&
                        !mediaManager.hasActiveMediaOrRecommendation() &&