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

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

Add ripple effect for "see all" and "pair new device" button in bt tile dialog.

Test: atest -c com.android.systemui.qs.tiles.dialog.bluetooth
Bug: b/309925061
Change-Id: I73d64257fd178a2f2b83753ffd5783f7490c91a7
parent c0c46409
Loading
Loading
Loading
Loading
+35 −85
Original line number Diff line number Diff line
@@ -111,107 +111,57 @@
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/bluetooth_toggle"
                app:layout_constraintBottom_toTopOf="@+id/see_all_text" />
                app:layout_constraintBottom_toTopOf="@+id/see_all_button" />

            <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" />

            <View
                android:id="@+id/see_all_clickable_row"
            <Button
                android:id="@+id/see_all_button"
                style="@style/BluetoothTileDialog.Device"
                android:paddingEnd="0dp"
                android:paddingStart="20dp"
                android:background="@drawable/bluetooth_tile_dialog_bg_off"
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:layout_height="64dp"
                android:contentDescription="@string/accessibility_bluetooth_device_settings_see_all"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/device_list"
                app:layout_constraintBottom_toTopOf="@+id/pair_new_device_text" />

            <ImageView
                android:id="@+id/ic_arrow"
                android:layout_marginStart="36dp"
                android:layout_width="24dp"
                android:layout_height="24dp"
                android:importantForAccessibility="no"
                android:gravity="center_vertical"
                android:src="@drawable/ic_arrow_forward"
                app:layout_constraintBottom_toTopOf="@+id/pair_new_device_text"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintEnd_toStartOf="@id/see_all_text"
                app:layout_constraintTop_toBottomOf="@id/device_list" />

            <TextView
                android:id="@+id/see_all_text"
                style="@style/BluetoothTileDialog.Device"
                android:layout_width="0dp"
                android:layout_height="64dp"
                android:maxLines="1"
                android:ellipsize="end"
                android:gravity="center_vertical"
                android:importantForAccessibility="no"
                android:clickable="false"
                android:layout_marginStart="0dp"
                android:paddingStart="20dp"
                app:layout_constraintBottom_toTopOf="@+id/pair_new_device_button"
                android:drawableStart="@drawable/ic_arrow_forward"
                android:drawablePadding="20dp"
                android:drawableTint="?android:attr/textColorPrimary"
                android:text="@string/see_all_bluetooth_devices"
                android:textSize="14sp"
                android:textAppearance="@style/TextAppearance.Dialog.Title"
                app:layout_constraintBottom_toTopOf="@+id/pair_new_device_text"
                app:layout_constraintStart_toEndOf="@+id/ic_arrow"
                app:layout_constraintTop_toBottomOf="@id/device_list"
                app:layout_constraintEnd_toEndOf="parent" />

            <androidx.constraintlayout.widget.Group
                android:id="@+id/pair_new_device_layout_group"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:visibility="gone"
                app:constraint_referenced_ids="ic_add,pair_new_device_text" />
                android:textDirection="locale"
                android:textAlignment="viewStart"
                android:maxLines="1"
                android:ellipsize="end"
                android:visibility="gone" />

            <View
                android:id="@+id/pair_new_device_clickable_row"
            <Button
                android:id="@+id/pair_new_device_button"
                style="@style/BluetoothTileDialog.Device"
                android:paddingEnd="0dp"
                android:paddingStart="20dp"
                android:background="@drawable/bluetooth_tile_dialog_bg_off"
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:layout_height="64dp"
                android:contentDescription="@string/accessibility_bluetooth_device_settings_pair_new_device"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/see_all_text"
                app:layout_constraintBottom_toTopOf="@+id/done_button" />

            <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/done_button"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintEnd_toStartOf="@id/pair_new_device_text"
                app:layout_constraintTop_toBottomOf="@id/see_all_text"
                android:tint="?android:attr/textColorPrimary" />

            <TextView
                android:id="@+id/pair_new_device_text"
                style="@style/BluetoothTileDialog.Device"
                android:layout_width="0dp"
                android:layout_height="64dp"
                android:maxLines="1"
                android:ellipsize="end"
                android:gravity="center_vertical"
                android:importantForAccessibility="no"
                android:clickable="false"
                android:layout_marginStart="0dp"
                android:paddingStart="20dp"
                app:layout_constraintTop_toBottomOf="@+id/see_all_button"
                app:layout_constraintBottom_toTopOf="@+id/done_button"
                android:drawableStart="@drawable/ic_add"
                android:drawablePadding="20dp"
                android:drawableTint="?android:attr/textColorPrimary"
                android:text="@string/pair_new_bluetooth_devices"
                android:textSize="14sp"
                android:textAppearance="@style/TextAppearance.Dialog.Title"
                app:layout_constraintStart_toEndOf="@+id/ic_add"
                app:layout_constraintTop_toBottomOf="@id/see_all_text"
                app:layout_constraintEnd_toEndOf="parent" />
                android:textDirection="locale"
                android:textAlignment="viewStart"
                android:maxLines="1"
                android:ellipsize="end"
                android:visibility="gone" />

            <Button
                android:id="@+id/done_button"
@@ -227,7 +177,7 @@
                android:maxLines="1"
                android:text="@string/inline_done_button"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintTop_toBottomOf="@id/pair_new_device_text"
                app:layout_constraintTop_toBottomOf="@id/pair_new_device_button"
                app:layout_constraintBottom_toBottomOf="parent" />
        </androidx.constraintlayout.widget.ConstraintLayout>
    </androidx.core.widget.NestedScrollView>
+8 −12
Original line number Diff line number Diff line
@@ -81,10 +81,8 @@ constructor(
    private lateinit var toggleView: Switch
    private lateinit var subtitleTextView: TextView
    private lateinit var doneButton: View
    private lateinit var seeAllViewGroup: View
    private lateinit var pairNewDeviceViewGroup: View
    private lateinit var seeAllRow: View
    private lateinit var pairNewDeviceRow: View
    private lateinit var seeAllButton: View
    private lateinit var pairNewDeviceButton: View
    private lateinit var deviceListView: RecyclerView

    override fun onCreate(savedInstanceState: Bundle?) {
@@ -99,10 +97,8 @@ constructor(
        toggleView = requireViewById(R.id.bluetooth_toggle)
        subtitleTextView = requireViewById(R.id.bluetooth_tile_dialog_subtitle) as TextView
        doneButton = requireViewById(R.id.done_button)
        seeAllViewGroup = requireViewById(R.id.see_all_layout_group)
        pairNewDeviceViewGroup = requireViewById(R.id.pair_new_device_layout_group)
        seeAllRow = requireViewById(R.id.see_all_clickable_row)
        pairNewDeviceRow = requireViewById(R.id.pair_new_device_clickable_row)
        seeAllButton = requireViewById(R.id.see_all_button)
        pairNewDeviceButton = requireViewById(R.id.pair_new_device_button)
        deviceListView = requireViewById<RecyclerView>(R.id.device_list)

        setupToggle()
@@ -110,8 +106,8 @@ constructor(

        subtitleTextView.text = context.getString(subtitleResIdInitialValue)
        doneButton.setOnClickListener { dismiss() }
        seeAllRow.setOnClickListener { bluetoothTileDialogCallback.onSeeAllClicked(it) }
        pairNewDeviceRow.setOnClickListener {
        seeAllButton.setOnClickListener { bluetoothTileDialogCallback.onSeeAllClicked(it) }
        pairNewDeviceButton.setOnClickListener {
            bluetoothTileDialogCallback.onPairNewDeviceClicked(it)
        }
    }
@@ -134,8 +130,8 @@ constructor(
            }
            if (isActive) {
                deviceItemAdapter.refreshDeviceItemList(deviceItem) {
                    seeAllViewGroup.visibility = if (showSeeAll) VISIBLE else GONE
                    pairNewDeviceViewGroup.visibility = if (showPairNewDevice) VISIBLE else GONE
                    seeAllButton.visibility = if (showSeeAll) VISIBLE else GONE
                    pairNewDeviceButton.visibility = if (showPairNewDevice) VISIBLE else GONE
                    lastUiUpdateMs = systemClock.elapsedRealtime()
                    lastItemRow = itemRow
                    logger.logDeviceUiUpdate(lastUiUpdateMs - start)
+7 −7
Original line number Diff line number Diff line
@@ -228,16 +228,16 @@ class BluetoothTileDialogTest : SysuiTestCase() {
                showPairNewDevice = true
            )

            val seeAllLayout = bluetoothTileDialog.requireViewById<View>(R.id.see_all_layout_group)
            val pairNewLayout =
                bluetoothTileDialog.requireViewById<View>(R.id.pair_new_device_layout_group)
            val seeAllButton = bluetoothTileDialog.requireViewById<View>(R.id.see_all_button)
            val pairNewButton =
                bluetoothTileDialog.requireViewById<View>(R.id.pair_new_device_button)
            val recyclerView = bluetoothTileDialog.requireViewById<RecyclerView>(R.id.device_list)
            val adapter = recyclerView?.adapter as BluetoothTileDialog.Adapter

            assertThat(seeAllLayout).isNotNull()
            assertThat(seeAllLayout.visibility).isEqualTo(GONE)
            assertThat(pairNewLayout).isNotNull()
            assertThat(pairNewLayout.visibility).isEqualTo(VISIBLE)
            assertThat(seeAllButton).isNotNull()
            assertThat(seeAllButton.visibility).isEqualTo(GONE)
            assertThat(pairNewButton).isNotNull()
            assertThat(pairNewButton.visibility).isEqualTo(VISIBLE)
            assertThat(adapter.itemCount).isEqualTo(1)
        }
    }