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

Commit fba474a8 authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Add an output chooser dialog to volume panel

It shows paired bluetooth devices, filtered on major type
audio_video and uncategorized.

Test: manual
Bug: 63096355
Change-Id: I606cbd581f382752a05b4ffec7707427252ac788
parent 40f00d79
Loading
Loading
Loading
Loading
+55 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2017 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.
-->
<!-- extends FrameLayout -->
<com.android.systemui.volume.OutputChooserLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:sysui="http://schemas.android.com/apk/res-auto"
    android:id="@+id/output_chooser"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="20dp" >

    <com.android.systemui.qs.AutoSizingList
        android:id="@android:id/list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        sysui:itemHeight="@dimen/qs_detail_item_height"
        style="@style/AutoSizingList"/>

    <LinearLayout
        android:id="@android:id/empty"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center"
        android:gravity="center"
        android:orientation="vertical">

        <ImageView
            android:id="@android:id/icon"
            android:layout_width="56dp"
            android:layout_height="56dp"
            android:tint="?android:attr/textColorSecondary" />

        <TextView
            android:id="@android:id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="20dp"
            android:textAppearance="@style/TextAppearance.QS.DetailEmpty"/>
    </LinearLayout>
</com.android.systemui.volume.OutputChooserLayout>
+71 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2017 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.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:minHeight="@dimen/qs_detail_item_height"
              android:background="@drawable/btn_borderless_rect"
              android:clickable="true"
              android:focusable="true"
              android:gravity="center_vertical"
              android:orientation="horizontal" >

    <ImageView
        android:id="@android:id/icon"
        android:layout_width="@dimen/qs_detail_item_icon_width"
        android:layout_height="@dimen/qs_detail_item_icon_size"
        android:layout_marginStart="@dimen/qs_detail_item_icon_marginStart"
        android:layout_marginEnd="@dimen/qs_detail_item_icon_marginEnd"
        android:tint="?android:attr/textColorPrimary"/>

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="12dp"
        android:layout_weight="1"
        android:orientation="vertical" >

        <TextView
            android:id="@android:id/title"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textDirection="locale"
            android:ellipsize="end"
            android:textAppearance="@style/TextAppearance.QS.DetailItemPrimary" />

        <TextView
            android:id="@android:id/summary"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textDirection="locale"
            android:layout_marginTop="2dp"
            android:textAppearance="@style/TextAppearance.QS.DetailItemSecondary" />
    </LinearLayout>

    <ImageView
        android:id="@android:id/icon2"
        style="@style/QSBorderlessButton"
        android:layout_width="48dp"
        android:layout_height="48dp"
        android:layout_marginStart="30dp"
        android:clickable="true"
        android:focusable="true"
        android:scaleType="center"
        android:contentDescription="@*android:string/media_route_controller_disconnect"
        android:tint="?android:attr/textColorPrimary" />

</LinearLayout>
+53 −34
Original line number Diff line number Diff line
@@ -70,10 +70,18 @@
                android:layout_height="@dimen/volume_button_size"
                android:clickable="true"
                android:soundEffectsEnabled="false"
                android:src="@drawable/ic_volume_collapse_animation"
                android:src="@drawable/ic_volume_expand_animation"
                android:background="@drawable/ripple_drawable"
                tools:ignore="RtlHardcoded" />
        </LinearLayout>
        <RelativeLayout
            android:id="@+id/footer"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:clipChildren="false"
            android:clipToPadding="false"
            android:layout_below="@id/volume_dialog_content"
            android:layout_margin="10dp">
            <!-- special row for ringer mode -->
            <RelativeLayout
                android:id="@+id/ringer_mode"
@@ -82,7 +90,7 @@
                android:background="@drawable/rounded_bg_full"
                android:clipChildren="false"
                android:clipToPadding="false"
            android:layout_below="@id/volume_dialog_content"
                android:layout_toStartOf="@id/output_chooser"
                android:layout_margin="10dp">

                <com.android.keyguard.AlphaOptimizedImageButton
@@ -97,7 +105,7 @@

                <TextView
                    android:id="@+id/ringer_title"
                android:text="@string/stream_ring"
                    android:text="@string/ring_toggle_title"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:ellipsize="end"
@@ -123,5 +131,16 @@
                    android:textAppearance="?android:attr/textAppearanceSmall" />

            </RelativeLayout>
            <com.android.keyguard.AlphaOptimizedImageButton
                android:id="@+id/output_chooser"
                style="@style/VolumeButtons"
                android:background="?android:selectableItemBackgroundBorderless"
                android:layout_width="@dimen/volume_button_size"
                android:layout_height="@dimen/volume_button_size"
                android:layout_alignParentEnd="true"
                android:layout_centerVertical="true"
                android:src="@drawable/ic_settings_bluetooth"
                android:soundEffectsEnabled="false" />
        </RelativeLayout>
    </RelativeLayout>
</com.android.systemui.volume.VolumeUiLayout>
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
@@ -1248,6 +1248,7 @@
    <string name="stream_tts" translatable="false">Transmitted Through Speaker</string> <!-- STREAM_TTS -->
    <string name="stream_accessibility">Accessibility</string> <!-- STREAM_ACCESSIBILITY -->

    <string name="ring_toggle_title">Calls</string>
    <string name="volume_ringer_status_normal">Ring</string>
    <string name="volume_ringer_status_vibrate">Vibrate</string>
    <string name="volume_ringer_status_silent">Mute</string>
+3 −1
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ public class Events {
    public static final int DISMISS_REASON_SETTINGS_CLICKED = 5;
    public static final int DISMISS_REASON_DONE_CLICKED = 6;
    public static final int DISMISS_STREAM_GONE = 7;
    public static final int DISMISS_REASON_OUTPUT_CHOOSER = 8;
    public static final String[] DISMISS_REASONS = {
            "unknown",
            "touch_outside",
@@ -88,7 +89,8 @@ public class Events {
            "screen_off",
            "settings_clicked",
            "done_clicked",
            "a11y_stream_changed"
            "a11y_stream_changed",
            "output_chooser"
    };

    public static final int SHOW_REASON_UNKNOWN = 0;
Loading