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

Commit 814deadc authored by Tony's avatar Tony
Browse files

Animate badge after folder closes

Bug: 62586079
Change-Id: I17d7b88730c16f5cce36972dd485fd10b823f742
parent cd688545
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -790,6 +790,9 @@ public class Folder extends AbstractFloatingView implements DragSource, View.OnC
            mFolderIcon.setVisibility(View.VISIBLE);
            if (wasAnimated) {
                mFolderIcon.mBackground.animateBackgroundStroke();
                if (mFolderIcon.hasBadge()) {
                    mFolderIcon.createBadgeScaleAnimator(0f, 1f).start();
                }
                mFolderIcon.requestFocus();
            }
        }
+9 −3
Original line number Diff line number Diff line
@@ -38,8 +38,6 @@ import android.graphics.drawable.Drawable;
import android.os.Parcelable;
import android.support.v4.graphics.ColorUtils;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.Property;
import android.view.LayoutInflater;
import android.view.MotionEvent;
@@ -420,13 +418,21 @@ public class FolderIcon extends FrameLayout implements FolderListener {
        float newBadgeScale = isBadged ? 1f : 0f;
        // Animate when a badge is first added or when it is removed.
        if ((wasBadged ^ isBadged) && isShown()) {
            ObjectAnimator.ofFloat(this, BADGE_SCALE_PROPERTY, newBadgeScale).start();
            createBadgeScaleAnimator(newBadgeScale).start();
        } else {
            mBadgeScale = newBadgeScale;
            invalidate();
        }
    }

    public Animator createBadgeScaleAnimator(float... badgeScales) {
        return ObjectAnimator.ofFloat(this, BADGE_SCALE_PROPERTY, badgeScales);
    }

    public boolean hasBadge() {
        return mBadgeInfo != null && mBadgeInfo.hasBadge();
    }

    static class PreviewItemDrawingParams {
        PreviewItemDrawingParams(float transX, float transY, float scale, float overlayAlpha) {
            this.transX = transX;