summaryrefslogtreecommitdiff
path: root/packages/SystemUI/src
diff options
context:
space:
mode:
author Selim Cinek <cinek@google.com> 2020-06-15 20:17:32 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-06-15 20:17:32 +0000
commitfc8443cf9d45a925f42ccefeeb7e0d2d1c42734f (patch)
tree086321c4758bfcb06de7a438c8bbc70b80acf802 /packages/SystemUI/src
parent7577e1d2cf6fad0e125c2acb70a1b08797124780 (diff)
parenteb70e1310a3171ad6e4c5ca03037b1db78b7d70b (diff)
Merge "Fixed an issue where the Device output chip lost its alpha" into rvc-dev
Diffstat (limited to 'packages/SystemUI/src')
-rw-r--r--packages/SystemUI/src/com/android/systemui/media/MediaControlPanel.java11
-rw-r--r--packages/SystemUI/src/com/android/systemui/util/animation/TransitionLayout.kt4
2 files changed, 11 insertions, 4 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/media/MediaControlPanel.java b/packages/SystemUI/src/com/android/systemui/media/MediaControlPanel.java
index 50081001e65a..d5a28378c993 100644
--- a/packages/SystemUI/src/com/android/systemui/media/MediaControlPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/media/MediaControlPanel.java
@@ -257,16 +257,18 @@ public class MediaControlPanel {
rect.setColor(Color.TRANSPARENT);
final MediaDeviceData device = data.getDevice();
+ int seamlessId = mViewHolder.getSeamless().getId();
if (device != null && !device.getEnabled()) {
mViewHolder.getSeamless().setEnabled(false);
- // TODO(b/156875717): setEnabled should cause the alpha to change.
- mViewHolder.getSeamless().setAlpha(0.38f);
+ expandedSet.setAlpha(seamlessId, 0.38f);
+ collapsedSet.setAlpha(seamlessId, 0.38f);
iconView.setImageResource(R.drawable.ic_hardware_speaker);
iconView.setVisibility(View.VISIBLE);
deviceName.setText(R.string.media_seamless_remote_device);
} else if (device != null) {
mViewHolder.getSeamless().setEnabled(true);
- mViewHolder.getSeamless().setAlpha(1f);
+ expandedSet.setAlpha(seamlessId, 1.0f);
+ collapsedSet.setAlpha(seamlessId, 1.0f);
Drawable icon = device.getIcon();
iconView.setVisibility(View.VISIBLE);
@@ -282,7 +284,8 @@ public class MediaControlPanel {
// Reset to default
Log.w(TAG, "device is null. Not binding output chip.");
mViewHolder.getSeamless().setEnabled(true);
- mViewHolder.getSeamless().setAlpha(1f);
+ expandedSet.setAlpha(seamlessId, 1.0f);
+ collapsedSet.setAlpha(seamlessId, 1.0f);
iconView.setVisibility(View.GONE);
deviceName.setText(com.android.internal.R.string.ext_media_seamless_action);
}
diff --git a/packages/SystemUI/src/com/android/systemui/util/animation/TransitionLayout.kt b/packages/SystemUI/src/com/android/systemui/util/animation/TransitionLayout.kt
index 701ff5ecf8a1..806d9d8e158a 100644
--- a/packages/SystemUI/src/com/android/systemui/util/animation/TransitionLayout.kt
+++ b/packages/SystemUI/src/com/android/systemui/util/animation/TransitionLayout.kt
@@ -37,6 +37,7 @@ class TransitionLayout @JvmOverloads constructor(
) : ConstraintLayout(context, attrs, defStyleAttr) {
private val originalGoneChildrenSet: MutableSet<Int> = mutableSetOf()
+ private val originalViewAlphas: MutableMap<Int, Float> = mutableMapOf()
private var measureAsConstraint: Boolean = false
private var currentState: TransitionViewState = TransitionViewState()
private var updateScheduled = false
@@ -67,6 +68,7 @@ class TransitionLayout @JvmOverloads constructor(
if (child.visibility == GONE) {
originalGoneChildrenSet.add(child.id)
}
+ originalViewAlphas[child.id] = child.alpha
}
}
@@ -198,6 +200,8 @@ class TransitionLayout @JvmOverloads constructor(
if (originalGoneChildrenSet.contains(child.id)) {
child.visibility = View.GONE
}
+ // Reset the alphas, to only have the alphas present from the constraintset
+ child.alpha = originalViewAlphas[child.id] ?: 1.0f
}
// Let's now apply the constraintSet to get the full state
constraintSet.applyTo(this)