Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3f78933e authored by Fabian Kozynski's avatar Fabian Kozynski
Browse files

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
parent cf1c58cd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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"
+6 −21
Original line number Diff line number Diff line
@@ -547,39 +547,24 @@ 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);
                        }
                    })
                .setDuration(FADE_ANIMATION_DURATION_MS)
                .start();
    }
    }

    public void updateEverything() {
        post(() -> setClickable(false));