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

Commit 7c87da15 authored by Michael Mikhail's avatar Michael Mikhail
Browse files

Update media recommendation card layout

Add new view for recommendation card that matches the new mock. And
make sure it is under a flag.

Bug: 264690645
Test: atest MediaControlPanelTest
Test: checked the view and tested whether it works.
Change-Id: I8059187fa2804e2a5d7f31815fb24cc767757e0c
parent 89c8a284
Loading
Loading
Loading
Loading
+65 −0
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2023 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
  -->
<!-- Layout for media recommendation item inside QSPanel carousel -->
<merge xmlns:android="http://schemas.android.com/apk/res/android">
    <!-- Album cover -->
    <ImageView
        android:id="@+id/media_cover"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:translationZ="0dp"
        android:scaleType="centerCrop"
        android:adjustViewBounds="true"
        android:clipToOutline="true"
        android:background="@drawable/bg_smartspace_media_item"/>

    <!-- App icon -->
    <com.android.internal.widget.CachingIconView
        android:id="@+id/media_rec_app_icon"
        android:layout_width="@dimen/qs_media_rec_icon_top_margin"
        android:layout_height="@dimen/qs_media_rec_icon_top_margin"
        android:layout_marginStart="@dimen/qs_media_info_spacing"
        android:layout_marginTop="@dimen/qs_media_info_spacing"/>

    <!-- Artist name -->
    <TextView
        android:id="@+id/media_title"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/qs_media_info_spacing"
        android:layout_marginEnd="@dimen/qs_media_info_spacing"
        android:layout_marginBottom="@dimen/qs_media_rec_album_title_bottom_margin"
        android:fontFamily="@*android:string/config_headlineFontFamilyMedium"
        android:singleLine="true"
        android:textSize="12sp"
        android:gravity="top"
        android:layout_gravity="bottom"/>

    <!-- Album name -->
    <TextView
        android:id="@+id/media_subtitle"
        android:layout_width="match_parent"
        android:layout_height="@dimen/qs_media_rec_album_subtitle_height"
        android:layout_marginEnd="@dimen/qs_media_info_spacing"
        android:layout_marginStart="@dimen/qs_media_info_spacing"
        android:layout_marginBottom="@dimen/qs_media_info_spacing"
        android:fontFamily="@*android:string/config_headlineFontFamily"
        android:singleLine="true"
        android:textSize="11sp"
        android:gravity="center_vertical"
        android:layout_gravity="bottom"/>
</merge>
 No newline at end of file
+75 −0
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2023 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
  -->

<!-- Layout for media recommendations inside QSPanel carousel -->
<com.android.systemui.util.animation.TransitionLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/media_recommendations_updated"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:clipChildren="false"
    android:clipToPadding="false"
    android:forceHasOverlappingRendering="false"
    android:background="@drawable/qs_media_background"
    android:theme="@style/MediaPlayer">

    <!-- This view just ensures the full media player is a certain height. -->
    <View
        android:id="@+id/sizing_view"
        android:layout_width="match_parent"
        android:layout_height="@dimen/qs_media_session_height_expanded" />

    <TextView
        android:id="@+id/media_rec_title"
        style="@style/MediaPlayer.Recommendation.Header"
        android:text="@string/controls_media_smartspace_rec_header"/>

    <FrameLayout
        android:id="@+id/media_cover1_container"
        style="@style/MediaPlayer.Recommendation.AlbumContainer.Updated"
        >

        <include
            layout="@layout/media_recommendation_view"/>

    </FrameLayout>


    <FrameLayout
        android:id="@+id/media_cover2_container"
        style="@style/MediaPlayer.Recommendation.AlbumContainer.Updated"
        >

        <include
            layout="@layout/media_recommendation_view"/>

    </FrameLayout>

    <FrameLayout
        android:id="@+id/media_cover3_container"
        style="@style/MediaPlayer.Recommendation.AlbumContainer.Updated"
        >

        <include
            layout="@layout/media_recommendation_view"/>

    </FrameLayout>

    <include
        layout="@layout/media_long_press_menu" />

</com.android.systemui.util.animation.TransitionLayout>
+5 −0
Original line number Original line Diff line number Diff line
@@ -1068,8 +1068,13 @@
    <!-- Size of Smartspace media recommendations cards in the QSPanel carousel -->
    <!-- Size of Smartspace media recommendations cards in the QSPanel carousel -->
    <dimen name="qs_media_rec_icon_top_margin">16dp</dimen>
    <dimen name="qs_media_rec_icon_top_margin">16dp</dimen>
    <dimen name="qs_media_rec_album_size">88dp</dimen>
    <dimen name="qs_media_rec_album_size">88dp</dimen>
    <dimen name="qs_media_rec_album_width">110dp</dimen>
    <dimen name="qs_media_rec_album_height_expanded">108dp</dimen>
    <dimen name="qs_media_rec_album_height_collapsed">77dp</dimen>
    <dimen name="qs_media_rec_album_side_margin">16dp</dimen>
    <dimen name="qs_media_rec_album_side_margin">16dp</dimen>
    <dimen name="qs_media_rec_album_bottom_margin">8dp</dimen>
    <dimen name="qs_media_rec_album_bottom_margin">8dp</dimen>
    <dimen name="qs_media_rec_album_title_bottom_margin">22dp</dimen>
    <dimen name="qs_media_rec_album_subtitle_height">12dp</dimen>


    <!-- Media tap-to-transfer chip for sender device -->
    <!-- Media tap-to-transfer chip for sender device -->
    <dimen name="media_ttt_chip_outer_padding">16dp</dimen>
    <dimen name="media_ttt_chip_outer_padding">16dp</dimen>
+2 −0
Original line number Original line Diff line number Diff line
@@ -2360,6 +2360,8 @@
    <string name="controls_media_smartspace_rec_item_description">Play <xliff:g id="song_name" example="Daily mix">%1$s</xliff:g> by <xliff:g id="artist_name" example="Various artists">%2$s</xliff:g> from <xliff:g id="app_label" example="Spotify">%3$s</xliff:g></string>
    <string name="controls_media_smartspace_rec_item_description">Play <xliff:g id="song_name" example="Daily mix">%1$s</xliff:g> by <xliff:g id="artist_name" example="Various artists">%2$s</xliff:g> from <xliff:g id="app_label" example="Spotify">%3$s</xliff:g></string>
    <!-- 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]-->
    <!-- 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>
    <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>
    <!-- Header title for Smartspace recommendation card within media controls. [CHAR_LIMIT=30] -->
    <string name="controls_media_smartspace_rec_header">For You</string>


    <!--- ****** Media tap-to-transfer ****** -->
    <!--- ****** Media tap-to-transfer ****** -->
    <!-- Text for a button to undo the media transfer. [CHAR LIMIT=20] -->
    <!-- Text for a button to undo the media transfer. [CHAR LIMIT=20] -->
+17 −0
Original line number Original line Diff line number Diff line
@@ -678,6 +678,17 @@


    <style name="MediaPlayer.Recommendation"/>
    <style name="MediaPlayer.Recommendation"/>


    <style name="MediaPlayer.Recommendation.Header">
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:layout_marginTop">@dimen/qs_media_padding</item>
        <item name="android:layout_marginStart">@dimen/qs_media_padding</item>
        <item name="android:fontFamily">=@*android:string/config_headlineFontFamilyMedium</item>
        <item name="android:singleLine">true</item>
        <item name="android:textSize">14sp</item>
        <item name="android:textColor">?android:attr/textColorPrimary</item>
    </style>

    <style name="MediaPlayer.Recommendation.AlbumContainer">
    <style name="MediaPlayer.Recommendation.AlbumContainer">
        <item name="android:layout_width">@dimen/qs_media_rec_album_size</item>
        <item name="android:layout_width">@dimen/qs_media_rec_album_size</item>
        <item name="android:layout_height">@dimen/qs_media_rec_album_size</item>
        <item name="android:layout_height">@dimen/qs_media_rec_album_size</item>
@@ -686,6 +697,12 @@
        <item name="android:layout_marginBottom">@dimen/qs_media_rec_album_bottom_margin</item>
        <item name="android:layout_marginBottom">@dimen/qs_media_rec_album_bottom_margin</item>
    </style>
    </style>


    <style name="MediaPlayer.Recommendation.AlbumContainer.Updated">
        <item name="android:layout_width">@dimen/qs_media_rec_album_width</item>
        <item name="android:background">@drawable/qs_media_light_source</item>
        <item name="android:layout_marginTop">@dimen/qs_media_info_spacing</item>
    </style>

    <style name="MediaPlayer.Recommendation.Album">
    <style name="MediaPlayer.Recommendation.Album">
        <item name="android:backgroundTint">@color/media_player_album_bg</item>
        <item name="android:backgroundTint">@color/media_player_album_bg</item>
    </style>
    </style>
Loading