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

Commit b3828743 authored by Caitlin Cassidy's avatar Caitlin Cassidy
Browse files

[Media TTT] Add three different states for the media TTT chip and allow

each of them to be displayed with the correct text via adb.

For example, to display the "Move closer to..." chip state for a device
named "Tablet", run the adb command `adb shell cmd statusbar
media-ttt-chip-add Tablet MOVE_CLOSER_TO_TRANSFER`.

App icon, loading icon, and undo button coming in future CLs.
Screenshots of the chip with loading and undo are in
https://b.corp.google.com/issues/203800327#comment3.

Bug: 203800327
Test: `adb shell cmd statusbar
media-ttt-chip-add Tablet MOVE_CLOSER_TO_TRANSFER` shows a chip with the
text "Move closer to play on Tablet"
Test: `adb shell cmd statusbar
media-ttt-chip-add Tablet TRANSFER_INITIATED` shows a chip with the text
"Playing on Tablet" (will have a loading icon in future)
Test: `adb shell cmd statusbar
media-ttt-chip-add Tablet TRANSFER_SUCCEEDED` shows a chip with the text
"Playing on Tablet" (will have an undo button in future)
Test: MediaTttChipControllerTest

Change-Id: Icc8f5561fff6d862c4eedaa5b454c35aa827bcaf
parent 77243f98
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
<!--
  ~ 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.
  -->

<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
    <solid android:color="?androidprv:attr/colorSurface" />
    <corners android:radius="32dp" />
</shape>
+36 −0
Original line number Diff line number Diff line
<!--
  ~ 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.
  -->
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:padding="@dimen/media_ttt_chip_outer_padding"
    android:background="@drawable/media_ttt_chip_background"
    android:layout_marginTop="50dp"
    android:clipToPadding="false"
    android:gravity="center_vertical"
    >

    <TextView
        android:id="@+id/text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="@dimen/media_ttt_text_size"
        android:textColor="?android:attr/textColorPrimary"
        />

</LinearLayout>
+4 −0
Original line number Diff line number Diff line
@@ -976,6 +976,10 @@
    <dimen name="qs_aa_media_rec_album_margin_vert">4dp</dimen>
    <dimen name="qq_aa_media_rec_header_text_size">16sp</dimen>

    <!-- Media tap-to-transfer chip -->
    <dimen name="media_ttt_chip_outer_padding">16dp</dimen>
    <dimen name="media_ttt_text_size">16sp</dimen>

    <!-- Window magnification -->
    <dimen name="magnification_border_drag_size">35dp</dimen>
    <dimen name="magnification_outer_border_margin">15dp</dimen>
+8 −0
Original line number Diff line number Diff line
@@ -2173,6 +2173,14 @@
    <!-- Description for Smartspace recommendation's media item which doesn't have artist info, including information for the media's title and the source app [CHAR LIMIT=NONE]-->
    <string name="controls_media_smartspace_rec_item_no_artist_description">Play <xliff:g id="song_name" example="Daily mix">%1$s</xliff:g> from <xliff:g id="app_label" example="Spotify">%2$s</xliff:g></string>

    <!--- ****** Media tap-to-transfer ****** -->
    <!-- Text for a button to undo the media transfer. [CHAR LIMIT=20] -->
    <string name="media_transfer_undo">Undo</string>
    <!-- Text to ask the user to move their device closer to a different device (deviceName) in order to play music on the different device. [CHAR LIMIT=75] -->
    <string name="media_move_closer_to_transfer">Move closer to play on <xliff:g id="deviceName" example="My Tablet">%1$s</xliff:g></string>
    <!-- Text informing the user that their media is now playing on a different device (deviceName). [CHAR LIMIT=50] -->
    <string name="media_transfer_playing">Playing on <xliff:g id="deviceName" example="My Tablet">%1$s</xliff:g></string>

    <!-- Error message indicating that a control timed out while waiting for an update [CHAR_LIMIT=30] -->
    <string name="controls_error_timeout">Inactive, check app</string>
    <!-- Error message indicating that the control is no longer available in the application [CHAR LIMIT=30] -->
+1 −1
Original line number Diff line number Diff line
@@ -83,6 +83,6 @@ public interface MediaModule {
        if (!mediaTttFlags.isMediaTttEnabled()) {
            return Optional.empty();
        }
        return Optional.of(new MediaTttChipController(context, commandRegistry, windowManager));
        return Optional.of(new MediaTttChipController(commandRegistry, context, windowManager));
    }
}
Loading