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

Commit df21e0df authored by chelseahao's avatar chelseahao Committed by Chelsea Hao
Browse files

Implemented click events for gear, see all and pair new device.

Flag: BLUETOOTH_QS_TILE_DIALOG
Test: atest -c BluetoothTileDialogTest BluetoothTileDialogViewModelTest DeviceItemFactoryTest DeviceItemInteractorTest BluetoothTileDialogRepositoryTest BluetoothStateInteractorTest
Bug: b/298124674 b/299400510
Change-Id: I0549c6cc31fef1eea4213b592430c17288e31a5c
parent f311c6dc
Loading
Loading
Loading
Loading
+57 −31
Original line number Diff line number Diff line
@@ -14,55 +14,81 @@
  ~ limitations under the License.
  -->

<!-- TODO(b/298124674) remove this root -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/bluetooth_device_container"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/bluetooth_device_list_container"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:layout_marginBottom="4dp">

    <LinearLayout
        android:id="@+id/bluetooth_device"
    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/bluetooth_device_row"
        style="@style/BluetoothTileDialog.Device"
        android:layout_height="@dimen/bluetooth_dialog_device_height"
        android:paddingEnd="24dp"
        android:paddingStart="20dp"
        android:baselineAligned="false">

        <FrameLayout
            android:layout_width="24dp"
            android:layout_height="24dp"
            android:layout_gravity="center_vertical|start"
            android:clickable="false">

        <ImageView
            android:id="@+id/bluetooth_device_icon"
            android:contentDescription="@string/accessibility_bluetooth_device_icon"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center" />
        </FrameLayout>
            android:layout_width="24dp"
            android:layout_height="24dp"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintBottom_toBottomOf="parent"
            android:layout_gravity="center_vertical" />

        <LinearLayout
        <View
            android:id="@+id/bluetooth_device"
            android:layout_width="0dp"
            android:layout_height="@dimen/bluetooth_dialog_device_height"
            android:paddingStart="20dp"
            android:paddingEnd="24dp"
            android:layout_marginEnd="30dp"
            android:layout_weight="1"
            android:clickable="false"
            android:gravity="start|center_vertical"
            android:orientation="vertical">
            android:layout_height="0dp"
            app:layout_constraintTop_toTopOf="@+id/bluetooth_device_name"
            app:layout_constraintBottom_toBottomOf="@+id/bluetooth_device_summary"
            app:layout_constraintStart_toStartOf="@+id/bluetooth_device_name"
            app:layout_constraintEnd_toEndOf="@+id/bluetooth_device_name" />

        <TextView
            android:layout_width="0dp"
            android:id="@+id/bluetooth_device_name"
            style="@style/BluetoothTileDialog.DeviceName"
            android:paddingStart="20dp"
            android:paddingTop="10dp"
            app:layout_constraintWidth_percent="0.7"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintStart_toEndOf="@+id/bluetooth_device_icon"
            app:layout_constraintEnd_toStartOf="@+id/gear_icon"
            app:layout_constraintBottom_toTopOf="@+id/bluetooth_device_summary"
            android:gravity="center_vertical"
            android:textSize="14sp" />

        <TextView
            android:layout_width="0dp"
            android:id="@+id/bluetooth_device_summary"
                style="@style/BluetoothTileDialog.DeviceSummary" />
        </LinearLayout>
    </LinearLayout>
            style="@style/BluetoothTileDialog.DeviceSummary"
            android:paddingStart="20dp"
            android:paddingBottom="10dp"
            app:layout_constraintWidth_percent="0.7"
            app:layout_constraintTop_toBottomOf="@+id/bluetooth_device_name"
            app:layout_constraintStart_toEndOf="@+id/bluetooth_device_icon"
            app:layout_constraintEnd_toStartOf="@+id/gear_icon"
            app:layout_constraintBottom_toBottomOf="parent"
            android:gravity="center_vertical" />

        <ImageView
            android:id="@+id/gear_icon"
            android:src="@drawable/ic_settings_24dp"
            android:contentDescription="@string/accessibility_bluetooth_device_settings_gear"
            android:layout_width="0dp"
            android:layout_height="24dp"
            app:layout_constraintStart_toEndOf="@+id/bluetooth_device_name"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintWidth_percent="0.3"
            android:gravity="center_vertical"
            android:paddingStart="10dp" />
    </androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
 No newline at end of file
+163 −143
Original line number Diff line number Diff line
@@ -14,93 +14,112 @@
  ~ limitations under the License.
  -->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/root"
    android:layout_width="@dimen/large_dialog_width"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <LinearLayout
    style="@style/Widget.SliceView.Panel"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="@dimen/bluetooth_dialog_layout_margin"
        android:layout_marginTop="24dp"
        android:gravity="center_vertical|center_horizontal"
        android:orientation="vertical">
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

    <TextView
        android:id="@+id/bluetooth_tile_dialog_title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingTop="24dp"
        android:ellipsize="end"
        android:gravity="center_vertical|center_horizontal"
        android:text="@string/quick_settings_bluetooth_label"
        android:textAppearance="@style/TextAppearance.Dialog.Title"
            android:textSize="24sp" />
        android:textSize="24sp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintBottom_toTopOf="@id/bluetooth_tile_dialog_subtitle"
        app:layout_constraintTop_toTopOf="parent" />

    <TextView
        android:id="@+id/bluetooth_tile_dialog_subtitle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="4dp"
        android:layout_marginBottom="@dimen/bluetooth_dialog_layout_margin"
        android:ellipsize="end"
        android:gravity="center_vertical|center_horizontal"
        android:maxLines="1"
        android:text="@string/quick_settings_bluetooth_tile_subtitle"
            android:textAppearance="@style/TextAppearance.Dialog.Body.Message" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/turn_on_bluetooth_layout"
        style="@style/BluetoothTileDialog.Device"
        android:layout_height="@dimen/bluetooth_dialog_device_height"
        android:gravity="center"
        android:clickable="false"
        android:focusable="false"
        android:baselineAligned="false">
        android:textAppearance="@style/TextAppearance.Dialog.Body.Message"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintBottom_toTopOf="@id/bluetooth_toggle_title"
        app:layout_constraintTop_toBottomOf="@id/bluetooth_tile_dialog_title" />

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="start|center_vertical"
            android:orientation="vertical"
            android:clickable="false">
    <TextView
        android:id="@+id/bluetooth_toggle_title"
        style="@style/BluetoothTileDialog.Device"
        android:layout_width="0dp"
        android:layout_height="64dp"
        android:gravity="center_vertical"
        android:layout_marginTop="4dp"
        android:text="@string/turn_on_bluetooth"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="start|center_vertical"
        android:textAppearance="@style/TextAppearance.Dialog.Body.Message"
                android:textSize="16sp"/>
        </LinearLayout>
        android:textSize="16sp"
        app:layout_constraintEnd_toStartOf="@+id/bluetooth_toggle"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/bluetooth_tile_dialog_subtitle" />

        <FrameLayout
            android:layout_width="@dimen/settingslib_switch_track_width"
            android:layout_height="48dp"
            android:layout_marginTop="10dp"
            android:layout_marginBottom="10dp">
    <Switch
        android:id="@+id/bluetooth_toggle"
        style="@style/BluetoothTileDialog.Device"
        android:layout_width="0dp"
        android:layout_height="48dp"
        android:gravity="center|center_vertical"
        android:paddingEnd="24dp"
        android:layout_marginTop="10dp"
        android:contentDescription="@string/turn_on_bluetooth"
        android:switchMinWidth="@dimen/settingslib_switch_track_width"
                android:layout_gravity="center"
                android:layout_width="@dimen/settingslib_switch_track_width"
                android:layout_height="match_parent"
                android:track="@drawable/settingslib_track_selector"
        android:theme="@style/MainSwitch.Settingslib"
        android:thumb="@drawable/settingslib_thumb_selector"
                android:theme="@style/MainSwitch.Settingslib"/>
        </FrameLayout>

    </LinearLayout>
        android:track="@drawable/settingslib_track_selector"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toEndOf="@+id/bluetooth_toggle_title"
        app:layout_constraintTop_toBottomOf="@id/bluetooth_tile_dialog_subtitle" />

    <LinearLayout
        android:id="@+id/body_layout"
        android:layout_width="match_parent"
    <androidx.constraintlayout.widget.Group
        android:id="@+id/pair_new_device_layout_group"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical">
        android:visibility="gone"
        app:constraint_referenced_ids="ic_add,pair_new_device_text" />

    <ImageView
        android:id="@+id/ic_add"
        android:layout_width="24dp"
        android:layout_height="24dp"
        android:layout_marginStart="36dp"
        android:gravity="center_vertical"
        android:importantForAccessibility="no"
        android:src="@drawable/ic_add"
        app:layout_constraintBottom_toTopOf="@id/device_list"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toStartOf="@id/pair_new_device_text"
        app:layout_constraintTop_toBottomOf="@id/bluetooth_toggle_title"
        android:tint="?android:attr/textColorPrimary" />

    <TextView
        android:id="@+id/pair_new_device_text"
        style="@style/BluetoothTileDialog.Device"
        android:layout_width="0dp"
        android:layout_height="@dimen/bluetooth_dialog_device_height"
        android:gravity="center_vertical"
        android:layout_marginStart="0dp"
        android:paddingStart="20dp"
        android:text="@string/pair_new_bluetooth_devices"
        android:textSize="14sp"
        android:textAppearance="@style/TextAppearance.Dialog.Title"
        app:layout_constraintBottom_toTopOf="@id/device_list"
        app:layout_constraintStart_toEndOf="@+id/ic_add"
        app:layout_constraintTop_toBottomOf="@id/bluetooth_toggle_title"
        app:layout_constraintEnd_toEndOf="parent" />

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/device_list"
@@ -108,61 +127,62 @@
        android:layout_height="wrap_content"
        android:nestedScrollingEnabled="false"
        android:overScrollMode="never"
            android:scrollbars="vertical" />

        <LinearLayout
            android:id="@+id/see_all_layout"
            style="@style/BluetoothTileDialog.Device"
            android:layout_height="64dp"
            android:paddingStart="20dp"
            android:visibility="gone">
        android:scrollbars="vertical"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toBottomOf="@id/pair_new_device_text"
        app:layout_constraintBottom_toTopOf="@+id/see_all_text" />

    <androidx.constraintlayout.widget.Group
        android:id="@+id/see_all_layout_group"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:visibility="gone"
        app:constraint_referenced_ids="ic_arrow,see_all_text" />

            <FrameLayout
    <ImageView
        android:id="@+id/ic_arrow"
        android:layout_marginStart="36dp"
        android:layout_width="24dp"
        android:layout_height="24dp"
                android:layout_gravity="center_vertical|start"
                android:clickable="false">

                <ImageView
                    android:id="@+id/arrow_forward"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
        android:importantForAccessibility="no"
        android:gravity="center_vertical"
        android:src="@drawable/ic_arrow_forward"
                    android:importantForAccessibility="no" />
            </FrameLayout>

            <FrameLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginStart="@dimen/bluetooth_dialog_layout_margin"
                android:clickable="false"
                android:orientation="vertical">
        app:layout_constraintBottom_toTopOf="@+id/done_button"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toStartOf="@id/see_all_text"
        app:layout_constraintTop_toBottomOf="@id/device_list" />

    <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:gravity="start|center_vertical"
        android:id="@+id/see_all_text"
        style="@style/BluetoothTileDialog.Device"
        android:layout_width="0dp"
        android:layout_height="@dimen/bluetooth_dialog_device_height"
        android:gravity="center_vertical"
        android:layout_marginStart="0dp"
        android:paddingStart="20dp"
        android:text="@string/see_all_bluetooth_devices"
                    android:textAppearance="@style/TextAppearance.Dialog.Body.Message"
                    android:textSize="14sp" />
            </FrameLayout>
        </LinearLayout>
        android:textSize="14sp"
        android:textAppearance="@style/TextAppearance.Dialog.Title"
        app:layout_constraintBottom_toTopOf="@+id/done_button"
        app:layout_constraintStart_toEndOf="@+id/ic_arrow"
        app:layout_constraintTop_toBottomOf="@id/device_list"
        app:layout_constraintEnd_toEndOf="parent" />

    <Button
        android:id="@+id/done_button"
        style="@style/Widget.Dialog.Button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:layout_marginStart="@dimen/dialog_side_padding"
            android:layout_marginEnd="@dimen/dialog_side_padding"
        android:layout_marginBottom="@dimen/dialog_bottom_padding"
            android:text="@string/inline_done_button"
            android:layout_gravity="end|center_vertical"
            style="@style/Widget.Dialog.Button"
            android:maxLines="1"
            android:ellipsize="end"
        android:layout_marginEnd="@dimen/dialog_side_padding"
        android:layout_marginStart="@dimen/dialog_side_padding"
        android:clickable="true"
            android:focusable="true"/>
    </LinearLayout>
</LinearLayout>
 No newline at end of file
        android:ellipsize="end"
        android:focusable="true"
        android:maxLines="1"
        android:text="@string/inline_done_button"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toBottomOf="@id/see_all_text" />
</androidx.constraintlayout.widget.ConstraintLayout>
 No newline at end of file
+6 −2
Original line number Diff line number Diff line
@@ -462,7 +462,9 @@

    <!-- Content description of the bluetooth device icon. [CHAR LIMIT=NONE] -->
    <string name="accessibility_bluetooth_device_icon">Bluetooth device icon</string>
    <!-- Content description of the bluetooth icon when connecting for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->

    <!-- Content description of the bluetooth device settings gear icon. [CHAR LIMIT=NONE] -->
    <string name="accessibility_bluetooth_device_settings_gear">Bluetooth device settings gear</string>

    <!-- Content description of the battery when battery state is unknown for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_battery_unknown">Battery percentage unknown.</string>
@@ -625,7 +627,9 @@
    <!-- QuickSettings: Bluetooth detail panel, text when there are no items [CHAR LIMIT=NONE] -->
    <string name="quick_settings_bluetooth_detail_empty_text">No paired devices available</string>
    <!-- QuickSettings: Bluetooth dialog subtitle [CHAR LIMIT=NONE]-->
    <string name="quick_settings_bluetooth_tile_subtitle">Tap to connect or disconnect</string>
    <string name="quick_settings_bluetooth_tile_subtitle">Tap a device to connect</string>
    <!-- QuickSettings: Bluetooth dialog pair new devices [CHAR LIMIT=NONE]-->
    <string name="pair_new_bluetooth_devices">Pair new device</string>
    <!-- QuickSettings: Bluetooth dialog see all devices [CHAR LIMIT=NONE]-->
    <string name="see_all_bluetooth_devices">See all</string>
    <!-- QuickSettings: Bluetooth dialog turn on Bluetooth [CHAR LIMIT=NONE]-->
+0 −1
Original line number Diff line number Diff line
@@ -1280,7 +1280,6 @@
    </style>

    <style name="BluetoothTileDialog.DeviceSummary">
        <item name="android:layout_marginEnd">7dp</item>
        <item name="android:ellipsize">end</item>
        <item name="android:maxLines">2</item>
        <item name="android:textAppearance">@style/TextAppearance.Dialog.Body.Message</item>
+50 −18

File changed.

Preview size limit exceeded, changes collapsed.

Loading