Search in sources :

Example 1 with EndState

use of com.android.launcher3.anim.PendingAnimation.EndState in project android_packages_apps_Trebuchet by LineageOS.

the class RecentsView method createTaskDismissAnimation.

public PendingAnimation createTaskDismissAnimation(TaskView taskView, boolean animateTaskView, boolean shouldRemoveTask, long duration) {
    if (mPendingAnimation != null) {
        mPendingAnimation.finish(false, Touch.SWIPE);
    }
    PendingAnimation anim = new PendingAnimation(duration);
    int count = getPageCount();
    if (count == 0) {
        return anim;
    }
    int[] oldScroll = new int[count];
    int[] newScroll = new int[count];
    getPageScrolls(oldScroll, false, SIMPLE_SCROLL_LOGIC);
    getPageScrolls(newScroll, false, (v) -> v.getVisibility() != GONE && v != taskView);
    int taskCount = getTaskViewCount();
    int scrollDiffPerPage = 0;
    if (count > 1) {
        scrollDiffPerPage = Math.abs(oldScroll[1] - oldScroll[0]);
    }
    int draggedIndex = indexOfChild(taskView);
    boolean needsCurveUpdates = false;
    for (int i = 0; i < count; i++) {
        View child = getChildAt(i);
        if (child == taskView) {
            if (animateTaskView) {
                addDismissedTaskAnimations(taskView, duration, anim);
            }
        } else {
            // If we just take newScroll - oldScroll, everything to the right of dragged task
            // translates to the left. We need to offset this in some cases:
            // - In RTL, add page offset to all pages, since we want pages to move to the right
            // Additionally, add a page offset if:
            // - Current page is rightmost page (leftmost for RTL)
            // - Dragging an adjacent page on the left side (right side for RTL)
            int offset = mIsRtl ? scrollDiffPerPage : 0;
            if (mCurrentPage == draggedIndex) {
                int lastPage = taskCount - 1;
                if (mCurrentPage == lastPage) {
                    offset += mIsRtl ? -scrollDiffPerPage : scrollDiffPerPage;
                }
            } else {
                // Dragging an adjacent page.
                // (Right in RTL, left in LTR)
                int negativeAdjacent = mCurrentPage - 1;
                if (draggedIndex == negativeAdjacent) {
                    offset += mIsRtl ? -scrollDiffPerPage : scrollDiffPerPage;
                }
            }
            int scrollDiff = newScroll[i] - oldScroll[i] + offset;
            if (scrollDiff != 0) {
                FloatProperty translationProperty = child instanceof TaskView ? ((TaskView) child).getPrimaryFillDismissGapTranslationProperty() : mOrientationHandler.getPrimaryViewTranslate();
                ResourceProvider rp = DynamicResource.provider(mActivity);
                SpringProperty sp = new SpringProperty(SpringProperty.FLAG_CAN_SPRING_ON_END).setDampingRatio(rp.getFloat(R.dimen.dismiss_task_trans_x_damping_ratio)).setStiffness(rp.getFloat(R.dimen.dismiss_task_trans_x_stiffness));
                anim.add(ObjectAnimator.ofFloat(child, translationProperty, scrollDiff).setDuration(duration), ACCEL, sp);
                needsCurveUpdates = true;
            }
        }
    }
    if (needsCurveUpdates) {
        anim.addOnFrameCallback(this::updateCurveProperties);
    }
    // Add a tiny bit of translation Z, so that it draws on top of other views
    if (animateTaskView) {
        taskView.setTranslationZ(0.1f);
    }
    mPendingAnimation = anim;
    mPendingAnimation.addEndListener(new Consumer<EndState>() {

        @Override
        public void accept(EndState endState) {
            if (ENABLE_QUICKSTEP_LIVE_TILE.get() && taskView.isRunningTask() && endState.isSuccess) {
                finishRecentsAnimation(true, /* toHome */
                () -> onEnd(endState));
            } else {
                onEnd(endState);
            }
        }

        @SuppressWarnings("WrongCall")
        private void onEnd(EndState endState) {
            if (endState.isSuccess) {
                if (shouldRemoveTask) {
                    removeTask(taskView, draggedIndex, endState);
                }
                int pageToSnapTo = mCurrentPage;
                if (draggedIndex < pageToSnapTo || pageToSnapTo == (getTaskViewCount() - 1)) {
                    pageToSnapTo -= 1;
                }
                removeViewInLayout(taskView);
                if (getTaskViewCount() == 0) {
                    removeViewInLayout(mClearAllButton);
                    startHome();
                } else {
                    snapToPageImmediately(pageToSnapTo);
                }
                // Update the layout synchronously so that the position of next view is
                // immediately available.
                onLayout(false, /*  changed */
                getLeft(), getTop(), getRight(), getBottom());
            }
            resetTaskVisuals();
            mPendingAnimation = null;
        }
    });
    return anim;
}
Also used : PendingAnimation(com.android.launcher3.anim.PendingAnimation) SpringProperty(com.android.launcher3.anim.SpringProperty) View(android.view.View) ListView(android.widget.ListView) PagedView(com.android.launcher3.PagedView) TextPaint(android.text.TextPaint) Point(android.graphics.Point) ResourceProvider(com.android.systemui.plugins.ResourceProvider) FloatProperty(android.util.FloatProperty) EndState(com.android.launcher3.anim.PendingAnimation.EndState)

Example 2 with EndState

use of com.android.launcher3.anim.PendingAnimation.EndState in project android_packages_apps_Trebuchet by LineageOS.

the class RecentsView method createTaskLaunchAnimation.

public PendingAnimation createTaskLaunchAnimation(TaskView tv, long duration, Interpolator interpolator) {
    if (FeatureFlags.IS_STUDIO_BUILD && mPendingAnimation != null) {
        throw new IllegalStateException("Another pending animation is still running");
    }
    int count = getTaskViewCount();
    if (count == 0) {
        return new PendingAnimation(duration);
    }
    int targetSysUiFlags = tv.getThumbnail().getSysUiStatusNavFlags();
    final boolean[] passedOverviewThreshold = new boolean[] { false };
    ValueAnimator progressAnim = ValueAnimator.ofFloat(0, 1);
    progressAnim.addUpdateListener(animator -> {
        // Once we pass a certain threshold, update the sysui flags to match the target
        // tasks' flags
        mActivity.getSystemUiController().updateUiState(UI_STATE_OVERVIEW, animator.getAnimatedFraction() > UPDATE_SYSUI_FLAGS_THRESHOLD ? targetSysUiFlags : 0);
        onTaskLaunchAnimationUpdate(animator.getAnimatedFraction(), tv);
        // Passing the threshold from taskview to fullscreen app will vibrate
        final boolean passed = animator.getAnimatedFraction() >= SUCCESS_TRANSITION_PROGRESS;
        if (passed != passedOverviewThreshold[0]) {
            passedOverviewThreshold[0] = passed;
            performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
        }
    });
    AnimatorSet anim = createAdjacentPageAnimForTaskLaunch(tv);
    DepthController depthController = getDepthController();
    if (depthController != null) {
        ObjectAnimator depthAnimator = ObjectAnimator.ofFloat(depthController, DEPTH, BACKGROUND_APP.getDepth(mActivity));
        anim.play(depthAnimator);
    }
    anim.play(progressAnim);
    anim.setInterpolator(interpolator);
    mPendingAnimation = new PendingAnimation(duration);
    mPendingAnimation.add(anim);
    mPendingAnimation.addEndListener((endState) -> {
        if (endState.isSuccess) {
            Consumer<Boolean> onLaunchResult = (result) -> {
                onTaskLaunchAnimationEnd(result);
                if (!result) {
                    tv.notifyTaskLaunchFailed(TAG);
                }
            };
            tv.launchTask(false, onLaunchResult, getHandler());
            Task task = tv.getTask();
            if (task != null) {
                mActivity.getUserEventDispatcher().logTaskLaunchOrDismiss(endState.logAction, Direction.DOWN, indexOfChild(tv), TaskUtils.getLaunchComponentKeyForTask(task.key));
                mActivity.getStatsLogManager().logger().withItemInfo(tv.getItemInfo()).log(LAUNCHER_TASK_LAUNCH_SWIPE_DOWN);
            }
        } else {
            onTaskLaunchAnimationEnd(false);
        }
        mPendingAnimation = null;
    });
    return mPendingAnimation;
}
Also used : BACKGROUND_APP(com.android.launcher3.LauncherState.BACKGROUND_APP) HIDDEN_NO_TASKS(com.android.quickstep.views.OverviewActionsView.HIDDEN_NO_TASKS) Overrides(com.android.launcher3.util.ResourceBasedOverride.Overrides) AccessibilityManagerCompat(com.android.launcher3.compat.AccessibilityManagerCompat) BaseActivityInterface(com.android.quickstep.BaseActivityInterface) Drawable(android.graphics.drawable.Drawable) LayoutTransition(android.animation.LayoutTransition) Handler(android.os.Handler) TAP(com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch.TAP) AnimationSuccessListener(com.android.launcher3.anim.AnimationSuccessListener) Canvas(android.graphics.Canvas) LayoutUtils(com.android.quickstep.util.LayoutUtils) AccessibilityEvent(android.view.accessibility.AccessibilityEvent) TargetApi(android.annotation.TargetApi) CLEAR_ALL_BUTTON(com.android.launcher3.userevent.nano.LauncherLogProto.ControlType.CLEAR_ALL_BUTTON) TaskVisualsChangeListener(com.android.quickstep.RecentsModel.TaskVisualsChangeListener) RecentsAnimationTargets(com.android.quickstep.RecentsAnimationTargets) HIDDEN_NO_RECENTS(com.android.quickstep.views.OverviewActionsView.HIDDEN_NO_RECENTS) Interpolator(android.view.animation.Interpolator) HIDDEN_NON_ZERO_ROTATION(com.android.quickstep.views.OverviewActionsView.HIDDEN_NON_ZERO_ROTATION) DeviceProfile(com.android.launcher3.DeviceProfile) HapticFeedbackConstants(android.view.HapticFeedbackConstants) LAUNCHER_TASK_LAUNCH_SWIPE_DOWN(com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_LAUNCH_SWIPE_DOWN) Nullable(androidx.annotation.Nullable) Layout(android.text.Layout) TextPaint(android.text.TextPaint) CurveProperties(com.android.launcher3.touch.PagedOrientationHandler.CurveProperties) LauncherLogProto(com.android.launcher3.userevent.nano.LauncherLogProto) TaskKey(com.android.systemui.shared.recents.model.Task.TaskKey) Insettable(com.android.launcher3.Insettable) EndState(com.android.launcher3.anim.PendingAnimation.EndState) Utilities.squaredTouchSlop(com.android.launcher3.Utilities.squaredTouchSlop) SystemUiProxy(com.android.quickstep.SystemUiProxy) ArrayList(java.util.ArrayList) TransformParams(com.android.quickstep.util.TransformParams) TaskUtils.checkCurrentOrManagedUserId(com.android.quickstep.TaskUtils.checkCurrentOrManagedUserId) SplitScreenBounds(com.android.quickstep.util.SplitScreenBounds) UserHandle(android.os.UserHandle) Utilities.mapToRange(com.android.launcher3.Utilities.mapToRange) DEPTH(com.android.launcher3.statehandlers.DepthController.DEPTH) MeasureSpec.makeMeasureSpec(android.view.View.MeasureSpec.makeMeasureSpec) SpringProperty(com.android.launcher3.anim.SpringProperty) ViewPool(com.android.launcher3.util.ViewPool) ViewDebug(android.view.ViewDebug) FeatureFlags(com.android.launcher3.config.FeatureFlags) DynamicResource(com.android.launcher3.util.DynamicResource) OVERVIEW_MODAL_TASK(com.android.launcher3.LauncherState.OVERVIEW_MODAL_TASK) Direction(com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction) LINEAR(com.android.launcher3.anim.Interpolators.LINEAR) SparseBooleanArray(android.util.SparseBooleanArray) R(com.android.launcher3.R) Configuration(android.content.res.Configuration) ComponentKey(com.android.launcher3.util.ComponentKey) IPinnedStackAnimationListener(com.android.systemui.shared.recents.IPinnedStackAnimationListener) ACCEL(com.android.launcher3.anim.Interpolators.ACCEL) UI_STATE_OVERVIEW(com.android.launcher3.util.SystemUiController.UI_STATE_OVERVIEW) ValueAnimator(android.animation.ValueAnimator) Rect(android.graphics.Rect) PackageManagerWrapper(com.android.systemui.shared.system.PackageManagerWrapper) PointF(android.graphics.PointF) Task(com.android.systemui.shared.recents.model.Task) FloatProperty(android.util.FloatProperty) AttributeSet(android.util.AttributeSet) ActivityManagerWrapper(com.android.systemui.shared.system.ActivityManagerWrapper) View(android.view.View) LauncherEventUtil(com.android.systemui.shared.system.LauncherEventUtil) RectF(android.graphics.RectF) Utilities(com.android.launcher3.Utilities) TransitionListener(android.animation.LayoutTransition.TransitionListener) UI_HELPER_EXECUTOR(com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR) DepthController(com.android.launcher3.statehandlers.DepthController) ObjectAnimator(android.animation.ObjectAnimator) EDGE_NAV_BAR(com.android.launcher3.Utilities.EDGE_NAV_BAR) TaskUtils(com.android.quickstep.TaskUtils) TaskStackChangeListener(com.android.systemui.shared.system.TaskStackChangeListener) ROTATION_0(android.view.Surface.ROTATION_0) ViewGroup(android.view.ViewGroup) MultiValueAlpha(com.android.launcher3.util.MultiValueAlpha) ThumbnailData(com.android.systemui.shared.recents.model.ThumbnailData) ListView(android.widget.ListView) Themes(com.android.launcher3.util.Themes) SurfaceTransactionApplier(com.android.quickstep.util.SurfaceTransactionApplier) SUCCESS_TRANSITION_PROGRESS(com.android.launcher3.uioverrides.touchcontrollers.TaskViewTouchController.SUCCESS_TRANSITION_PROGRESS) Typeface(android.graphics.Typeface) Context(android.content.Context) StaticLayout(android.text.StaticLayout) AccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo) TaskThumbnailCache(com.android.quickstep.TaskThumbnailCache) CHANGE_FLAG_ICON_PARAMS(com.android.launcher3.InvariantDeviceProfile.CHANGE_FLAG_ICON_PARAMS) KeyEvent(android.view.KeyEvent) HIDDEN_GESTURE_RUNNING(com.android.quickstep.views.OverviewActionsView.HIDDEN_GESTURE_RUNNING) RunningTaskInfo(android.app.ActivityManager.RunningTaskInfo) EXACTLY(android.view.View.MeasureSpec.EXACTLY) STATE_HANDLER_INVISIBILITY_FLAGS(com.android.launcher3.BaseActivity.STATE_HANDLER_INVISIBILITY_FLAGS) Touch(com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch) LAUNCHER_TASK_DISMISS_SWIPE_UP(com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_DISMISS_SWIPE_UP) FAST_OUT_SLOW_IN(com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN) AnimatorPlaybackController(com.android.launcher3.anim.AnimatorPlaybackController) Utilities.squaredHypot(com.android.launcher3.Utilities.squaredHypot) ENABLE_QUICKSTEP_LIVE_TILE(com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE) MotionEvent(android.view.MotionEvent) BaseActivity(com.android.launcher3.BaseActivity) AnimatorSet(android.animation.AnimatorSet) Build(android.os.Build) TaskOverlayFactory(com.android.quickstep.TaskOverlayFactory) OverScroller(com.android.launcher3.util.OverScroller) LayoutInflater(android.view.LayoutInflater) RecentsAnimationController(com.android.quickstep.RecentsAnimationController) StatefulActivity(com.android.launcher3.statemanager.StatefulActivity) Point(android.graphics.Point) ACCEL_2(com.android.launcher3.anim.Interpolators.ACCEL_2) RecentsOrientedState(com.android.quickstep.util.RecentsOrientedState) ResourceProvider(com.android.systemui.plugins.ResourceProvider) VIEW_ALPHA(com.android.launcher3.LauncherAnimUtils.VIEW_ALPHA) LauncherState(com.android.launcher3.LauncherState) Consumer(java.util.function.Consumer) InvariantDeviceProfile(com.android.launcher3.InvariantDeviceProfile) PropertyListBuilder(com.android.launcher3.anim.PropertyListBuilder) RecentsModel(com.android.quickstep.RecentsModel) PagedView(com.android.launcher3.PagedView) ACCEL_0_75(com.android.launcher3.anim.Interpolators.ACCEL_0_75) PagedOrientationHandler(com.android.launcher3.touch.PagedOrientationHandler) PendingAnimation(com.android.launcher3.anim.PendingAnimation) ViewUtils(com.android.quickstep.ViewUtils) PendingAnimation(com.android.launcher3.anim.PendingAnimation) Task(com.android.systemui.shared.recents.model.Task) ObjectAnimator(android.animation.ObjectAnimator) AnimatorSet(android.animation.AnimatorSet) ValueAnimator(android.animation.ValueAnimator) DepthController(com.android.launcher3.statehandlers.DepthController) TextPaint(android.text.TextPaint) Point(android.graphics.Point)

Example 3 with EndState

use of com.android.launcher3.anim.PendingAnimation.EndState in project android_packages_apps_Trebuchet by LineageOS.

the class RecentsView method removeTask.

private void removeTask(TaskView taskView, int index, EndState endState) {
    if (taskView.getTask() != null) {
        ActivityManagerWrapper.getInstance().removeTask(taskView.getTask().key.id);
        ComponentKey compKey = TaskUtils.getLaunchComponentKeyForTask(taskView.getTask().key);
        mActivity.getUserEventDispatcher().logTaskLaunchOrDismiss(endState.logAction, Direction.UP, index, compKey);
        mActivity.getStatsLogManager().logger().withItemInfo(taskView.getItemInfo()).log(LAUNCHER_TASK_DISMISS_SWIPE_UP);
    }
}
Also used : ComponentKey(com.android.launcher3.util.ComponentKey)

Example 4 with EndState

use of com.android.launcher3.anim.PendingAnimation.EndState in project Neo-Launcher by NeoApplications.

the class FallbackActivityControllerHelper method prepareRecentsUI.

@Override
public AnimationFactory prepareRecentsUI(RecentsActivity activity, boolean activityVisible, boolean animateActivity, Consumer<AnimatorPlaybackController> callback) {
    if (activityVisible) {
        return (transitionLength) -> {
        };
    }
    FallbackRecentsView rv = activity.getOverviewPanel();
    rv.setContentAlpha(0);
    rv.getClearAllButton().setVisibilityAlpha(0);
    rv.setDisallowScrollToClearAll(true);
    boolean fromState = !animateActivity;
    rv.setInOverviewState(fromState);
    return new AnimationFactory() {

        boolean isAnimatingToRecents = false;

        @Override
        public void onRemoteAnimationReceived(RemoteAnimationTargetSet targets) {
            isAnimatingToRecents = targets != null && targets.isAnimatingHome();
            if (!isAnimatingToRecents) {
                rv.setContentAlpha(1);
            }
            createActivityController(getSwipeUpDestinationAndLength(activity.getDeviceProfile(), activity, new Rect()));
        }

        @Override
        public void createActivityController(long transitionLength) {
            AnimatorSet animatorSet = new AnimatorSet();
            if (isAnimatingToRecents) {
                ObjectAnimator anim = ObjectAnimator.ofFloat(rv, CONTENT_ALPHA, 0, 1);
                anim.setDuration(transitionLength).setInterpolator(LINEAR);
                animatorSet.play(anim);
            }
            ObjectAnimator anim = ObjectAnimator.ofFloat(rv, ZOOM_PROGRESS, 1, 0);
            anim.setDuration(transitionLength).setInterpolator(LINEAR);
            animatorSet.play(anim);
            AnimatorPlaybackController controller = AnimatorPlaybackController.wrap(animatorSet, transitionLength);
            // Since we are changing the start position of the UI, reapply the state, at the end
            controller.setEndAction(() -> {
                boolean endState = true;
                rv.setInOverviewState(controller.getInterpolatedProgress() > 0.5 ? endState : fromState);
            });
            callback.accept(controller);
        }
    };
}
Also used : RectF(android.graphics.RectF) LauncherLogProto(com.android.launcher3.userevent.nano.LauncherLogProto) Context(android.content.Context) Rect(android.graphics.Rect) RemoteAnimationTargetCompat(com.android.systemui.shared.system.RemoteAnimationTargetCompat) CONTENT_ALPHA(com.android.quickstep.views.RecentsView.CONTENT_ALPHA) RemoteAnimationTargetSet(com.android.quickstep.util.RemoteAnimationTargetSet) NonNull(androidx.annotation.NonNull) ObjectAnimator(android.animation.ObjectAnimator) FallbackRecentsView(com.android.quickstep.fallback.FallbackRecentsView) Animator(android.animation.Animator) AnimatorPlaybackController(com.android.launcher3.anim.AnimatorPlaybackController) DeviceProfile(com.android.launcher3.DeviceProfile) Consumer(java.util.function.Consumer) LINEAR(com.android.launcher3.anim.Interpolators.LINEAR) BiPredicate(java.util.function.BiPredicate) NO_BUTTON(com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON) Nullable(androidx.annotation.Nullable) AnimatorSet(android.animation.AnimatorSet) AnimationSuccessListener(com.android.launcher3.anim.AnimationSuccessListener) RecentsView(com.android.quickstep.views.RecentsView) ZOOM_PROGRESS(com.android.quickstep.fallback.FallbackRecentsView.ZOOM_PROGRESS) LayoutUtils(com.android.quickstep.util.LayoutUtils) FallbackRecentsView(com.android.quickstep.fallback.FallbackRecentsView) Rect(android.graphics.Rect) ObjectAnimator(android.animation.ObjectAnimator) AnimatorPlaybackController(com.android.launcher3.anim.AnimatorPlaybackController) AnimatorSet(android.animation.AnimatorSet) RemoteAnimationTargetSet(com.android.quickstep.util.RemoteAnimationTargetSet)

Example 5 with EndState

use of com.android.launcher3.anim.PendingAnimation.EndState in project Neo-Launcher by NeoApplications.

the class LauncherActivityControllerHelper method playScaleDownAnim.

/**
 * Scale down recents from the center task being full screen to being in overview.
 */
private void playScaleDownAnim(AnimatorSet anim, Launcher launcher, LauncherState fromState, LauncherState endState) {
    RecentsView recentsView = launcher.getOverviewPanel();
    if (recentsView.getCurrentPageTaskView() == null) {
        return;
    }
    LauncherState.ScaleAndTranslation fromScaleAndTranslation = fromState.getOverviewScaleAndTranslation(launcher);
    LauncherState.ScaleAndTranslation endScaleAndTranslation = endState.getOverviewScaleAndTranslation(launcher);
    float fromTranslationY = fromScaleAndTranslation.translationY;
    float endTranslationY = endScaleAndTranslation.translationY;
    float fromFullscreenProgress = fromState.getOverviewFullscreenProgress();
    float endFullscreenProgress = endState.getOverviewFullscreenProgress();
    Animator scale = ObjectAnimator.ofFloat(recentsView, SCALE_PROPERTY, fromScaleAndTranslation.scale, endScaleAndTranslation.scale);
    Animator translateY = ObjectAnimator.ofFloat(recentsView, TRANSLATION_Y, fromTranslationY, endTranslationY);
    Animator applyFullscreenProgress = ObjectAnimator.ofFloat(recentsView, RecentsView.FULLSCREEN_PROGRESS, fromFullscreenProgress, endFullscreenProgress);
    anim.playTogether(scale, translateY, applyFullscreenProgress);
    mAdjustInterpolatorsRunnable = () -> {
        // Adjust the translateY interpolator to account for the running task's top inset.
        // When progress <= 1, this is handled by each task view as they set their fullscreen
        // progress. However, once we go to progress > 1, fullscreen progress stays at 0, so
        // recents as a whole needs to translate further to keep up with the app window.
        TaskView runningTaskView = recentsView.getRunningTaskView();
        if (runningTaskView == null) {
            runningTaskView = recentsView.getCurrentPageTaskView();
            if (runningTaskView == null) {
                // There are no task views in LockTask mode when Overview is enabled.
                return;
            }
        }
        TimeInterpolator oldInterpolator = translateY.getInterpolator();
        Rect fallbackInsets = launcher.getDeviceProfile().getInsets();
        float extraTranslationY = runningTaskView.getThumbnail().getInsets(fallbackInsets).top;
        float normalizedTranslationY = extraTranslationY / (fromTranslationY - endTranslationY);
        translateY.setInterpolator(t -> {
            float newT = oldInterpolator.getInterpolation(t);
            return newT <= 1f ? newT : newT + normalizedTranslationY * (newT - 1);
        });
    };
}
Also used : LauncherState(com.android.launcher3.LauncherState) TaskView(com.android.quickstep.views.TaskView) Rect(android.graphics.Rect) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) LauncherRecentsView(com.android.quickstep.views.LauncherRecentsView) RecentsView(com.android.quickstep.views.RecentsView) TimeInterpolator(android.animation.TimeInterpolator)

Aggregations

AnimatorSet (android.animation.AnimatorSet)3 ObjectAnimator (android.animation.ObjectAnimator)3 Point (android.graphics.Point)3 Rect (android.graphics.Rect)3 TextPaint (android.text.TextPaint)3 LauncherState (com.android.launcher3.LauncherState)3 AnimatorPlaybackController (com.android.launcher3.anim.AnimatorPlaybackController)3 PendingAnimation (com.android.launcher3.anim.PendingAnimation)3 Animator (android.animation.Animator)2 Context (android.content.Context)2 RectF (android.graphics.RectF)2 FloatProperty (android.util.FloatProperty)2 View (android.view.View)2 ListView (android.widget.ListView)2 Nullable (androidx.annotation.Nullable)2 DeviceProfile (com.android.launcher3.DeviceProfile)2 PagedView (com.android.launcher3.PagedView)2 AnimationSuccessListener (com.android.launcher3.anim.AnimationSuccessListener)2 LINEAR (com.android.launcher3.anim.Interpolators.LINEAR)2 EndState (com.android.launcher3.anim.PendingAnimation.EndState)2