Skip to content

Commit a9d8ff1

Browse files
ritujbGenkzsz11
authored andcommitted
SystemUI: VolumeDialog: Fix animation when ringer and notification are unlinked
Signed-off-by: Rituj Beniwal <ritujbeniwal@gmail.com> Change-Id: I92ab08edaa9d545f17f07093f421bf3b73e1d49a Signed-off-by: Genkzsz11 <Genkzsz11@gmail.com>
1 parent 98bb8cf commit a9d8ff1

1 file changed

Lines changed: 20 additions & 16 deletions

File tree

packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ private void cleanExpandedRows() {
621621
VolumeRow notification = findRow(STREAM_NOTIFICATION);
622622
VolumeRow active = getActiveRow();
623623

624-
float width = mWidth + mSpacer;
624+
final float width = mWidth + mSpacer;
625625
float z = mElevation;
626626

627627
boolean isMediaButtonVisible = mMediaButtonView.getVisibility() == VISIBLE;
@@ -638,28 +638,29 @@ private void cleanExpandedRows() {
638638
hideCaptionsTooltip();
639639
}
640640

641+
float translation = 0;
641642
boolean isNotificationEnabled = notification != null && !mState.linkedNotification;
642643
if (isNotificationEnabled) {
643644
final boolean isNotifVisible = active == notification;
644-
animateViewOut(notification.view, isNotifVisible, 0, z);
645+
animateViewOut(notification.view, isNotifVisible, translation, z);
645646
z /= 2;
646-
width = isNotifVisible ? width : width * 2;
647+
translation += isNotifVisible ? 0 : width;
647648
}
648649
if (alarm != null) {
649650
final boolean isAlarmVisible = active == alarm;
650-
animateViewOut(alarm.view, isAlarmVisible, isNotificationEnabled ? width : 0, z);
651+
animateViewOut(alarm.view, isAlarmVisible, translation, z);
651652
z /= 2;
652-
width = isAlarmVisible ? 0 : width;
653+
translation += isAlarmVisible ? 0 : width;
653654
}
654655
if (ring != null) {
655656
final boolean isRingVisible = active == ring;
656-
animateViewOut(ring.view, isRingVisible, width, z);
657+
animateViewOut(ring.view, isRingVisible, translation, z);
657658
z /= 2;
658-
width += isRingVisible ? 0 : (mWidth + mSpacer);
659+
translation += isRingVisible ? 0 : width;
659660
}
660661
if (media != null) {
661662
Util.setVisOrGone(media.view, true);
662-
animateViewOut(media.view, true, width, z);
663+
animateViewOut(media.view, true, translation, z);
663664
}
664665
if (mShowingMediaDevices) {
665666
mDialogRowsView.setAlpha(1f);
@@ -769,9 +770,10 @@ public void initSettingsH() {
769770
});
770771
mMediaButton.setOnClickListener(v -> {
771772
int x = (int) (isLandscape() ? (mVolumePanelOnLeft ? (
772-
mWidth + mSpacer + mWidth / 2)
773+
(mWidth + mSpacer) * 2 + mWidth / 2)
773774
: mWidth / 2)
774775
: (1.5 * mWidth + mSpacer));
776+
775777
int endRadius = (int) Math.hypot((isLandscape() ? 2.2 : 1.1) * (1.5 * mWidth +
776778
mSpacer), mHeight);
777779
if (mShowingMediaDevices) {
@@ -818,7 +820,7 @@ public void initSettingsH() {
818820
mWidth = (float) active.view.getWidth();
819821
}
820822

821-
float width = mWidth + mSpacer;
823+
final float width = mWidth + mSpacer;
822824
float z = mElevation;
823825

824826
boolean showMediaOutput = !Utils.isAudioModeOngoingCall(mContext) &&
@@ -839,26 +841,28 @@ public void initSettingsH() {
839841
}
840842
}
841843

844+
float translation = 0;
842845
boolean isNotificationEnabled = notification != null && !mState.linkedNotification;
843846
if (isNotificationEnabled) {
844847
final boolean isNotifVisible = active == notification;
845-
animateViewIn(notification.view, isNotifVisible, 0, z);
848+
animateViewIn(notification.view, isNotifVisible, translation, z);
846849
z /= 2;
850+
translation += isNotifVisible ? 0 : width;
847851
}
848852
if (alarm != null) {
849853
final boolean isAlarmVisible = active == alarm;
850-
animateViewIn(alarm.view, isAlarmVisible, isNotificationEnabled ? width : 0, z);
854+
animateViewIn(alarm.view, isAlarmVisible, translation, z);
851855
z /= 2;
852-
width = isAlarmVisible ? 0 : width;
856+
translation = isAlarmVisible ? 0 : width;
853857
}
854858
if (ring != null) {
855859
final boolean isRingVisible = active == ring;
856-
animateViewIn(ring.view, isRingVisible, width, z);
860+
animateViewIn(ring.view, isRingVisible, translation, z);
857861
z /= 2;
858-
width += isRingVisible ? 0 : (mWidth + mSpacer);
862+
translation += isRingVisible ? 0 : width;
859863
}
860864
if (media != null) {
861-
animateViewIn(media.view, true, width, z);
865+
animateViewIn(media.view, true, translation, z);
862866
}
863867

864868
provideTouchHapticH(VibrationEffect.get(VibrationEffect.EFFECT_TICK));

0 commit comments

Comments
 (0)