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

Commit 6d95126b authored by jasonwshsu's avatar jasonwshsu
Browse files

Add Hearing devices related tools

* Use config_quickSettingsHearingDevicesRelatedToolName and config_quickSettingsHearingDevicesRelatedToolIcon to control what tools need to be shown here.
* If tool icon is not provided, will use icon in PackageManager instead.

Bug: 341648471
Test: atest HearingDevicesToolItemParserTest HearingDevicesDialogDelegateTest HearingDevicesToolItemListTest
Flag: EXEMPT bugfix

Change-Id: I69c7ef62b4d85a65a3efb950b32a4e00412a76c6
parent ad4b8690
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2021 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="@android:color/transparent"/>
            <corners android:radius="@dimen/hearing_devices_preset_spinner_background_radius"/>
            <stroke
                android:width="1dp"
                android:color="?androidprv:attr/textColorTertiary" />
        </shape>
    </item>
</ripple>
+33 −4
Original line number Diff line number Diff line
@@ -36,9 +36,8 @@
        style="@style/BluetoothTileDialog.Device"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:minHeight="@dimen/hearing_devices_preset_spinner_height"
        android:layout_marginTop="@dimen/hearing_devices_layout_margin"
        android:layout_marginBottom="@dimen/hearing_devices_layout_margin"
        android:minHeight="@dimen/hearing_devices_preset_spinner_height"
        android:gravity="center_vertical"
        android:background="@drawable/hearing_devices_preset_spinner_background"
        android:popupBackground="@drawable/hearing_devices_preset_spinner_popup_background"
@@ -54,9 +53,10 @@
        android:visibility="gone"/>

    <androidx.constraintlayout.widget.Barrier
        android:id="@+id/device_barrier"
        android:id="@+id/device_function_barrier"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:barrierAllowsGoneWidgets="false"
        app:barrierDirection="bottom"
        app:constraint_referenced_ids="device_list,preset_spinner" />

@@ -71,7 +71,8 @@
        android:contentDescription="@string/accessibility_hearing_device_pair_new_device"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toBottomOf="@id/device_barrier"
        app:layout_constraintTop_toBottomOf="@id/device_function_barrier"
        app:layout_constraintBottom_toTopOf="@id/related_tools_scroll"
        android:drawableStart="@drawable/ic_add"
        android:drawablePadding="20dp"
        android:drawableTint="?android:attr/textColorPrimary"
@@ -83,4 +84,32 @@
        android:maxLines="1"
        android:ellipsize="end" />

    <androidx.constraintlayout.widget.Barrier
        android:id="@+id/device_barrier"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:barrierAllowsGoneWidgets="false"
        app:barrierDirection="bottom"
        app:constraint_referenced_ids="device_function_barrier, pair_new_device_button" />

    <HorizontalScrollView
        android:id="@+id/related_tools_scroll"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/bluetooth_dialog_layout_margin"
        android:layout_marginEnd="@dimen/bluetooth_dialog_layout_margin"
        android:layout_marginTop="@dimen/hearing_devices_layout_margin"
        android:scrollbars="none"
        android:fillViewport="true"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toBottomOf="@id/preset_spinner">
        <LinearLayout
            android:id="@+id/related_tools_container"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="horizontal">
        </LinearLayout>
    </HorizontalScrollView>

</androidx.constraintlayout.widget.ConstraintLayout>
 No newline at end of file
+53 −0
Original line number Diff line number Diff line
<!--
    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.
-->

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/tool_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:gravity="center"
    android:focusable="true"
    android:clickable="true"
    android:layout_weight="1">
    <FrameLayout
        android:id="@+id/icon_frame"
        android:layout_width="@dimen/hearing_devices_tool_icon_frame_width"
        android:layout_height="@dimen/hearing_devices_tool_icon_frame_height"
        android:background="@drawable/qs_hearing_devices_related_tools_background"
        android:focusable="false" >
        <ImageView
            android:id="@+id/tool_icon"
            android:layout_width="@dimen/hearing_devices_tool_icon_size"
            android:layout_height="@dimen/hearing_devices_tool_icon_size"
            android:layout_gravity="center"
            android:scaleType="fitCenter"
            android:focusable="false" />
    </FrameLayout>
    <TextView
        android:id="@+id/tool_name"
        android:textDirection="locale"
        android:textAlignment="center"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/hearing_devices_layout_margin"
        android:ellipsize="end"
        android:maxLines="1"
        android:textSize="12sp"
        android:textAppearance="@style/TextAppearance.Dialog.Body.Message"
        android:focusable="false" />
</LinearLayout>
 No newline at end of file
+14 −0
Original line number Diff line number Diff line
@@ -125,6 +125,20 @@
    <!-- Use collapsed layout for media player in landscape QQS -->
    <bool name="config_quickSettingsMediaLandscapeCollapsed">true</bool>

    <!-- For hearing devices related tool list. Need to be in ComponentName format (package/class).
         Should be activity to be launched.
         Already contains tool that holds intent: "com.android.settings.action.live_caption".
         Maximum number is 3. -->
    <string-array name="config_quickSettingsHearingDevicesRelatedToolName" translatable="false">
    </string-array>

    <!-- The drawable resource names. If provided, it will replace the corresponding icons in
         config_quickSettingsHearingDevicesRelatedToolName. Can be empty to use original icons.
         Already contains tool that holds intent: "com.android.settings.action.live_caption".
         Maximum number is 3. -->
    <string-array name="config_quickSettingsHearingDevicesRelatedToolIcon" translatable="false">
    </string-array>

    <!-- Show indicator for Wifi on but not connected. -->
    <bool name="config_showWifiIndicatorWhenEnabled">false</bool>

+3 −0
Original line number Diff line number Diff line
@@ -1774,6 +1774,9 @@
    <dimen name="hearing_devices_preset_spinner_text_padding_vertical">15dp</dimen>
    <dimen name="hearing_devices_preset_spinner_arrow_size">24dp</dimen>
    <dimen name="hearing_devices_preset_spinner_background_radius">28dp</dimen>
    <dimen name="hearing_devices_tool_icon_frame_width">94dp</dimen>
    <dimen name="hearing_devices_tool_icon_frame_height">64dp</dimen>
    <dimen name="hearing_devices_tool_icon_size">28dp</dimen>

    <!-- Height percentage of the parent container occupied by the communal view -->
    <item name="communal_source_height_percentage" format="float" type="dimen">0.80</item>
Loading