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

Commit 2de02125 authored by Michael Mikhail's avatar Michael Mikhail
Browse files

Add settings background for media carosel

Flag: com.android.systemui.media_controls_ui_update
Bug: 403228213
Test: Checked UI.
Change-Id: I1415fb23b5e89a46bf983cdc2a993fcea362c51e
parent 01ed9301
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?><!--
  ~ Copyright (C) 2025 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval" >
    <size android:height="40dp" android:width="40dp" />
    <solid android:color="@*android:color/surface_effect_1" />
    <corners android:radius="20dp" />
</shape>
 No newline at end of file
+30 −13
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2020 The Android Open Source Project
<?xml version="1.0" encoding="utf-8"?><!--
  ~ Copyright (C) 2025 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
@@ -14,7 +13,25 @@
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    android:id="@+id/settings_cog_layout"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:visibility="invisible"
    android:forceHasOverlappingRendering="false">

    <View
        android:id="@+id/background"
        android:layout_width="48dp"
        android:layout_height="48dp"
        android:layout_marginStart="2dp"
        android:layout_marginEnd="2dp"
        android:layout_gravity="center"
        android:background="@drawable/media_carousel_settings_bg" />

    <ImageView
        android:id="@+id/settings_cog"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
@@ -24,6 +41,6 @@
        android:paddingBottom="20dp"
        android:paddingTop="20dp"
        android:src="@drawable/ic_settings"
    android:tint="@color/notification_gear_color"
    android:visibility="invisible"
    android:forceHasOverlappingRendering="false"/>
        android:tint="@androidprv:color/materialColorOnSurface" />

</FrameLayout>
+29 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2020 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/settings_cog"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:contentDescription="@string/controls_media_settings_button"
    android:paddingStart="30dp"
    android:paddingEnd="30dp"
    android:paddingBottom="20dp"
    android:paddingTop="20dp"
    android:src="@drawable/ic_settings"
    android:tint="@color/notification_gear_color"
    android:visibility="invisible"
    android:forceHasOverlappingRendering="false"/>
+20 −7
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import com.android.internal.logging.InstanceId
import com.android.keyguard.KeyguardUpdateMonitor
import com.android.keyguard.KeyguardUpdateMonitorCallback
import com.android.systemui.Dumpable
import com.android.systemui.Flags
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.dagger.qualifiers.Background
@@ -196,7 +197,7 @@ constructor(
    val mediaFrame: ViewGroup

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

    private val mediaContent: ViewGroup
@@ -484,8 +485,14 @@ constructor(

    private fun inflateSettingsButton() {
        val settings =
            if (Flags.mediaControlsUiUpdate()) {
                LayoutInflater.from(context)
                .inflate(R.layout.media_carousel_settings_button, mediaFrame, false) as ImageView
                    .inflate(R.layout.media_carousel_settings_button, mediaFrame, false)
                    as ViewGroup
            } else {
                LayoutInflater.from(context)
                    .inflate(R.layout.media_carousel_settings_button_legacy, mediaFrame, false)
            }
        if (this::settingsButton.isInitialized) {
            mediaFrame.removeView(settingsButton)
        }
@@ -1112,11 +1119,17 @@ constructor(
                // communal for aesthetic and accessibility purposes since the background of
                // Glanceable Hub is a dynamic color.
                if (desiredLocation == MediaHierarchyManager.LOCATION_COMMUNAL_HUB) {
                    settingsButton.setColorFilter(
                    settingsButton
                        .requireViewById<ImageView>(R.id.settings_cog)
                        .setColorFilter(
                            context.getColor(com.android.internal.R.color.materialColorOnPrimary)
                        )
                } else {
                    settingsButton.setColorFilter(context.getColor(R.color.notification_gear_color))
                    settingsButton
                        .requireViewById<ImageView>(R.id.settings_cog)
                        .setColorFilter(
                            context.getColor(com.android.internal.R.color.materialColorOnSurface)
                        )
                }

                val shouldCloseGuts =