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

Commit 7ee00d4b authored by Luna Zhang's avatar Luna Zhang
Browse files

Update bluetooth details view's device row UI (part 2)

Update the background for connected devices based on the device's position.

Bug: b/378514021
Flag: com.android.systemui.qs_tile_detailed_view
Test: Manually tested
Change-Id: Ib8a89563d96a1daf01dc15790e8302a8128dfc56
parent 16338fe6
Loading
Loading
Loading
Loading
+29 −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.
  -->

<ripple xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    android:color="?android:attr/colorControlHighlight">
    <item>
        <shape android:shape="rectangle">
            <solid android:color="@androidprv:color/materialColorPrimary"/>
            <corners
                android:bottomLeftRadius="@dimen/settingslib_switch_bar_radius"
                android:bottomRightRadius="@dimen/settingslib_switch_bar_radius"/>
        </shape>
    </item>
</ripple>
+26 −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.
  -->

<ripple xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    android:color="?android:attr/colorControlHighlight">
    <item>
        <shape android:shape="rectangle">
            <solid android:color="@androidprv:color/materialColorPrimary"/>
        </shape>
    </item>
</ripple>
+29 −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.
  -->

<ripple xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    android:color="?android:attr/colorControlHighlight">
    <item>
        <shape android:shape="rectangle">
            <solid android:color="@androidprv:color/materialColorPrimary"/>
            <corners
                android:topLeftRadius="@dimen/settingslib_switch_bar_radius"
                android:topRightRadius="@dimen/settingslib_switch_bar_radius"/>
        </shape>
    </item>
</ripple>
+18 −1
Original line number Diff line number Diff line
@@ -153,6 +153,9 @@ constructor(

    // UI Components that only exist in tile details view, but not in dialog.
    private var entryBackgroundActive: Drawable? = null
    private var entryBackgroundActiveStart: Drawable? = null
    private var entryBackgroundActiveEnd: Drawable? = null
    private var entryBackgroundActiveMiddle: Drawable? = null
    private var entryBackgroundInactive: Drawable? = null
    private var entryBackgroundInactiveStart: Drawable? = null
    private var entryBackgroundInactiveEnd: Drawable? = null
@@ -206,6 +209,12 @@ constructor(
        } else {
            entryBackgroundActive =
                contentView.context.getDrawable(R.drawable.settingslib_entry_bg_on)
            entryBackgroundActiveStart =
                contentView.context.getDrawable(R.drawable.settingslib_entry_bg_on_start)
            entryBackgroundActiveEnd =
                contentView.context.getDrawable(R.drawable.settingslib_entry_bg_on_end)
            entryBackgroundActiveMiddle =
                contentView.context.getDrawable(R.drawable.settingslib_entry_bg_on_middle)
            entryBackgroundInactive =
                contentView.context.getDrawable(R.drawable.settingslib_entry_bg_off)
            entryBackgroundInactiveStart =
@@ -482,7 +491,15 @@ constructor(
                                    }
                            } else {
                                // Set up background for connected devices
                                background = entryBackgroundActive
                                background =
                                    when {
                                        lastConnectedDeviceIndex == 0 -> entryBackgroundActive
                                        adapterPosition == 0 -> entryBackgroundActiveStart
                                        adapterPosition == lastConnectedDeviceIndex ->
                                            entryBackgroundActiveEnd

                                        else -> entryBackgroundActiveMiddle
                                    }
                            }
                            background?.setBounds(child.left, child.top, child.right, child.bottom)
                            background?.draw(c)