Merge "Keep metadata and buttons in the same position" into tm-qpr-dev am: 71d3dbf23b

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20645352

Change-Id: I328580316dd337b61ad9a38733f7e0d8cefe4214
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Michael Mikhail
2022-12-06 16:18:54 +00:00
committed by Automerger Merge Worker
2 changed files with 7 additions and 17 deletions

View File

@@ -940,19 +940,9 @@ public class MediaControlPanel {
if (mIsSeekBarEnabled) { if (mIsSeekBarEnabled) {
return ConstraintSet.VISIBLE; return ConstraintSet.VISIBLE;
} }
// If disabled and "neighbours" are visible, set progress bar to INVISIBLE instead of GONE // Set progress bar to INVISIBLE to keep the positions of text and buttons similar to the
// so layout weights still work. // original positions when seekbar is enabled.
return areAnyExpandedBottomActionsVisible() ? ConstraintSet.INVISIBLE : ConstraintSet.GONE; return ConstraintSet.INVISIBLE;
}
private boolean areAnyExpandedBottomActionsVisible() {
ConstraintSet expandedSet = mMediaViewController.getExpandedLayout();
for (int id : MediaViewHolder.Companion.getExpandedBottomActionIds()) {
if (expandedSet.getVisibility(id) == ConstraintSet.VISIBLE) {
return true;
}
}
return false;
} }
private void setGenericButton( private void setGenericButton(

View File

@@ -702,7 +702,7 @@ public class MediaControlPanelTest : SysuiTestCase() {
} }
@Test @Test
fun bind_seekBarDisabled_noActions_seekBarVisibilityIsSetToGone() { fun bind_seekBarDisabled_noActions_seekBarVisibilityIsSetToInvisible() {
useRealConstraintSets() useRealConstraintSets()
val state = mediaData.copy(semanticActions = MediaButton()) val state = mediaData.copy(semanticActions = MediaButton())
@@ -711,7 +711,7 @@ public class MediaControlPanelTest : SysuiTestCase() {
player.bindPlayer(state, PACKAGE) player.bindPlayer(state, PACKAGE)
assertThat(expandedSet.getVisibility(seekBar.id)).isEqualTo(ConstraintSet.GONE) assertThat(expandedSet.getVisibility(seekBar.id)).isEqualTo(ConstraintSet.INVISIBLE)
} }
@Test @Test
@@ -741,7 +741,7 @@ public class MediaControlPanelTest : SysuiTestCase() {
} }
@Test @Test
fun seekBarChangesToDisabledAfterBind_noActions_seekBarChangesToGone() { fun seekBarChangesToDisabledAfterBind_noActions_seekBarChangesToInvisible() {
useRealConstraintSets() useRealConstraintSets()
val state = mediaData.copy(semanticActions = MediaButton()) val state = mediaData.copy(semanticActions = MediaButton())
@@ -752,7 +752,7 @@ public class MediaControlPanelTest : SysuiTestCase() {
getEnabledChangeListener().onEnabledChanged(enabled = false) getEnabledChangeListener().onEnabledChanged(enabled = false)
assertThat(expandedSet.getVisibility(seekBar.id)).isEqualTo(ConstraintSet.GONE) assertThat(expandedSet.getVisibility(seekBar.id)).isEqualTo(ConstraintSet.INVISIBLE)
} }
@Test @Test