From d621692934613f49b40b52810bec58214c3dc26d Mon Sep 17 00:00:00 2001 From: Lucas Dupin Date: Sun, 17 May 2020 20:51:46 -0700 Subject: [PATCH] Move ripple initialization to view holder Test: manual Bug: 155796337 Change-Id: Ib6680c51500d6fb7e562a985d248059bb195c6bc --- .../com/android/systemui/media/MediaControlPanel.java | 9 --------- .../com/android/systemui/media/PlayerViewHolder.kt | 11 +++++++++++ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/media/MediaControlPanel.java b/packages/SystemUI/src/com/android/systemui/media/MediaControlPanel.java index e08d7a5b97a6d..1691c53386d68 100644 --- a/packages/SystemUI/src/com/android/systemui/media/MediaControlPanel.java +++ b/packages/SystemUI/src/com/android/systemui/media/MediaControlPanel.java @@ -323,10 +323,6 @@ public class MediaControlPanel { setVisibleAndAlpha(collapsedSet, R.id.media_seamless, true /*visible */); setVisibleAndAlpha(expandedSet, R.id.media_seamless, true /*visible */); updateDevice(mLocalMediaManager.getCurrentConnectedDevice()); - if (mViewHolder.getBackground().getBackground() instanceof IlluminationDrawable) { - ((IlluminationDrawable) mViewHolder.getBackground().getBackground()) - .setupTouch(mViewHolder.getSeamless(), mViewHolder.getPlayer()); - } mViewHolder.getSeamless().setOnClickListener(v -> { final Intent intent = new Intent() .setAction(MediaOutputSliceConstants.ACTION_MEDIA_OUTPUT) @@ -358,11 +354,6 @@ public class MediaControlPanel { button.setContentDescription(mediaAction.getContentDescription()); PendingIntent actionIntent = mediaAction.getIntent(); - if (mViewHolder.getBackground().getBackground() instanceof IlluminationDrawable) { - ((IlluminationDrawable) mViewHolder.getBackground().getBackground()) - .setupTouch(button, mViewHolder.getPlayer()); - } - button.setOnClickListener(v -> { if (actionIntent != null) { try { diff --git a/packages/SystemUI/src/com/android/systemui/media/PlayerViewHolder.kt b/packages/SystemUI/src/com/android/systemui/media/PlayerViewHolder.kt index 571e18d0ff20f..764dbe6d428f7 100644 --- a/packages/SystemUI/src/com/android/systemui/media/PlayerViewHolder.kt +++ b/packages/SystemUI/src/com/android/systemui/media/PlayerViewHolder.kt @@ -60,6 +60,17 @@ class PlayerViewHolder private constructor(itemView: View) { val action3 = itemView.requireViewById(R.id.action3) val action4 = itemView.requireViewById(R.id.action4) + init { + (background.background as IlluminationDrawable).let { + it.setupTouch(seamless, player) + it.setupTouch(action0, player) + it.setupTouch(action1, player) + it.setupTouch(action2, player) + it.setupTouch(action3, player) + it.setupTouch(action4, player) + } + } + fun getAction(id: Int): ImageButton { return when (id) { R.id.action0 -> action0