Remove MEDIA_RECOMMENDATION_CARD_UPDATE flag
It clears the flag and deletes all the files of the old version. Fixes:266739309 Test: atest MediaControlPanelTest Test: atest MediaViewControllerTest Test: Checked using the media tester app, the new version of media recommendations is showing. Change-Id: I2e0eeb414b39017ee3b3ccb318ff61cd52c01dda
This commit is contained in:
@@ -1,136 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2019 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 -->
|
||||
<!-- See media_recommendation_expanded.xml and media_recommendation_collapsed.xml for the
|
||||
constraints. -->
|
||||
<com.android.systemui.util.animation.TransitionLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/media_recommendations"
|
||||
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" />
|
||||
|
||||
<com.android.internal.widget.CachingIconView
|
||||
android:id="@+id/recommendation_card_icon"
|
||||
android:layout_width="@dimen/qs_media_app_icon_size"
|
||||
android:layout_height="@dimen/qs_media_app_icon_size"
|
||||
android:minWidth="@dimen/qs_media_app_icon_size"
|
||||
android:minHeight="@dimen/qs_media_app_icon_size"
|
||||
android:layout_marginStart="@dimen/qs_media_padding"
|
||||
android:layout_marginTop="@dimen/qs_media_rec_icon_top_margin"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/media_cover1_container"
|
||||
style="@style/MediaPlayer.Recommendation.AlbumContainer"
|
||||
>
|
||||
<ImageView
|
||||
android:id="@+id/media_cover1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:minWidth="@dimen/qs_media_rec_album_size"
|
||||
android:minHeight="@dimen/qs_media_rec_album_size"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@drawable/bg_smartspace_media_item"
|
||||
style="@style/MediaPlayer.Recommendation.Album"
|
||||
android:clipToOutline="true"
|
||||
android:scaleType="centerCrop"/>
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/media_title1"
|
||||
style="@style/MediaPlayer.Recommendation.Text.Title"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/media_subtitle1"
|
||||
style="@style/MediaPlayer.Recommendation.Text.Subtitle"
|
||||
/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/media_cover2_container"
|
||||
style="@style/MediaPlayer.Recommendation.AlbumContainer"
|
||||
>
|
||||
<ImageView
|
||||
android:id="@+id/media_cover2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:minWidth="@dimen/qs_media_rec_album_size"
|
||||
android:minHeight="@dimen/qs_media_rec_album_size"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@drawable/bg_smartspace_media_item"
|
||||
style="@style/MediaPlayer.Recommendation.Album"
|
||||
android:clipToOutline="true"
|
||||
android:scaleType="centerCrop"/>
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/media_title2"
|
||||
style="@style/MediaPlayer.Recommendation.Text.Title"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/media_subtitle2"
|
||||
style="@style/MediaPlayer.Recommendation.Text.Subtitle"
|
||||
/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/media_cover3_container"
|
||||
style="@style/MediaPlayer.Recommendation.AlbumContainer"
|
||||
>
|
||||
<ImageView
|
||||
android:id="@+id/media_cover3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:minWidth="@dimen/qs_media_rec_album_size"
|
||||
android:minHeight="@dimen/qs_media_rec_album_size"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="@drawable/bg_smartspace_media_item"
|
||||
style="@style/MediaPlayer.Recommendation.Album"
|
||||
android:clipToOutline="true"
|
||||
android:scaleType="centerCrop"/>
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/media_title3"
|
||||
style="@style/MediaPlayer.Recommendation.Text.Title"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/media_subtitle3"
|
||||
style="@style/MediaPlayer.Recommendation.Text.Subtitle"
|
||||
/>
|
||||
|
||||
<include
|
||||
layout="@layout/media_long_press_menu" />
|
||||
|
||||
</com.android.systemui.util.animation.TransitionLayout>
|
||||
@@ -1,101 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2020 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
|
||||
-->
|
||||
<ConstraintSet
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto" >
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/sizing_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/qs_media_session_height_collapsed"
|
||||
/>
|
||||
|
||||
<!-- Only the constraintBottom and marginBottom are different. The rest of the constraints are
|
||||
the same as the constraints in media_recommendations_expanded.xml. But, due to how
|
||||
ConstraintSets work, all the constraints need to be in the same place. So, the shared
|
||||
constraints can't be put in the shared layout file media_smartspace_recommendations.xml and
|
||||
the constraints are instead duplicated between here and media_recommendations_expanded.xml.
|
||||
Ditto for the other cover containers. -->
|
||||
<Constraint
|
||||
android:id="@+id/media_cover1_container"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginBottom="@dimen/qs_media_padding"
|
||||
style="@style/MediaPlayer.Recommendation.AlbumContainer"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/media_cover2_container"
|
||||
android:layout_marginEnd="@dimen/qs_media_rec_album_side_margin"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintVertical_bias="0.5"
|
||||
/>
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/media_title1"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/media_subtitle1"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/media_cover2_container"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginBottom="@dimen/qs_media_padding"
|
||||
style="@style/MediaPlayer.Recommendation.AlbumContainer"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/media_cover1_container"
|
||||
app:layout_constraintEnd_toStartOf="@id/media_cover3_container"
|
||||
android:layout_marginEnd="@dimen/qs_media_rec_album_side_margin"
|
||||
app:layout_constraintVertical_bias="0.5"
|
||||
/>
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/media_title2"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/media_subtitle2"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/media_cover3_container"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginBottom="@dimen/qs_media_padding"
|
||||
style="@style/MediaPlayer.Recommendation.AlbumContainer"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/media_cover2_container"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginEnd="@dimen/qs_media_padding"
|
||||
app:layout_constraintVertical_bias="0.5"
|
||||
/>
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/media_title3"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/media_subtitle3"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
</ConstraintSet>
|
||||
@@ -1,123 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2020 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
|
||||
-->
|
||||
<ConstraintSet
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
>
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/sizing_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/qs_media_session_height_expanded"
|
||||
/>
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/media_cover1_container"
|
||||
style="@style/MediaPlayer.Recommendation.AlbumContainer"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@+id/media_title1"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/media_cover2_container"
|
||||
android:layout_marginEnd="@dimen/qs_media_rec_album_side_margin"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintVertical_bias="0.4"
|
||||
/>
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/media_title1"
|
||||
style="@style/MediaPlayer.Recommendation.Text.Title"
|
||||
app:layout_constraintStart_toStartOf="@+id/media_cover1_container"
|
||||
app:layout_constraintEnd_toEndOf="@+id/media_cover1_container"
|
||||
app:layout_constraintTop_toBottomOf="@+id/media_cover1_container"
|
||||
app:layout_constraintBottom_toTopOf="@+id/media_subtitle1"
|
||||
/>
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/media_subtitle1"
|
||||
style="@style/MediaPlayer.Recommendation.Text.Subtitle"
|
||||
app:layout_constraintStart_toStartOf="@+id/media_cover1_container"
|
||||
app:layout_constraintEnd_toEndOf="@+id/media_cover1_container"
|
||||
app:layout_constraintTop_toBottomOf="@+id/media_title1"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginBottom="@dimen/qs_media_padding"
|
||||
/>
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/media_cover2_container"
|
||||
style="@style/MediaPlayer.Recommendation.AlbumContainer"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/media_title2"
|
||||
app:layout_constraintStart_toEndOf="@id/media_cover1_container"
|
||||
app:layout_constraintEnd_toStartOf="@id/media_cover3_container"
|
||||
android:layout_marginEnd="@dimen/qs_media_rec_album_side_margin"
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
app:layout_constraintVertical_bias="0.4"
|
||||
/>
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/media_title2"
|
||||
style="@style/MediaPlayer.Recommendation.Text.Title"
|
||||
app:layout_constraintStart_toStartOf="@+id/media_cover2_container"
|
||||
app:layout_constraintEnd_toEndOf="@+id/media_cover2_container"
|
||||
app:layout_constraintTop_toBottomOf="@+id/media_cover2_container"
|
||||
app:layout_constraintBottom_toTopOf="@+id/media_subtitle2"
|
||||
/>
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/media_subtitle2"
|
||||
style="@style/MediaPlayer.Recommendation.Text.Subtitle"
|
||||
app:layout_constraintStart_toStartOf="@+id/media_cover2_container"
|
||||
app:layout_constraintEnd_toEndOf="@+id/media_cover2_container"
|
||||
app:layout_constraintTop_toBottomOf="@+id/media_title2"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginBottom="@dimen/qs_media_padding"
|
||||
/>
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/media_cover3_container"
|
||||
style="@style/MediaPlayer.Recommendation.AlbumContainer"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/media_title3"
|
||||
app:layout_constraintStart_toEndOf="@id/media_cover2_container"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginEnd="@dimen/qs_media_padding"
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
app:layout_constraintVertical_bias="0.4"
|
||||
/>
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/media_title3"
|
||||
style="@style/MediaPlayer.Recommendation.Text.Title"
|
||||
app:layout_constraintStart_toStartOf="@+id/media_cover3_container"
|
||||
app:layout_constraintEnd_toEndOf="@+id/media_cover3_container"
|
||||
app:layout_constraintTop_toBottomOf="@+id/media_cover3_container"
|
||||
app:layout_constraintBottom_toTopOf="@+id/media_subtitle3"
|
||||
/>
|
||||
|
||||
<Constraint
|
||||
android:id="@+id/media_subtitle3"
|
||||
style="@style/MediaPlayer.Recommendation.Text.Subtitle"
|
||||
app:layout_constraintStart_toStartOf="@+id/media_cover3_container"
|
||||
app:layout_constraintEnd_toEndOf="@+id/media_cover3_container"
|
||||
app:layout_constraintTop_toBottomOf="@+id/media_title3"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginBottom="@dimen/qs_media_padding"
|
||||
/>
|
||||
|
||||
</ConstraintSet>
|
||||
@@ -443,10 +443,6 @@ object Flags {
|
||||
// TODO(b/266157412): Tracking Bug
|
||||
val MEDIA_RETAIN_SESSIONS = unreleasedFlag(913, "media_retain_sessions")
|
||||
|
||||
// TODO(b/266739309): Tracking Bug
|
||||
@JvmField
|
||||
val MEDIA_RECOMMENDATION_CARD_UPDATE = releasedFlag(914, "media_recommendation_card_update")
|
||||
|
||||
// TODO(b/267007629): Tracking Bug
|
||||
val MEDIA_RESUME_PROGRESS = releasedFlag(915, "media_resume_progress")
|
||||
|
||||
|
||||
@@ -31,15 +31,12 @@ import com.android.systemui.util.animation.TransitionLayout
|
||||
private const val TAG = "RecommendationViewHolder"
|
||||
|
||||
/** ViewHolder for a Smartspace media recommendation. */
|
||||
class RecommendationViewHolder private constructor(itemView: View, updatedView: Boolean) {
|
||||
class RecommendationViewHolder private constructor(itemView: View) {
|
||||
|
||||
val recommendations = itemView as TransitionLayout
|
||||
|
||||
// Recommendation screen
|
||||
lateinit var cardIcon: ImageView
|
||||
lateinit var mediaAppIcons: List<CachingIconView>
|
||||
lateinit var mediaProgressBars: List<SeekBar>
|
||||
lateinit var cardTitle: TextView
|
||||
val cardTitle: TextView = itemView.requireViewById(R.id.media_rec_title)
|
||||
|
||||
val mediaCoverContainers =
|
||||
listOf<ViewGroup>(
|
||||
@@ -47,53 +44,25 @@ class RecommendationViewHolder private constructor(itemView: View, updatedView:
|
||||
itemView.requireViewById(R.id.media_cover2_container),
|
||||
itemView.requireViewById(R.id.media_cover3_container)
|
||||
)
|
||||
val mediaAppIcons: List<CachingIconView> =
|
||||
mediaCoverContainers.map { it.requireViewById(R.id.media_rec_app_icon) }
|
||||
val mediaTitles: List<TextView> =
|
||||
if (updatedView) {
|
||||
mediaCoverContainers.map { it.requireViewById(R.id.media_title) }
|
||||
} else {
|
||||
listOf(
|
||||
itemView.requireViewById(R.id.media_title1),
|
||||
itemView.requireViewById(R.id.media_title2),
|
||||
itemView.requireViewById(R.id.media_title3)
|
||||
)
|
||||
}
|
||||
mediaCoverContainers.map { it.requireViewById(R.id.media_title) }
|
||||
val mediaSubtitles: List<TextView> =
|
||||
if (updatedView) {
|
||||
mediaCoverContainers.map { it.requireViewById(R.id.media_subtitle) }
|
||||
} else {
|
||||
listOf(
|
||||
itemView.requireViewById(R.id.media_subtitle1),
|
||||
itemView.requireViewById(R.id.media_subtitle2),
|
||||
itemView.requireViewById(R.id.media_subtitle3)
|
||||
)
|
||||
mediaCoverContainers.map { it.requireViewById(R.id.media_subtitle) }
|
||||
val mediaProgressBars: List<SeekBar> =
|
||||
mediaCoverContainers.map {
|
||||
it.requireViewById<SeekBar?>(R.id.media_progress_bar).apply {
|
||||
// Media playback is in the direction of tape, not time, so it stays LTR
|
||||
layoutDirection = View.LAYOUT_DIRECTION_LTR
|
||||
}
|
||||
}
|
||||
|
||||
val mediaCoverItems: List<ImageView> =
|
||||
if (updatedView) {
|
||||
mediaCoverContainers.map { it.requireViewById(R.id.media_cover) }
|
||||
} else {
|
||||
listOf(
|
||||
itemView.requireViewById(R.id.media_cover1),
|
||||
itemView.requireViewById(R.id.media_cover2),
|
||||
itemView.requireViewById(R.id.media_cover3)
|
||||
)
|
||||
}
|
||||
mediaCoverContainers.map { it.requireViewById(R.id.media_cover) }
|
||||
val gutsViewHolder = GutsViewHolder(itemView)
|
||||
|
||||
init {
|
||||
if (updatedView) {
|
||||
mediaAppIcons = mediaCoverContainers.map { it.requireViewById(R.id.media_rec_app_icon) }
|
||||
cardTitle = itemView.requireViewById(R.id.media_rec_title)
|
||||
mediaProgressBars =
|
||||
mediaCoverContainers.map {
|
||||
it.requireViewById<SeekBar?>(R.id.media_progress_bar).apply {
|
||||
// Media playback is in the direction of tape, not time, so it stays LTR
|
||||
layoutDirection = View.LAYOUT_DIRECTION_LTR
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cardIcon = itemView.requireViewById<ImageView>(R.id.recommendation_card_icon)
|
||||
}
|
||||
(recommendations.background as IlluminationDrawable).let { background ->
|
||||
mediaCoverContainers.forEach { background.registerLightSource(it) }
|
||||
background.registerLightSource(gutsViewHolder.cancel)
|
||||
@@ -114,63 +83,31 @@ class RecommendationViewHolder private constructor(itemView: View, updatedView:
|
||||
* @param parent Parent of inflated view.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun create(
|
||||
inflater: LayoutInflater,
|
||||
parent: ViewGroup,
|
||||
updatedView: Boolean,
|
||||
): RecommendationViewHolder {
|
||||
fun create(inflater: LayoutInflater, parent: ViewGroup): RecommendationViewHolder {
|
||||
val itemView =
|
||||
if (updatedView) {
|
||||
inflater.inflate(
|
||||
R.layout.media_recommendations,
|
||||
parent,
|
||||
false /* attachToRoot */
|
||||
)
|
||||
} else {
|
||||
inflater.inflate(
|
||||
R.layout.media_smartspace_recommendations,
|
||||
parent,
|
||||
false /* attachToRoot */
|
||||
)
|
||||
}
|
||||
inflater.inflate(R.layout.media_recommendations, parent, false /* attachToRoot */)
|
||||
// Because this media view (a TransitionLayout) is used to measure and layout the views
|
||||
// in various states before being attached to its parent, we can't depend on the default
|
||||
// LAYOUT_DIRECTION_INHERIT to correctly resolve the ltr direction.
|
||||
itemView.layoutDirection = View.LAYOUT_DIRECTION_LOCALE
|
||||
return RecommendationViewHolder(itemView, updatedView)
|
||||
return RecommendationViewHolder(itemView)
|
||||
}
|
||||
|
||||
// Res Ids for the control components on the recommendation view.
|
||||
val controlsIds =
|
||||
setOf(
|
||||
R.id.recommendation_card_icon,
|
||||
R.id.media_rec_title,
|
||||
R.id.media_cover1,
|
||||
R.id.media_cover2,
|
||||
R.id.media_cover3,
|
||||
R.id.media_cover,
|
||||
R.id.media_cover1_container,
|
||||
R.id.media_cover2_container,
|
||||
R.id.media_cover3_container,
|
||||
R.id.media_title1,
|
||||
R.id.media_title2,
|
||||
R.id.media_title3,
|
||||
R.id.media_title,
|
||||
R.id.media_subtitle1,
|
||||
R.id.media_subtitle2,
|
||||
R.id.media_subtitle3,
|
||||
R.id.media_subtitle,
|
||||
)
|
||||
|
||||
val mediaTitlesAndSubtitlesIds =
|
||||
setOf(
|
||||
R.id.media_title1,
|
||||
R.id.media_title2,
|
||||
R.id.media_title3,
|
||||
R.id.media_title,
|
||||
R.id.media_subtitle1,
|
||||
R.id.media_subtitle2,
|
||||
R.id.media_subtitle3,
|
||||
R.id.media_subtitle,
|
||||
)
|
||||
|
||||
|
||||
@@ -744,11 +744,7 @@ constructor(
|
||||
|
||||
val newRecs = mediaControlPanelFactory.get()
|
||||
newRecs.attachRecommendation(
|
||||
RecommendationViewHolder.create(
|
||||
LayoutInflater.from(context),
|
||||
mediaContent,
|
||||
mediaFlags.isRecommendationCardUpdateEnabled()
|
||||
)
|
||||
RecommendationViewHolder.create(LayoutInflater.from(context), mediaContent)
|
||||
)
|
||||
newRecs.mediaViewController.sizeChangedListener = this::updateCarouselDimensions
|
||||
val lp =
|
||||
|
||||
@@ -784,14 +784,7 @@ public class MediaControlPanel {
|
||||
contentDescription =
|
||||
mRecommendationViewHolder.getGutsViewHolder().getGutsText().getText();
|
||||
} else if (data != null) {
|
||||
if (mFeatureFlags.isEnabled(Flags.MEDIA_RECOMMENDATION_CARD_UPDATE)) {
|
||||
contentDescription = mContext.getString(
|
||||
R.string.controls_media_smartspace_rec_header);
|
||||
} else {
|
||||
contentDescription = mContext.getString(
|
||||
R.string.controls_media_smartspace_rec_description,
|
||||
data.getAppName(mContext));
|
||||
}
|
||||
contentDescription = mContext.getString(R.string.controls_media_smartspace_rec_header);
|
||||
} else {
|
||||
contentDescription = null;
|
||||
}
|
||||
@@ -1377,10 +1370,6 @@ public class MediaControlPanel {
|
||||
PackageManager packageManager = mContext.getPackageManager();
|
||||
// Set up media source app's logo.
|
||||
Drawable icon = packageManager.getApplicationIcon(applicationInfo);
|
||||
if (!mFeatureFlags.isEnabled(Flags.MEDIA_RECOMMENDATION_CARD_UPDATE)) {
|
||||
ImageView headerLogoImageView = mRecommendationViewHolder.getCardIcon();
|
||||
headerLogoImageView.setImageDrawable(icon);
|
||||
}
|
||||
fetchAndUpdateRecommendationColors(icon);
|
||||
|
||||
// Set up media rec card's tap action if applicable.
|
||||
@@ -1401,16 +1390,7 @@ public class MediaControlPanel {
|
||||
|
||||
// Set up media item cover.
|
||||
ImageView mediaCoverImageView = mediaCoverItems.get(itemIndex);
|
||||
if (mFeatureFlags.isEnabled(Flags.MEDIA_RECOMMENDATION_CARD_UPDATE)) {
|
||||
bindRecommendationArtwork(
|
||||
recommendation,
|
||||
data.getPackageName(),
|
||||
itemIndex
|
||||
);
|
||||
} else {
|
||||
mediaCoverImageView.post(
|
||||
() -> mediaCoverImageView.setImageIcon(recommendation.getIcon()));
|
||||
}
|
||||
bindRecommendationArtwork(recommendation, data.getPackageName(), itemIndex);
|
||||
|
||||
// Set up the media item's click listener if applicable.
|
||||
ViewGroup mediaCoverContainer = mediaCoverContainers.get(itemIndex);
|
||||
@@ -1455,21 +1435,18 @@ public class MediaControlPanel {
|
||||
subtitleView.setText(subtitle);
|
||||
|
||||
// Set up progress bar
|
||||
if (mFeatureFlags.isEnabled(Flags.MEDIA_RECOMMENDATION_CARD_UPDATE)) {
|
||||
SeekBar mediaProgressBar =
|
||||
mRecommendationViewHolder.getMediaProgressBars().get(itemIndex);
|
||||
TextView mediaSubtitle =
|
||||
mRecommendationViewHolder.getMediaSubtitles().get(itemIndex);
|
||||
// show progress bar if the recommended album is played.
|
||||
Double progress = MediaDataUtils.getDescriptionProgress(recommendation.getExtras());
|
||||
if (progress == null || progress <= 0.0) {
|
||||
mediaProgressBar.setVisibility(View.GONE);
|
||||
mediaSubtitle.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mediaProgressBar.setProgress((int) (progress * 100));
|
||||
mediaProgressBar.setVisibility(View.VISIBLE);
|
||||
mediaSubtitle.setVisibility(View.GONE);
|
||||
}
|
||||
SeekBar mediaProgressBar =
|
||||
mRecommendationViewHolder.getMediaProgressBars().get(itemIndex);
|
||||
TextView mediaSubtitle = mRecommendationViewHolder.getMediaSubtitles().get(itemIndex);
|
||||
// show progress bar if the recommended album is played.
|
||||
Double progress = MediaDataUtils.getDescriptionProgress(recommendation.getExtras());
|
||||
if (progress == null || progress <= 0.0) {
|
||||
mediaProgressBar.setVisibility(View.GONE);
|
||||
mediaSubtitle.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mediaProgressBar.setProgress((int) (progress * 100));
|
||||
mediaProgressBar.setVisibility(View.VISIBLE);
|
||||
mediaSubtitle.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
mSmartspaceMediaItemsCount = NUM_REQUIRED_RECOMMENDATIONS;
|
||||
@@ -1588,9 +1565,7 @@ public class MediaControlPanel {
|
||||
int textPrimaryColor = MediaColorSchemesKt.textPrimaryFromScheme(colorScheme);
|
||||
int textSecondaryColor = MediaColorSchemesKt.textSecondaryFromScheme(colorScheme);
|
||||
|
||||
if (mFeatureFlags.isEnabled(Flags.MEDIA_RECOMMENDATION_CARD_UPDATE)) {
|
||||
mRecommendationViewHolder.getCardTitle().setTextColor(textPrimaryColor);
|
||||
}
|
||||
mRecommendationViewHolder.getCardTitle().setTextColor(textPrimaryColor);
|
||||
|
||||
mRecommendationViewHolder.getRecommendations()
|
||||
.setBackgroundTintList(ColorStateList.valueOf(backgroundColor));
|
||||
@@ -1598,12 +1573,9 @@ public class MediaControlPanel {
|
||||
(title) -> title.setTextColor(textPrimaryColor));
|
||||
mRecommendationViewHolder.getMediaSubtitles().forEach(
|
||||
(subtitle) -> subtitle.setTextColor(textSecondaryColor));
|
||||
if (mFeatureFlags.isEnabled(Flags.MEDIA_RECOMMENDATION_CARD_UPDATE)) {
|
||||
mRecommendationViewHolder.getMediaProgressBars().forEach(
|
||||
(progressBar) -> progressBar.setProgressTintList(
|
||||
ColorStateList.valueOf(textPrimaryColor))
|
||||
);
|
||||
}
|
||||
mRecommendationViewHolder.getMediaProgressBars().forEach(
|
||||
(progressBar) -> progressBar.setProgressTintList(
|
||||
ColorStateList.valueOf(textPrimaryColor)));
|
||||
|
||||
mRecommendationViewHolder.getGutsViewHolder().setColors(colorScheme);
|
||||
}
|
||||
|
||||
@@ -655,13 +655,8 @@ constructor(
|
||||
expandedLayout.load(context, R.xml.media_session_expanded)
|
||||
}
|
||||
TYPE.RECOMMENDATION -> {
|
||||
if (mediaFlags.isRecommendationCardUpdateEnabled()) {
|
||||
collapsedLayout.load(context, R.xml.media_recommendations_view_collapsed)
|
||||
expandedLayout.load(context, R.xml.media_recommendations_view_expanded)
|
||||
} else {
|
||||
collapsedLayout.load(context, R.xml.media_recommendation_collapsed)
|
||||
expandedLayout.load(context, R.xml.media_recommendation_expanded)
|
||||
}
|
||||
collapsedLayout.load(context, R.xml.media_recommendations_collapsed)
|
||||
expandedLayout.load(context, R.xml.media_recommendations_expanded)
|
||||
}
|
||||
}
|
||||
refreshState()
|
||||
|
||||
@@ -49,10 +49,6 @@ class MediaFlags @Inject constructor(private val featureFlags: FeatureFlags) {
|
||||
*/
|
||||
fun isRetainingPlayersEnabled() = featureFlags.isEnabled(Flags.MEDIA_RETAIN_SESSIONS)
|
||||
|
||||
/** Check whether we show the updated recommendation card. */
|
||||
fun isRecommendationCardUpdateEnabled() =
|
||||
featureFlags.isEnabled(Flags.MEDIA_RECOMMENDATION_CARD_UPDATE)
|
||||
|
||||
/** Check whether to get progress information for resume players */
|
||||
fun isResumeProgressEnabled() = featureFlags.isEnabled(Flags.MEDIA_RESUME_PROGRESS)
|
||||
|
||||
|
||||
@@ -216,9 +216,6 @@ public class MediaControlPanelTest : SysuiTestCase() {
|
||||
@Mock private lateinit var recCardTitle: TextView
|
||||
@Mock private lateinit var coverItem: ImageView
|
||||
@Mock private lateinit var matrix: Matrix
|
||||
private lateinit var coverItem1: ImageView
|
||||
private lateinit var coverItem2: ImageView
|
||||
private lateinit var coverItem3: ImageView
|
||||
private lateinit var recTitle1: TextView
|
||||
private lateinit var recTitle2: TextView
|
||||
private lateinit var recTitle3: TextView
|
||||
@@ -233,7 +230,6 @@ public class MediaControlPanelTest : SysuiTestCase() {
|
||||
FakeFeatureFlags().apply {
|
||||
this.set(Flags.UMO_SURFACE_RIPPLE, false)
|
||||
this.set(Flags.UMO_TURBULENCE_NOISE, false)
|
||||
this.set(Flags.MEDIA_RECOMMENDATION_CARD_UPDATE, false)
|
||||
}
|
||||
@Mock private lateinit var globalSettings: GlobalSettings
|
||||
|
||||
@@ -467,21 +463,25 @@ public class MediaControlPanelTest : SysuiTestCase() {
|
||||
recSubtitle3 = TextView(context)
|
||||
|
||||
whenever(recommendationViewHolder.recommendations).thenReturn(view)
|
||||
whenever(recommendationViewHolder.cardIcon).thenReturn(appIcon)
|
||||
|
||||
// Add a recommendation item
|
||||
coverItem1 = ImageView(context).also { it.setId(R.id.media_cover1) }
|
||||
coverItem2 = ImageView(context).also { it.setId(R.id.media_cover2) }
|
||||
coverItem3 = ImageView(context).also { it.setId(R.id.media_cover3) }
|
||||
|
||||
whenever(recommendationViewHolder.mediaAppIcons)
|
||||
.thenReturn(listOf(recAppIconItem, recAppIconItem, recAppIconItem))
|
||||
whenever(recommendationViewHolder.cardTitle).thenReturn(recCardTitle)
|
||||
whenever(recommendationViewHolder.mediaCoverItems)
|
||||
.thenReturn(listOf(coverItem1, coverItem2, coverItem3))
|
||||
.thenReturn(listOf(coverItem, coverItem, coverItem))
|
||||
whenever(recommendationViewHolder.mediaCoverContainers)
|
||||
.thenReturn(listOf(coverContainer1, coverContainer2, coverContainer3))
|
||||
whenever(recommendationViewHolder.mediaTitles)
|
||||
.thenReturn(listOf(recTitle1, recTitle2, recTitle3))
|
||||
whenever(recommendationViewHolder.mediaSubtitles)
|
||||
.thenReturn(listOf(recSubtitle1, recSubtitle2, recSubtitle3))
|
||||
whenever(recommendationViewHolder.mediaProgressBars)
|
||||
.thenReturn(listOf(recProgressBar1, recProgressBar2, recProgressBar3))
|
||||
whenever(coverItem.imageMatrix).thenReturn(matrix)
|
||||
|
||||
// set ids for recommendation containers
|
||||
whenever(coverContainer1.id).thenReturn(1)
|
||||
whenever(coverContainer2.id).thenReturn(2)
|
||||
whenever(coverContainer3.id).thenReturn(3)
|
||||
|
||||
whenever(recommendationViewHolder.gutsViewHolder).thenReturn(gutsViewHolder)
|
||||
|
||||
@@ -1561,7 +1561,8 @@ public class MediaControlPanelTest : SysuiTestCase() {
|
||||
verify(viewHolder.player).contentDescription = descriptionCaptor.capture()
|
||||
val description = descriptionCaptor.value.toString()
|
||||
|
||||
assertThat(description).contains(REC_APP_NAME)
|
||||
assertThat(description)
|
||||
.isEqualTo(context.getString(R.string.controls_media_smartspace_rec_header))
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -1585,7 +1586,8 @@ public class MediaControlPanelTest : SysuiTestCase() {
|
||||
verify(viewHolder.player).contentDescription = descriptionCaptor.capture()
|
||||
val description = descriptionCaptor.value.toString()
|
||||
|
||||
assertThat(description).contains(REC_APP_NAME)
|
||||
assertThat(description)
|
||||
.isEqualTo(context.getString(R.string.controls_media_smartspace_rec_header))
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -2151,7 +2153,6 @@ public class MediaControlPanelTest : SysuiTestCase() {
|
||||
|
||||
@Test
|
||||
fun bindRecommendation_setAfterExecutors() {
|
||||
setupUpdatedRecommendationViewHolder()
|
||||
val albumArt = getColorIcon(Color.RED)
|
||||
val data =
|
||||
smartspaceData.copy(
|
||||
@@ -2189,7 +2190,6 @@ public class MediaControlPanelTest : SysuiTestCase() {
|
||||
@Test
|
||||
fun bindRecommendationWithProgressBars() {
|
||||
useRealConstraintSets()
|
||||
setupUpdatedRecommendationViewHolder()
|
||||
val albumArt = getColorIcon(Color.RED)
|
||||
val bundle =
|
||||
Bundle().apply {
|
||||
@@ -2236,7 +2236,6 @@ public class MediaControlPanelTest : SysuiTestCase() {
|
||||
@Test
|
||||
fun bindRecommendation_carouselNotFitThreeRecs_OrientationPortrait() {
|
||||
useRealConstraintSets()
|
||||
setupUpdatedRecommendationViewHolder()
|
||||
val albumArt = getColorIcon(Color.RED)
|
||||
val data =
|
||||
smartspaceData.copy(
|
||||
@@ -2290,7 +2289,6 @@ public class MediaControlPanelTest : SysuiTestCase() {
|
||||
@Test
|
||||
fun bindRecommendation_carouselNotFitThreeRecs_OrientationLandscape() {
|
||||
useRealConstraintSets()
|
||||
setupUpdatedRecommendationViewHolder()
|
||||
val albumArt = getColorIcon(Color.RED)
|
||||
val data =
|
||||
smartspaceData.copy(
|
||||
@@ -2505,27 +2503,6 @@ public class MediaControlPanelTest : SysuiTestCase() {
|
||||
verify(activityStarter).postStartActivityDismissingKeyguard(eq(pendingIntent))
|
||||
}
|
||||
|
||||
private fun setupUpdatedRecommendationViewHolder() {
|
||||
fakeFeatureFlag.set(Flags.MEDIA_RECOMMENDATION_CARD_UPDATE, true)
|
||||
whenever(recommendationViewHolder.mediaAppIcons)
|
||||
.thenReturn(listOf(recAppIconItem, recAppIconItem, recAppIconItem))
|
||||
whenever(recommendationViewHolder.cardTitle).thenReturn(recCardTitle)
|
||||
whenever(recommendationViewHolder.mediaCoverContainers)
|
||||
.thenReturn(listOf(coverContainer1, coverContainer2, coverContainer3))
|
||||
whenever(recommendationViewHolder.mediaCoverItems)
|
||||
.thenReturn(listOf(coverItem, coverItem, coverItem))
|
||||
whenever(recommendationViewHolder.mediaProgressBars)
|
||||
.thenReturn(listOf(recProgressBar1, recProgressBar2, recProgressBar3))
|
||||
whenever(recommendationViewHolder.mediaSubtitles)
|
||||
.thenReturn(listOf(recSubtitle1, recSubtitle2, recSubtitle3))
|
||||
whenever(coverItem.imageMatrix).thenReturn(matrix)
|
||||
|
||||
// set ids for recommendation containers
|
||||
whenever(coverContainer1.id).thenReturn(1)
|
||||
whenever(coverContainer2.id).thenReturn(2)
|
||||
whenever(coverContainer3.id).thenReturn(3)
|
||||
}
|
||||
|
||||
private fun getColorIcon(color: Int): Icon {
|
||||
val bmp = Bitmap.createBitmap(10, 10, Bitmap.Config.ARGB_8888)
|
||||
val canvas = Canvas(bmp)
|
||||
|
||||
@@ -201,8 +201,8 @@ class MediaViewControllerTest : SysuiTestCase() {
|
||||
whenever(mockCopiedState.widgetStates)
|
||||
.thenReturn(
|
||||
mutableMapOf(
|
||||
R.id.media_title1 to mediaTitleWidgetState,
|
||||
R.id.media_subtitle1 to mediaSubTitleWidgetState,
|
||||
R.id.media_title to mediaTitleWidgetState,
|
||||
R.id.media_subtitle to mediaSubTitleWidgetState,
|
||||
R.id.media_cover1_container to mediaContainerWidgetState
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user