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

Commit 3f32e7eb authored by Winson's avatar Winson
Browse files

Tweaks to make overview animations to match spec.

- Fixing incompatible app message text color
- Fixing drag target hover color
- Fixing final frame jank when animating home from overview
- Adding animation prop setter for initial play time

Bug: 27154882
Change-Id: Ia8a90434da2174d3c78a353b881509a8b1d525ba
parent 3ca1028e
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -26,5 +26,6 @@
        android:layout_gravity="center"
        android:drawableTop="@drawable/recents_info_light"
        android:drawablePadding="8dp"
        android:text="@string/recents_incompatible_app_message" />
        android:text="@string/recents_incompatible_app_message"
        android:textColor="@android:color/white" />
</FrameLayout>
 No newline at end of file
+0 −6
Original line number Diff line number Diff line
@@ -144,12 +144,6 @@
    <!-- The min animation duration for animating the nav bar scrim in. -->
    <integer name="recents_nav_bar_scrim_enter_duration">400</integer>

    <!-- The animation duration for animating the removal of a task view. -->
    <integer name="recents_animate_task_view_remove_duration">175</integer>

    <!-- The base animation duration for animating the removal of all task views. -->
    <integer name="recents_animate_task_views_remove_all_duration">300</integer>

    <!-- The animation duration for scrolling the stack to a particular item. -->
    <integer name="recents_animate_task_stack_scroll_duration">200</integer>

+10 −6
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.content.IntentFilter;
import android.content.res.Configuration;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.SystemClock;
import android.os.UserHandle;
import android.provider.Settings;
@@ -97,6 +98,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
    public final static int INCOMPATIBLE_APP_ALPHA_DURATION = 150;

    private RecentsPackageMonitor mPackageMonitor;
    private Handler mHandler = new Handler();
    private long mLastTabKeyEventTime;
    private int mLastDeviceOrientation = Configuration.ORIENTATION_UNDEFINED;
    private int mLastDisplayDensity;
@@ -138,12 +140,14 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
        @Override
        public void run() {
            try {
                mHandler.post(() -> {
                    ActivityOptions opts = mOpts;
                    if (opts == null) {
                        opts = ActivityOptions.makeCustomAnimation(RecentsActivity.this,
                                R.anim.recents_to_launcher_enter, R.anim.recents_to_launcher_exit);
                    }
                    startActivityAsUser(mLaunchIntent, opts.toBundle(), UserHandle.CURRENT);
                });
            } catch (Exception e) {
                Log.e(TAG, getString(R.string.recents_launch_error_message, "Home"), e);
            }
+20 −9
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ import android.util.SparseArray;
import android.view.animation.Interpolator;

import com.android.internal.policy.DockedDividerUtils;
import com.android.systemui.Interpolators;
import com.android.systemui.R;
import com.android.systemui.recents.Recents;
import com.android.systemui.recents.RecentsDebugFlags;
@@ -253,7 +254,7 @@ public class TaskStack {
        private static final int HORIZONTAL = 0;
        private static final int VERTICAL = 1;

        private static final int DOCK_AREA_ALPHA = 192;
        private static final int DOCK_AREA_ALPHA = 80;
        public static final DockState NONE = new DockState(DOCKED_INVALID, -1, 80, 255, HORIZONTAL,
                null, null, null);
        public static final DockState LEFT = new DockState(DOCKED_LEFT,
@@ -368,19 +369,28 @@ public class TaskStack {
                    mDockAreaOverlayAnimator.cancel();
                }

                ObjectAnimator anim;
                ArrayList<Animator> animators = new ArrayList<>();
                if (dockAreaOverlay.getAlpha() != areaAlpha) {
                    if (animateAlpha) {
                        animators.add(ObjectAnimator.ofInt(dockAreaOverlay,
                                Utilities.DRAWABLE_ALPHA, dockAreaOverlay.getAlpha(), areaAlpha));
                        anim = ObjectAnimator.ofInt(dockAreaOverlay,
                                Utilities.DRAWABLE_ALPHA, dockAreaOverlay.getAlpha(), areaAlpha);
                        anim.setDuration(duration);
                        anim.setInterpolator(interpolator);
                        animators.add(anim);
                    } else {
                        dockAreaOverlay.setAlpha(areaAlpha);
                    }
                }
                if (mHintTextAlpha != hintAlpha) {
                    if (animateAlpha) {
                        animators.add(ObjectAnimator.ofInt(this, HINT_ALPHA, mHintTextAlpha,
                                hintAlpha));
                        anim = ObjectAnimator.ofInt(this, HINT_ALPHA, mHintTextAlpha,
                                hintAlpha);
                        anim.setDuration(150);
                        anim.setInterpolator(hintAlpha > mHintTextAlpha
                                ? Interpolators.ALPHA_IN
                                : Interpolators.ALPHA_OUT);
                        animators.add(anim);
                    } else {
                        mHintTextAlpha = hintAlpha;
                        dockAreaOverlay.invalidateSelf();
@@ -390,8 +400,11 @@ public class TaskStack {
                    if (animateBounds) {
                        PropertyValuesHolder prop = PropertyValuesHolder.ofObject(
                                Utilities.DRAWABLE_RECT, Utilities.RECT_EVALUATOR,
                                dockAreaOverlay.getBounds(), bounds);
                        animators.add(ObjectAnimator.ofPropertyValuesHolder(dockAreaOverlay, prop));
                                new Rect(dockAreaOverlay.getBounds()), bounds);
                        anim = ObjectAnimator.ofPropertyValuesHolder(dockAreaOverlay, prop);
                        anim.setDuration(duration);
                        anim.setInterpolator(interpolator);
                        animators.add(anim);
                    } else {
                        dockAreaOverlay.setBounds(bounds);
                    }
@@ -399,8 +412,6 @@ public class TaskStack {
                if (!animators.isEmpty()) {
                    mDockAreaOverlayAnimator = new AnimatorSet();
                    mDockAreaOverlayAnimator.playTogether(animators);
                    mDockAreaOverlayAnimator.setDuration(duration);
                    mDockAreaOverlayAnimator.setInterpolator(interpolator);
                    mDockAreaOverlayAnimator.start();
                }
            }
+32 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.systemui.recents.views;

import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ValueAnimator;
import android.annotation.IntDef;
import android.util.SparseArray;
import android.util.SparseLongArray;
@@ -53,6 +54,7 @@ public class AnimationProps {
    public static final int FOCUS_STATE = 8;

    private SparseLongArray mPropStartDelay;
    private SparseLongArray mPropInitialPlayTime;
    private SparseLongArray mPropDuration;
    private SparseArray<Interpolator> mPropInterpolators;
    private Animator.AnimatorListener mListener;
@@ -116,10 +118,14 @@ public class AnimationProps {
     * Applies the specific start delay, duration and interpolator to the given {@param animator}
     * for the specified {@param propertyType}.
     */
    public <T extends Animator> T apply(@PropType int propertyType, T animator) {
    public <T extends ValueAnimator> T apply(@PropType int propertyType, T animator) {
        animator.setStartDelay(getStartDelay(propertyType));
        animator.setDuration(getDuration(propertyType));
        animator.setInterpolator(getInterpolator(propertyType));
        long initialPlayTime = getInitialPlayTime(propertyType);
        if (initialPlayTime != 0) {
            animator.setCurrentPlayTime(initialPlayTime);
        }
        return animator;
    }

@@ -134,6 +140,17 @@ public class AnimationProps {
        return this;
    }

    /**
     * Sets a initial play time for a specific property.
     */
    public AnimationProps setInitialPlayTime(@PropType int propertyType, int initialPlayTime) {
        if (mPropInitialPlayTime == null) {
            mPropInitialPlayTime = new SparseLongArray();
        }
        mPropInitialPlayTime.append(propertyType, initialPlayTime);
        return this;
    }

    /**
     * Returns the start delay for a specific property.
     */
@@ -199,6 +216,20 @@ public class AnimationProps {
        return Interpolators.LINEAR;
    }

    /**
     * Returns the initial play time for a specific property, falling back to the general initial
     * play time if there is no specific property interpolator.
     */
    public long getInitialPlayTime(@PropType int propertyType) {
        if (mPropInitialPlayTime != null) {
            if (mPropInitialPlayTime.indexOfKey(propertyType) != -1) {
                return mPropInitialPlayTime.get(propertyType);
            }
            return mPropInitialPlayTime.get(ALL, 0);
        }
        return 0;
    }

    /**
     * Sets an animator listener for this animation.
     */
Loading