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

Commit 03d34427 authored by Alexandr Shabalin's avatar Alexandr Shabalin Committed by Android (Google) Code Review
Browse files

Merge "Update colors of the Suggested Device button." into main

parents f4b3eba6 2a4ed5a4
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -15,11 +15,13 @@
  ~ limitations under the License
  -->
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
    android:color="@color/media_seamless_border">
    android:color="@color/media_outlined_button_background">
    <item android:id="@android:id/background">
        <shape android:shape="rectangle">
            <stroke android:width="1dp" android:color="@color/media_seamless_border" />
            <solid android:color="#0000004D" />
            <stroke
                android:width="@dimen/qs_media_button_stroke_width"
                android:color="@android:color/system_outline_dark" />
            <solid android:color="@color/media_outlined_button_background" />
            <corners android:radius="24dp"/>
            <padding
                android:left="8dp"
+5 −1
Original line number Diff line number Diff line
@@ -157,6 +157,7 @@
            android:minHeight="@dimen/qs_seamless_height"
            android:maxHeight="@dimen/min_clickable_item_size"
            android:background="@drawable/qs_media_bordered_button"
            android:backgroundTint="@null"
            android:orientation="horizontal"
            android:visibility="gone">

@@ -166,9 +167,11 @@
                android:layout_width="@dimen/qs_seamless_icon_size"
                android:layout_height="@dimen/qs_seamless_icon_size"
                android:layout_gravity="center_vertical"
                android:src="@*android:drawable/ic_media_seamless" />
                android:src="@*android:drawable/ic_media_seamless"
                android:tint="@color/media_on_background" />
             <ProgressBar
                android:id="@+id/device_suggestion_progressbar"
                android:indeterminateTint="@color/media_on_background"
                android:layout_width="@dimen/qs_seamless_icon_size"
                android:layout_height="@dimen/qs_seamless_icon_size"
                android:layout_gravity="center_vertical" />
@@ -181,6 +184,7 @@
                android:fontFamily="@*android:string/config_headlineFontFamilyMedium"
                android:singleLine="true"
                android:textDirection="locale"
                android:textColor="@color/media_on_background"
                android:textSize="12sp"
                android:lineHeight="16sp" />
            </LinearLayout>
+1 −0
Original line number Diff line number Diff line
@@ -203,6 +203,7 @@
    <color name="media_seamless_border">?android:attr/colorAccent</color>
    <color name="media_paging_indicator">@color/material_dynamic_neutral_variant80</color>
    <color name="media_on_background">#FFFFFF</color>
    <color name="media_outlined_button_background">#4D000000</color> <!-- 30% -->

    <!-- media output dialog-->
    <color name="media_dialog_background" android:lstar="98">@color/material_dynamic_neutral90</color>
+1 −0
Original line number Diff line number Diff line
@@ -1390,6 +1390,7 @@
    <dimen name="qs_media_action_play_pause_width">72dp</dimen>
    <dimen name="qs_seamless_height">24dp</dimen>
    <dimen name="qs_seamless_icon_size">12dp</dimen>
    <dimen name="qs_media_button_stroke_width">1dp</dimen>
    <dimen name="qs_media_disabled_seekbar_height">1dp</dimen>
    <dimen name="qs_media_enabled_seekbar_height">2dp</dimen>
    <dimen name="qs_media_app_icon_size">24dp</dimen>
+21 −12
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.animation.ValueAnimator
import android.animation.ValueAnimator.AnimatorUpdateListener
import android.content.Context
import android.content.res.ColorStateList
import android.graphics.drawable.GradientDrawable
import android.graphics.drawable.RippleDrawable
import com.android.internal.R
import com.android.internal.annotations.VisibleForTesting
@@ -120,10 +121,16 @@ internal constructor(

    var loadingEffect: LoadingEffect? = null

    private val buttonStrokeWidth =
        context.resources.getDimensionPixelSize(
            com.android.systemui.res.R.dimen.qs_media_button_stroke_width
        )

    // Defaults may be briefly visible before loading a new player's colors
    private val backgroundDefault = context.getColor(R.color.system_on_surface_light)
    private val primaryDefault = context.getColor(R.color.system_primary_dark)
    private val onPrimaryDefault = context.getColor(R.color.system_on_primary_dark)
    private val outlineDefault = context.getColor(R.color.system_outline_dark)

    private val backgroundColor: AnimatingColorTransition by lazy {
        animatingColorTransitionFactory(backgroundDefault, ::backgroundFromScheme) { color ->
@@ -141,17 +148,6 @@ internal constructor(
                it.effectColor = primaryColorList
            }
            mediaViewHolder.seekBar.progressBackgroundTintList = primaryColorList
            if (enableSuggestedDeviceUi()) {
                mediaViewHolder.deviceSuggestionText.setTextColor(primaryColor)
                mediaViewHolder.deviceSuggestionIcon.imageTintList = primaryColorList
                mediaViewHolder.deviceSuggestionConnectingIcon.indeterminateTintList =
                    primaryColorList
                mediaViewHolder.deviceSuggestionButton.backgroundTintList = primaryColorList
                (mediaViewHolder.deviceSuggestionButton.background as? RippleDrawable)?.let {
                    it.setColor(primaryColorList)
                    it.effectColor = primaryColorList
                }
            }
        }
    }

@@ -164,6 +160,19 @@ internal constructor(
        }
    }

    private val outlineColor: AnimatingColorTransition by lazy {
        animatingColorTransitionFactory(outlineDefault, ::outlineFromScheme) { outlineColor ->
            if (enableSuggestedDeviceUi()) {
                (mediaViewHolder.deviceSuggestionButton.background as? RippleDrawable)?.let {
                    val shape = it.findDrawableByLayerId(R.id.background)
                    if (shape is GradientDrawable) {
                        shape.setStroke(buttonStrokeWidth, outlineColor)
                    }
                }
            }
        }
    }

    fun getDeviceIconColor(): Int {
        return onPrimaryColor.targetColor
    }
@@ -181,7 +190,7 @@ internal constructor(
    }

    private fun getColorTransitions(): Array<AnimatingColorTransition> {
        return arrayOf(backgroundColor, primaryColor, onPrimaryColor)
        return arrayOf(backgroundColor, primaryColor, onPrimaryColor, outlineColor)
    }

    fun updateColorScheme(colorScheme: ColorScheme?): Boolean {
Loading