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

Commit 951e2e4f authored by Winson's avatar Winson Committed by android-build-merger
Browse files

Moving dim calculation into the stack layout.

am: 1bcf3c47

* commit '1bcf3c47':
  Moving dim calculation into the stack layout.
parents b6b2250d 1bcf3c47
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -165,9 +165,6 @@
    <!-- The animation duration for entering and exiting the history. -->
    <integer name="recents_history_transition_duration">250</integer>

    <!-- The minimum alpha for the dim applied to cards that go deeper into the stack. -->
    <integer name="recents_max_task_stack_view_dim">96</integer>

    <!-- The delay to enforce between each alt-tab key press. -->
    <integer name="recents_alt_tab_key_delay">200</integer>

+16 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.recents.misc;

import android.animation.Animator;
import android.animation.AnimatorSet;
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.RectF;
@@ -30,6 +31,7 @@ import android.view.ViewParent;
import com.android.systemui.recents.model.Task;
import com.android.systemui.recents.views.TaskViewTransform;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

@@ -154,11 +156,24 @@ public class Utilities {
     */
    public static void cancelAnimationWithoutCallbacks(Animator animator) {
        if (animator != null) {
            animator.removeAllListeners();
            removeAnimationListenersRecursive(animator);
            animator.cancel();
        }
    }

    /**
     * Recursively removes all the listeners of all children of this animator
     */
    public static void removeAnimationListenersRecursive(Animator animator) {
        if (animator instanceof AnimatorSet) {
            ArrayList<Animator> animators = ((AnimatorSet) animator).getChildAnimations();
            for (int i = animators.size() - 1; i >= 0; i--) {
                removeAnimationListenersRecursive(animators.get(i));
            }
        }
        animator.removeAllListeners();
    }

    /**
     * Updates {@param transforms} to be the same size as {@param tasks}.
     */
+7 −3
Original line number Diff line number Diff line
@@ -25,6 +25,9 @@ import android.view.ViewOutlineProvider;
/* An outline provider that has a clip and outline that can be animated. */
public class AnimateableViewBounds extends ViewOutlineProvider {

    private static final float MIN_ALPHA = 0.1f;
    private static final float MAX_ALPHA = 0.8f;

    View mSourceView;
    @ViewDebug.ExportedProperty(category="recents")
    Rect mClipRect = new Rect();
@@ -36,7 +39,6 @@ public class AnimateableViewBounds extends ViewOutlineProvider {
    int mCornerRadius;
    @ViewDebug.ExportedProperty(category="recents")
    float mAlpha = 1f;
    final float mMinAlpha = 0.25f;

    public AnimateableViewBounds(View source, int cornerRadius) {
        mSourceView = source;
@@ -53,7 +55,7 @@ public class AnimateableViewBounds extends ViewOutlineProvider {

    @Override
    public void getOutline(View view, Outline outline) {
        outline.setAlpha(mMinAlpha + mAlpha / (1f - mMinAlpha));
        outline.setAlpha(MIN_ALPHA + mAlpha * (MAX_ALPHA - MIN_ALPHA));
        if (mCornerRadius > 0) {
            outline.setRoundRect(mClipRect.left, mClipRect.top,
                    mSourceView.getWidth() - mClipRect.right,
@@ -66,7 +68,9 @@ public class AnimateableViewBounds extends ViewOutlineProvider {
        }
    }

    /** Sets the view outline alpha. */
    /**
     * Sets the view outline alpha.
     */
    void setAlpha(float alpha) {
        if (Float.compare(alpha, mAlpha) != 0) {
            mAlpha = alpha;
+1 −0
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ public class AnimationProps {
    public static final int ALPHA = 4;
    public static final int SCALE = 5;
    public static final int BOUNDS = 6;
    public static final int DIM_ALPHA = 7;

    private SparseLongArray mPropStartDelay;
    private SparseLongArray mPropDuration;
+2 −1
Original line number Diff line number Diff line
@@ -152,10 +152,11 @@ public class FreeformWorkspaceLayoutAlgorithm {
            transformOut.scale = 1f;
            transformOut.alpha = 1f;
            transformOut.translationZ = stackLayout.mMaxTranslationZ;
            transformOut.dimAlpha = 0f;
            transformOut.rect.set(ffRect);
            transformOut.rect.offset(stackLayout.mFreeformRect.left, stackLayout.mFreeformRect.top);
            transformOut.visible = true;
            transformOut.p = 1f;
            transformOut.relativeTaskProgress = 0f;
            return transformOut;
        }
        return null;
Loading