Fixes race condition in animation on Ringer Status.

Race condition caused by setting the container to INVISIBLE regardless
of new status.

Change-Id: I28b2d8bf5ae6587ac8aa5ab807e835a7fd2a97f9
Fixes: 111137359
Test: Visual and runtest
This commit is contained in:
Fabian Kozynski
2018-09-04 16:42:43 -04:00
parent cf1c58cd47
commit 3f78933e89
2 changed files with 7 additions and 22 deletions

View File

@@ -38,7 +38,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:gravity="center_vertical"
android:visibility="invisible">
android:alpha="0">
<ImageView
android:id="@+id/next_alarm_icon"

View File

@@ -547,38 +547,23 @@ public class QuickStatusBarHeader extends RelativeLayout implements
/**
* Fades in the updated status text. Note that if there's already a status showing, this will
* immediately hide it and fade in the updated status.
* immediately fade it out and fade in the updated status.
*/
private void showStatus() {
mStatusContainer.setAlpha(0f);
mStatusContainer.setVisibility(View.VISIBLE);
// Animate the alarm back in. Make sure to clear the animator listener for the animation!
mStatusContainer.animate()
.alpha(1f)
.setDuration(FADE_ANIMATION_DURATION_MS)
.setListener(null)
.start();
}
/** Fades out and hides the status text. */
/** Fades out the status text. */
private void hideStatusText() {
if (mStatusContainer.getVisibility() == View.VISIBLE) {
mStatusContainer.animate()
.alpha(0f)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (DEBUG) Log.d(TAG, "hideAlarmText: Hid alarm text");
// Reset the alpha regardless of how the animation ends for the next
// time we show this view/want to animate it.
mStatusContainer.setVisibility(View.INVISIBLE);
mStatusContainer.setAlpha(1f);
}
})
.start();
}
mStatusContainer.animate()
.alpha(0f)
.setDuration(FADE_ANIMATION_DURATION_MS)
.start();
}
public void updateEverything() {