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

Commit fa8b4186 authored by Selim Cinek's avatar Selim Cinek
Browse files

Fixed some issues where conversation badges would not be visible

Badges would only update once the next update of the shelf came in,
so they would sometimes would remain without a background for a
short time.

Bug: 150905003
Test: add conversations, observe normal background after expanding QS and flinging down
Change-Id: If8756ac8916e6e1fc51cf3a90c34c87d8db71db6
parent 9f2d21f3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -96,7 +96,7 @@ public class PropertyAnimator {
                || previousAnimator.getAnimatedFraction() == 0)) {
            animator.setStartDelay(properties.delay);
        }
        AnimatorListenerAdapter listener = properties.getAnimationFinishListener();
        AnimatorListenerAdapter listener = properties.getAnimationFinishListener(property);
        if (listener != null) {
            animator.addListener(listener);
        }
+27 −6
Original line number Diff line number Diff line
@@ -16,12 +16,15 @@

package com.android.systemui.statusbar.notification.stack;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.util.ArrayMap;
import android.util.Property;
import android.view.View;
import android.view.animation.Interpolator;

import java.util.function.Consumer;

/**
 * Properties for a View animation
 */
@@ -29,7 +32,7 @@ public class AnimationProperties {
    public long duration;
    public long delay;
    private ArrayMap<Property, Interpolator> mInterpolatorMap;
    private AnimatorListenerAdapter mAnimatorListenerAdapter;
    private Consumer<Property> mAnimationEndAction;

    /**
     * @return an animation filter for this animation.
@@ -44,14 +47,32 @@ public class AnimationProperties {
    }

    /**
     * @return a listener that should be run whenever any property finished its animation
     * @return a listener that will be added for a given property during its animation.
     */
    public AnimatorListenerAdapter getAnimationFinishListener() {
        return mAnimatorListenerAdapter;
    public AnimatorListenerAdapter getAnimationFinishListener(Property property) {
        if (mAnimationEndAction == null) {
            return null;
        }
        Consumer<Property> endAction = mAnimationEndAction;
        return new AnimatorListenerAdapter() {
            private boolean mCancelled;

            @Override
            public void onAnimationCancel(Animator animation) {
                 mCancelled = true;
            }

            @Override
            public void onAnimationEnd(Animator animation) {
                if (!mCancelled) {
                    endAction.accept(property);
                }
            }
        };
    }

    public AnimationProperties setAnimationFinishListener(AnimatorListenerAdapter listener) {
        mAnimatorListenerAdapter = listener;
    public AnimationProperties setAnimationEndAction(Consumer<Property> listener) {
        mAnimationEndAction = listener;
        return this;
    }

+4 −2
Original line number Diff line number Diff line
@@ -263,7 +263,8 @@ public class ExpandableViewState extends ViewState {
                || previousAnimator.getAnimatedFraction() == 0)) {
            animator.setStartDelay(properties.delay);
        }
        AnimatorListenerAdapter listener = properties.getAnimationFinishListener();
        AnimatorListenerAdapter listener = properties.getAnimationFinishListener(
                null /* no property for this height */);
        if (listener != null) {
            animator.addListener(listener);
        }
@@ -343,7 +344,8 @@ public class ExpandableViewState extends ViewState {
                || previousAnimator.getAnimatedFraction() == 0)) {
            animator.setStartDelay(properties.delay);
        }
        AnimatorListenerAdapter listener = properties.getAnimationFinishListener();
        AnimatorListenerAdapter listener = properties.getAnimationFinishListener(
                null /* no property for top inset */);
        if (listener != null) {
            animator.addListener(listener);
        }
+1 −1
Original line number Diff line number Diff line
@@ -104,7 +104,7 @@ public class StackStateAnimator {
            }

            @Override
            public AnimatorListenerAdapter getAnimationFinishListener() {
            public AnimatorListenerAdapter getAnimationFinishListener(Property property) {
                return getGlobalAnimationFinishedListener();
            }

+7 −4
Original line number Diff line number Diff line
@@ -393,7 +393,7 @@ public class ViewState implements Dumpable {
                || previousAnimator.getAnimatedFraction() == 0)) {
            animator.setStartDelay(properties.delay);
        }
        AnimatorListenerAdapter listener = properties.getAnimationFinishListener();
        AnimatorListenerAdapter listener = properties.getAnimationFinishListener(View.ALPHA);
        if (listener != null) {
            animator.addListener(listener);
        }
@@ -450,7 +450,8 @@ public class ViewState implements Dumpable {
                || previousAnimator.getAnimatedFraction() == 0)) {
            animator.setStartDelay(properties.delay);
        }
        AnimatorListenerAdapter listener = properties.getAnimationFinishListener();
        AnimatorListenerAdapter listener = properties.getAnimationFinishListener(
                View.TRANSLATION_Z);
        if (listener != null) {
            animator.addListener(listener);
        }
@@ -515,7 +516,8 @@ public class ViewState implements Dumpable {
                || previousAnimator.getAnimatedFraction() == 0)) {
            animator.setStartDelay(properties.delay);
        }
        AnimatorListenerAdapter listener = properties.getAnimationFinishListener();
        AnimatorListenerAdapter listener = properties.getAnimationFinishListener(
                View.TRANSLATION_X);
        if (listener != null) {
            animator.addListener(listener);
        }
@@ -580,7 +582,8 @@ public class ViewState implements Dumpable {
                || previousAnimator.getAnimatedFraction() == 0)) {
            animator.setStartDelay(properties.delay);
        }
        AnimatorListenerAdapter listener = properties.getAnimationFinishListener();
        AnimatorListenerAdapter listener = properties.getAnimationFinishListener(
                View.TRANSLATION_Y);
        if (listener != null) {
            animator.addListener(listener);
        }
Loading