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

Commit faa44330 authored by Lucas Dupin's avatar Lucas Dupin Committed by Jorim Jaggi
Browse files

Rounded corners on app transitions

Test: Manualy launch an app
Test: Press home when activity is on top of the stack
Test: Quick scrub
Test: Swipe up on the home button, swipe down
Bug: 111514493
Fixes: 116745318
Change-Id: I66d25bc433061ede46107ea9651c198614306692
parent 1216ed94
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@
    <dimen name="task_thumbnail_top_margin">24dp</dimen>
    <dimen name="task_thumbnail_half_top_margin">12dp</dimen>
    <dimen name="task_thumbnail_icon_size">48dp</dimen>
    <dimen name="task_corner_radius">2dp</dimen>
    <dimen name="task_corner_radius">8dp</dimen>
    <dimen name="recents_page_spacing">10dp</dimen>
    <dimen name="recents_clear_all_deadzone_vertical_margin">70dp</dimen>
    <dimen name="quickscrub_adjacent_visible_width">20dp</dimen>
+22 −5
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ import com.android.launcher3.graphics.DrawableFactory;
import com.android.launcher3.shortcuts.DeepShortcutView;
import com.android.launcher3.util.MultiValueAlpha;
import com.android.launcher3.util.MultiValueAlpha.AlphaProperty;
import com.android.quickstep.RecentsModel;
import com.android.quickstep.util.ClipAnimationHelper;
import com.android.quickstep.util.MultiValueUpdateListener;
import com.android.quickstep.util.RemoteAnimationProvider;
@@ -286,7 +287,7 @@ public class LauncherAppTransitionManagerImpl extends LauncherAppTransitionManag
                ? RECENTS_QUICKSCRUB_LAUNCH_DURATION
                : RECENTS_LAUNCH_DURATION;

        ClipAnimationHelper helper = new ClipAnimationHelper();
        ClipAnimationHelper helper = new ClipAnimationHelper(mLauncher);
        target.play(getRecentsWindowAnimator(taskView, skipLauncherChanges, targets, helper)
                .setDuration(duration));

@@ -605,6 +606,13 @@ public class LauncherAppTransitionManagerImpl extends LauncherAppTransitionManag
                float transX0 = floatingViewBounds[0] - offsetX;
                float transY0 = floatingViewBounds[1] - offsetY;

                // Animate window corner radius from 100% to windowCornerRadius.
                float windowCornerRadius = RecentsModel.INSTANCE.get(mLauncher)
                        .getWindowCornerRadius();
                float circleRadius = scaledWindowWidth / 2f;
                float windowRadius = Utilities.mapRange(easePercent, circleRadius,
                        windowCornerRadius);

                // Animate the window crop so that it starts off as a square, and then reveals
                // horizontally.
                float cropHeight = windowHeight * easePercent + windowWidth * (1 - easePercent);
@@ -619,20 +627,24 @@ public class LauncherAppTransitionManagerImpl extends LauncherAppTransitionManag
                    RemoteAnimationTargetCompat target = targets[i];

                    Rect targetCrop;
                    float alpha;
                    final float alpha;
                    final float cornerRadius;
                    if (target.mode == MODE_OPENING) {
                        matrix.setScale(scale, scale);
                        matrix.postTranslate(transX0, transY0);
                        targetCrop = crop;
                        alpha = mAlpha.value;
                        cornerRadius = windowRadius;
                    } else {
                        matrix.setTranslate(target.position.x, target.position.y);
                        alpha = 1f;
                        targetCrop = target.sourceContainerBounds;
                        cornerRadius = 0;
                    }

                    params[i] = new SurfaceParams(target.leash, alpha, matrix, targetCrop,
                            RemoteAnimationProvider.getLayer(target, MODE_OPENING));
                            RemoteAnimationProvider.getLayer(target, MODE_OPENING),
                            cornerRadius);
                }
                surfaceApplier.scheduleApply(params);
            }
@@ -724,6 +736,7 @@ public class LauncherAppTransitionManagerImpl extends LauncherAppTransitionManag
        Matrix matrix = new Matrix();
        ValueAnimator closingAnimator = ValueAnimator.ofFloat(0, 1);
        int duration = CLOSING_TRANSITION_DURATION_MS;
        float windowCornerRadius = RecentsModel.INSTANCE.get(mLauncher).getWindowCornerRadius();
        closingAnimator.setDuration(duration);
        closingAnimator.addUpdateListener(new MultiValueUpdateListener() {
            FloatProp mDy = new FloatProp(0, mClosingWindowTransY, 0, duration, DEACCEL_1_7);
@@ -735,7 +748,8 @@ public class LauncherAppTransitionManagerImpl extends LauncherAppTransitionManag
                SurfaceParams[] params = new SurfaceParams[targets.length];
                for (int i = targets.length - 1; i >= 0; i--) {
                    RemoteAnimationTargetCompat target = targets[i];
                    float alpha;
                    final float alpha;
                    final float cornerRadius;
                    if (target.mode == MODE_CLOSING) {
                        matrix.setScale(mScale.value, mScale.value,
                                target.sourceContainerBounds.centerX(),
@@ -743,13 +757,16 @@ public class LauncherAppTransitionManagerImpl extends LauncherAppTransitionManag
                        matrix.postTranslate(0, mDy.value);
                        matrix.postTranslate(target.position.x, target.position.y);
                        alpha = mAlpha.value;
                        cornerRadius = windowCornerRadius;
                    } else {
                        matrix.setTranslate(target.position.x, target.position.y);
                        alpha = 1f;
                        cornerRadius = 0f;
                    }
                    params[i] = new SurfaceParams(target.leash, alpha, matrix,
                            target.sourceContainerBounds,
                            RemoteAnimationProvider.getLayer(target, MODE_CLOSING));
                            RemoteAnimationProvider.getLayer(target, MODE_CLOSING),
                            cornerRadius);
                }
                surfaceApplier.scheduleApply(params);
            }
+1 −1
Original line number Diff line number Diff line
@@ -319,7 +319,7 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
            float prevRvScale = recentsView.getScaleX();
            float targetRvScale = endState.getOverviewScaleAndTranslationYFactor(launcher)[0];
            SCALE_PROPERTY.set(recentsView, targetRvScale);
            ClipAnimationHelper clipHelper = new ClipAnimationHelper();
            ClipAnimationHelper clipHelper = new ClipAnimationHelper(launcher);
            clipHelper.fromTaskThumbnailView(v.getThumbnail(), (RecentsView) v.getParent(), null);
            SCALE_PROPERTY.set(recentsView, prevRvScale);

+1 −1
Original line number Diff line number Diff line
@@ -326,7 +326,7 @@ public class OverviewCommandHelper {
                return anim;
            }

            final ClipAnimationHelper clipHelper = new ClipAnimationHelper();
            final ClipAnimationHelper clipHelper = new ClipAnimationHelper(mActivity);

            // At this point, the activity is already started and laid-out. Get the home-bounds
            // relative to the screen using the rootView of the activity.
+1 −1
Original line number Diff line number Diff line
@@ -189,7 +189,7 @@ public class RecentsActivity extends BaseDraggingActivity {
            RemoteAnimationTargetCompat[] targets) {
        AnimatorSet target = new AnimatorSet();
        boolean activityClosing = taskIsATargetWithMode(targets, getTaskId(), MODE_CLOSING);
        ClipAnimationHelper helper = new ClipAnimationHelper();
        ClipAnimationHelper helper = new ClipAnimationHelper(this);
        target.play(getRecentsWindowAnimator(taskView, !activityClosing, targets, helper)
                .setDuration(RECENTS_LAUNCH_DURATION));

Loading