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

Commit 30d276cb authored by Tony Wickham's avatar Tony Wickham Committed by Android (Google) Code Review
Browse files

Merge "Animate recent app icon in after activity transition" into ub-launcher3-master

parents ffa3bb97 0349b6c0
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -320,5 +320,9 @@ public class NavBarSwipeInteractionHandler extends InternalStateHandler {

    private void onAnimationToLauncherComplete() {
        mDragView.close(false);
        View currentRecentsPage = mRecentsView.getPageAt(mRecentsView.getCurrentPage());
        if (currentRecentsPage instanceof TaskView) {
            ((TaskView) currentRecentsPage).animateIconToScale(1f);
        }
    }
}
+3 −0
Original line number Diff line number Diff line
@@ -146,6 +146,9 @@ public class RecentsView extends PagedView {
    public void update(RecentsTaskLoadPlan loadPlan) {
        final RecentsTaskLoader loader = TouchInteractionService.getRecentsTaskLoader();
        setCurrentPage(0);
        if (getPageAt(mCurrentPage) instanceof TaskView) {
            ((TaskView) getPageAt(mCurrentPage)).setIconScale(0);
        }
        TaskStack stack = loadPlan != null ? loadPlan.getTaskStack() : null;
        if (stack == null) {
            removeAllViews();
+29 −0
Original line number Diff line number Diff line
@@ -59,6 +59,8 @@ public class TaskView extends FrameLayout implements TaskCallbacks, SwipeDetecto
     */
    private static final float SWIPE_DISTANCE_HEIGHT_PERCENTAGE = 0.38f;

    private static final long SCALE_ICON_DURATION = 120;

    private static final Property<TaskView, Float> PROPERTY_SWIPE_PROGRESS =
            new Property<TaskView, Float>(Float.class, "swipe_progress") {

@@ -73,6 +75,19 @@ public class TaskView extends FrameLayout implements TaskCallbacks, SwipeDetecto
                }
            };

    private static final Property<TaskView, Float> SCALE_ICON_PROPERTY =
            new Property<TaskView, Float>(Float.TYPE, "scale_icon") {
                @Override
                public Float get(TaskView taskView) {
                    return taskView.mIconScale;
                }

                @Override
                public void set(TaskView taskView, Float iconScale) {
                    taskView.setIconScale(iconScale);
                }
            };

    private Task mTask;
    private TaskThumbnailView mSnapshotView;
    private ImageView mIconView;
@@ -81,6 +96,7 @@ public class TaskView extends FrameLayout implements TaskCallbacks, SwipeDetecto
    private float mSwipeProgress;
    private Interpolator mAlphaInterpolator;
    private Interpolator mSwipeAnimInterpolator;
    private float mIconScale = 1f;

    public TaskView(Context context) {
        this(context, null);
@@ -259,4 +275,17 @@ public class TaskView extends FrameLayout implements TaskCallbacks, SwipeDetecto
        swipeAnimator.setInterpolator(mSwipeAnimInterpolator);
        swipeAnimator.start();
    }

    public void animateIconToScale(float scale) {
        ObjectAnimator.ofFloat(this, SCALE_ICON_PROPERTY, scale)
                .setDuration(SCALE_ICON_DURATION).start();
    }

    protected void setIconScale(float iconScale) {
        mIconScale = iconScale;
        if (mIconView != null) {
            mIconView.setScaleX(mIconScale);
            mIconView.setScaleY(mIconScale);
        }
    }
}