Merge "Make the recommendation card's title to be one line, and the blur overlay for the cutting off text." into sc-qpr1-dev

This commit is contained in:
Cecilia Hong
2021-09-23 20:02:44 +00:00
committed by Android (Google) Code Review
6 changed files with 59 additions and 42 deletions

View File

@@ -0,0 +1,26 @@
<?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.
-->
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="24dp"/>
<gradient
android:angle="0"
android:startColor="#00000000"
android:endColor="#ff000000"
android:type="linear" />
</shape>

View File

@@ -48,20 +48,41 @@
android:id="@+id/recommendation_card_icon"
android:layout_width="@dimen/qs_media_icon_size"
android:layout_height="@dimen/qs_media_icon_size"
android:layout_marginTop="@dimen/qs_media_padding"
android:src="@drawable/ic_headset"
style="@style/MediaPlayer.AppIcon"/>
style="@style/MediaPlayer.AppIcon"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/media_vertical_start_guideline"
app:layout_constraintHorizontal_bias="0"/>
<TextView
android:id="@+id/recommendation_card_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:maxLines="2"
android:maxLines="1"
android:text="@string/controls_media_smartspace_rec_title"
android:fontFamily="google-sans-medium"
android:textDirection="locale"
android:textSize="@dimen/qq_aa_media_rec_header_text_size"
android:breakStrategy="balanced"
android:hyphenationFrequency="none"/>
android:hyphenationFrequency="none"
app:layout_constraintTop_toBottomOf="@id/recommendation_card_icon"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/media_vertical_start_guideline"
app:layout_constraintHorizontal_bias="0"/>
<View
android:id="@+id/recommendation_gradient_view"
android:layout_width="@dimen/qs_aa_media_gradient_bg_width"
android:layout_height="0dp"
android:clipToPadding="false"
android:clipChildren="false"
android:background="@drawable/qs_media_recommendation_bg_gradient"
app:layout_constraintTop_toTopOf="@id/recommendation_card_text"
app:layout_constraintBottom_toBottomOf="@id/recommendation_card_text"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/media_vertical_start_guideline"
app:layout_constraintHorizontal_bias="1"/>
<FrameLayout
android:id="@+id/media_cover1_container"

View File

@@ -1304,6 +1304,7 @@
<!-- Size of Smartspace media recommendations cards in the QSPanel carousel -->
<dimen name="qs_aa_media_rec_album_size_collapsed">72dp</dimen>
<dimen name="qs_aa_media_rec_album_size_expanded">76dp</dimen>
<dimen name="qs_aa_media_gradient_bg_width">32dp</dimen>
<dimen name="qs_aa_media_rec_album_margin">8dp</dimen>
<dimen name="qs_aa_media_rec_album_margin_vert">4dp</dimen>
<dimen name="qq_aa_media_rec_header_text_size">16sp</dimen>

View File

@@ -18,25 +18,6 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<Constraint
android:id="@+id/recommendation_card_icon"
android:layout_width="@dimen/qs_media_icon_size"
android:layout_height="@dimen/qs_media_icon_size"
android:layout_marginTop="@dimen/qs_media_padding"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/media_vertical_start_guideline"
app:layout_constraintHorizontal_bias="0" />
<Constraint
android:id="@+id/recommendation_card_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/recommendation_card_icon"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/media_vertical_start_guideline"
app:layout_constraintHorizontal_bias="0" />
<Constraint
android:id="@+id/media_cover1_container"
android:layout_width="0dp"

View File

@@ -18,25 +18,6 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<Constraint
android:id="@+id/recommendation_card_icon"
android:layout_width="@dimen/qs_media_icon_size"
android:layout_height="@dimen/qs_media_icon_size"
android:layout_marginTop="@dimen/qs_media_padding"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/media_vertical_start_guideline"
app:layout_constraintHorizontal_bias="0" />
<Constraint
android:id="@+id/recommendation_card_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/recommendation_card_icon"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/media_vertical_start_guideline"
app:layout_constraintHorizontal_bias="0" />
<Constraint
android:id="@+id/media_cover1_container"
android:layout_width="0dp"

View File

@@ -1,10 +1,13 @@
package com.android.systemui.media
import android.app.smartspace.SmartspaceTarget
import android.util.Log
import com.android.systemui.plugins.BcSmartspaceDataPlugin
import com.android.systemui.plugins.BcSmartspaceDataPlugin.SmartspaceTargetListener
import javax.inject.Inject
private const val TAG = "SsMediaDataProvider"
/** Provides SmartspaceTargets of media types for SystemUI media control. */
class SmartspaceMediaDataProvider @Inject constructor() : BcSmartspaceDataPlugin {
@@ -31,6 +34,10 @@ class SmartspaceMediaDataProvider @Inject constructor() : BcSmartspaceDataPlugin
}
}
if (!mediaTargets.isEmpty()) {
Log.d(TAG, "Forwarding Smartspace media updates $mediaTargets")
}
smartspaceMediaTargets = mediaTargets
smartspaceMediaTargetListeners.forEach {
it.onSmartspaceTargetsUpdated(smartspaceMediaTargets)