Keep metadata and buttons in the same position
it sets the seekbar visibility to invisible when it should be disabled. So it keeps the space for the seekbar available which keeps the positions of other UI components in the same original position. Bug: 249989837 Test: atest MediaControlPanelTest Test: Checked the new changes applied on UMO UI. Change-Id: I77131a60bc6bce87e326828fe5d799538b19f16c
This commit is contained in:
@@ -940,19 +940,9 @@ public class MediaControlPanel {
|
||||
if (mIsSeekBarEnabled) {
|
||||
return ConstraintSet.VISIBLE;
|
||||
}
|
||||
// If disabled and "neighbours" are visible, set progress bar to INVISIBLE instead of GONE
|
||||
// so layout weights still work.
|
||||
return areAnyExpandedBottomActionsVisible() ? ConstraintSet.INVISIBLE : ConstraintSet.GONE;
|
||||
}
|
||||
|
||||
private boolean areAnyExpandedBottomActionsVisible() {
|
||||
ConstraintSet expandedSet = mMediaViewController.getExpandedLayout();
|
||||
for (int id : MediaViewHolder.Companion.getExpandedBottomActionIds()) {
|
||||
if (expandedSet.getVisibility(id) == ConstraintSet.VISIBLE) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
// Set progress bar to INVISIBLE to keep the positions of text and buttons similar to the
|
||||
// original positions when seekbar is enabled.
|
||||
return ConstraintSet.INVISIBLE;
|
||||
}
|
||||
|
||||
private void setGenericButton(
|
||||
|
||||
@@ -702,7 +702,7 @@ public class MediaControlPanelTest : SysuiTestCase() {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun bind_seekBarDisabled_noActions_seekBarVisibilityIsSetToGone() {
|
||||
fun bind_seekBarDisabled_noActions_seekBarVisibilityIsSetToInvisible() {
|
||||
useRealConstraintSets()
|
||||
|
||||
val state = mediaData.copy(semanticActions = MediaButton())
|
||||
@@ -711,7 +711,7 @@ public class MediaControlPanelTest : SysuiTestCase() {
|
||||
|
||||
player.bindPlayer(state, PACKAGE)
|
||||
|
||||
assertThat(expandedSet.getVisibility(seekBar.id)).isEqualTo(ConstraintSet.GONE)
|
||||
assertThat(expandedSet.getVisibility(seekBar.id)).isEqualTo(ConstraintSet.INVISIBLE)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -741,7 +741,7 @@ public class MediaControlPanelTest : SysuiTestCase() {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun seekBarChangesToDisabledAfterBind_noActions_seekBarChangesToGone() {
|
||||
fun seekBarChangesToDisabledAfterBind_noActions_seekBarChangesToInvisible() {
|
||||
useRealConstraintSets()
|
||||
|
||||
val state = mediaData.copy(semanticActions = MediaButton())
|
||||
@@ -752,7 +752,7 @@ public class MediaControlPanelTest : SysuiTestCase() {
|
||||
|
||||
getEnabledChangeListener().onEnabledChanged(enabled = false)
|
||||
|
||||
assertThat(expandedSet.getVisibility(seekBar.id)).isEqualTo(ConstraintSet.GONE)
|
||||
assertThat(expandedSet.getVisibility(seekBar.id)).isEqualTo(ConstraintSet.INVISIBLE)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user