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

Commit 5a99de07 authored by Chelsea Hao's avatar Chelsea Hao Committed by Android (Google) Code Review
Browse files

Merge "Highlight audio sharing button when audio sharing is on." into main

parents 91914718 b36d91d1
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?><!--
  ~ Copyright (C) 2024 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.
  -->

<selector xmlns:android="http://schemas.android.com/apk/res/android" >
    <item android:state_activated="true"
        android:color="@color/qs_dialog_btn_filled_text_color" />
    <item android:color="@color/qs_dialog_btn_outline_text" />
</selector>
 No newline at end of file
+21 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2024 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.
  -->

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_activated="true" android:drawable="@drawable/qs_dialog_btn_filled" />
    <item android:drawable="@drawable/qs_dialog_btn_outline" />
</selector>
 No newline at end of file
+1 −2
Original line number Diff line number Diff line
@@ -258,7 +258,7 @@

            <Button
                android:id="@+id/audio_sharing_button"
                style="@style/Widget.Dialog.Button.BorderButton"
                style="@style/BluetoothTileDialog.AudioSharingButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="9dp"
@@ -270,7 +270,6 @@
                android:text="@string/quick_settings_bluetooth_audio_sharing_button"
                android:drawableStart="@drawable/ic_bt_le_audio_sharing_18dp"
                android:drawablePadding="10dp"
                android:drawableTint="?android:attr/textColorPrimary"
                app:layout_constrainedWidth="true"
                app:layout_constraintHorizontal_bias="0"
                app:layout_constraintEnd_toStartOf="@+id/done_button"
+6 −0
Original line number Diff line number Diff line
@@ -1455,6 +1455,12 @@
        <item name="android:textColor">?androidprv:attr/materialColorOnPrimaryContainer</item>
    </style>

    <style name="BluetoothTileDialog.AudioSharingButton" parent="Widget.Dialog.Button">
        <item name="android:background">@drawable/audio_sharing_btn_background</item>
        <item name="android:textColor">@color/audio_sharing_btn_text_color</item>
        <item name="android:drawableTint">@color/audio_sharing_btn_text_color</item>
    </style>

    <style name="BroadcastDialog">
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">wrap_content</item>
+7 −3
Original line number Diff line number Diff line
@@ -34,7 +34,9 @@ import kotlinx.coroutines.flow.stateIn

internal sealed class AudioSharingButtonState {
    object Gone : AudioSharingButtonState()
    data class Visible(@StringRes val resId: Int) : AudioSharingButtonState()

    data class Visible(@StringRes val resId: Int, val isActive: Boolean) :
        AudioSharingButtonState()
}

/** Holds business logic for the audio sharing state. */
@@ -73,7 +75,8 @@ constructor(
            // Show sharing audio when broadcasting
            BluetoothUtils.isBroadcasting(localBluetoothManager) ->
                AudioSharingButtonState.Visible(
                    R.string.quick_settings_bluetooth_audio_sharing_button_sharing
                    R.string.quick_settings_bluetooth_audio_sharing_button_sharing,
                    isActive = true
                )
            // When not broadcasting, don't show button if there's connected source in any device
            deviceItem.any {
@@ -85,7 +88,8 @@ constructor(
            // Show audio sharing when there's a connected LE audio device
            deviceItem.any { BluetoothUtils.isActiveLeAudioDevice(it.cachedBluetoothDevice) } ->
                AudioSharingButtonState.Visible(
                    R.string.quick_settings_bluetooth_audio_sharing_button
                    R.string.quick_settings_bluetooth_audio_sharing_button,
                    isActive = false
                )
            else -> AudioSharingButtonState.Gone
        }
Loading