Search in sources :

Example 11 with Overview

use of com.android.launcher3.tapl.Overview in project android_packages_apps_Launcher3 by crdroidandroid.

the class TaplTestsQuickstep method testOverview.

@Test
@PortraitLandscape
public void testOverview() throws Exception {
    startTestAppsWithCheck();
    // mLauncher.pressHome() also tests an important case of pressing home while in background.
    Overview overview = mLauncher.pressHome().switchToOverview();
    assertTrue("Launcher internal state didn't switch to Overview", isInState(() -> LauncherState.OVERVIEW));
    executeOnLauncher(launcher -> assertTrue("Don't have at least 3 tasks", getTaskCount(launcher) >= 3));
    // Test flinging forward and backward.
    executeOnLauncher(launcher -> assertEquals("Current task in Overview is not 0", 0, getCurrentOverviewPage(launcher)));
    overview.flingForward();
    assertTrue("Launcher internal state is not Overview", isInState(() -> LauncherState.OVERVIEW));
    final Integer currentTaskAfterFlingForward = getFromLauncher(launcher -> getCurrentOverviewPage(launcher));
    executeOnLauncher(launcher -> assertTrue("Current task in Overview is still 0", currentTaskAfterFlingForward > 0));
    overview.flingBackward();
    assertTrue("Launcher internal state is not Overview", isInState(() -> LauncherState.OVERVIEW));
    executeOnLauncher(launcher -> assertTrue("Flinging back in Overview did nothing", getCurrentOverviewPage(launcher) < currentTaskAfterFlingForward));
    // Test opening a task.
    OverviewTask task = mLauncher.pressHome().switchToOverview().getCurrentTask();
    assertNotNull("overview.getCurrentTask() returned null (1)", task);
    assertNotNull("OverviewTask.open returned null", task.open());
    assertTrue("Test activity didn't open from Overview", mDevice.wait(Until.hasObject(By.pkg(getAppPackageName()).text("TestActivity2")), DEFAULT_UI_TIMEOUT));
    executeOnLauncher(launcher -> assertTrue("Launcher activity is the top activity; expecting another activity to be the top " + "one", isInBackground(launcher)));
    // Test dismissing a task.
    overview = mLauncher.pressHome().switchToOverview();
    assertTrue("Launcher internal state didn't switch to Overview", isInState(() -> LauncherState.OVERVIEW));
    final Integer numTasks = getFromLauncher(launcher -> getTaskCount(launcher));
    task = overview.getCurrentTask();
    assertNotNull("overview.getCurrentTask() returned null (2)", task);
    task.dismiss();
    executeOnLauncher(launcher -> assertEquals("Dismissing a task didn't remove 1 task from Overview", numTasks - 1, getTaskCount(launcher)));
    // Test UIDevice.pressHome, once we are in AllApps.
    mDevice.pressHome();
    waitForState("Launcher internal state didn't switch to Home", () -> LauncherState.NORMAL);
    // Test dismissing all tasks.
    mLauncher.getWorkspace().switchToOverview().dismissAllTasks();
    waitForState("Launcher internal state didn't switch to Home", () -> LauncherState.NORMAL);
    executeOnLauncher(launcher -> assertEquals("Still have tasks after dismissing all", 0, getTaskCount(launcher)));
}
Also used : OverviewTask(com.android.launcher3.tapl.OverviewTask) Overview(com.android.launcher3.tapl.Overview) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test)

Example 12 with Overview

use of com.android.launcher3.tapl.Overview in project android_packages_apps_Launcher3 by crdroidandroid.

the class RecentsView method updateGridProperties.

/**
 * Updates TaskView and ClearAllButton scaling and translation required to turn into grid
 * layout.
 * This method only calculates the potential position and depends on {@link #setGridProgress} to
 * apply the actual scaling and translation.
 *
 * @param isTaskDismissal indicates if update was called due to task dismissal
 */
private void updateGridProperties(boolean isTaskDismissal) {
    int taskCount = getTaskViewCount();
    if (taskCount == 0) {
        return;
    }
    final int boxLength = Math.max(mLastComputedGridTaskSize.width(), mLastComputedGridTaskSize.height());
    int taskTopMargin = mActivity.getDeviceProfile().overviewTaskThumbnailTopMarginPx;
    /*
         * taskGridVerticalDiff is used to position the top of a task in the top row of the grid
         * heightOffset is the vertical space one grid task takes + space between top and
         *   bottom row
         * Summed together they provide the top position for bottom row of grid tasks
         */
    final float taskGridVerticalDiff = mLastComputedGridTaskSize.top - mLastComputedTaskSize.top;
    final float heightOffset = (boxLength + taskTopMargin) + mRowSpacing;
    int topRowWidth = 0;
    int bottomRowWidth = 0;
    float topAccumulatedTranslationX = 0;
    float bottomAccumulatedTranslationX = 0;
    // Contains whether the child index is in top or bottom of grid (for non-focused task)
    // Different from mTopRowIdSet, which contains the taskId of what task is in top row
    IntSet topSet = new IntSet();
    IntSet bottomSet = new IntSet();
    // Horizontal grid translation for each task
    float[] gridTranslations = new float[taskCount];
    int focusedTaskIndex = Integer.MAX_VALUE;
    int focusedTaskShift = 0;
    int focusedTaskWidthAndSpacing = 0;
    int snappedTaskRowWidth = 0;
    int snappedPage = getNextPage();
    TaskView snappedTaskView = getTaskViewAtByAbsoluteIndex(snappedPage);
    if (!isTaskDismissal) {
        mTopRowIdSet.clear();
    }
    for (int i = 0; i < taskCount; i++) {
        TaskView taskView = getTaskViewAt(i);
        int taskWidthAndSpacing = taskView.getLayoutParams().width + mPageSpacing;
        // the grid.
        if (taskView.isFocusedTask()) {
            topRowWidth += taskWidthAndSpacing;
            bottomRowWidth += taskWidthAndSpacing;
            focusedTaskIndex = i;
            focusedTaskWidthAndSpacing = taskWidthAndSpacing;
            gridTranslations[i] += focusedTaskShift;
            gridTranslations[i] += mIsRtl ? taskWidthAndSpacing : -taskWidthAndSpacing;
            // Center view vertically in case it's from different orientation.
            taskView.setGridTranslationY((mLastComputedTaskSize.height() + taskTopMargin - taskView.getLayoutParams().height) / 2f);
            if (taskView == snappedTaskView) {
                // If focused task is snapped, the row width is just task width and spacing.
                snappedTaskRowWidth = taskWidthAndSpacing;
            }
        } else {
            if (i > focusedTaskIndex) {
                // For tasks after the focused task, shift by focused task's width and spacing.
                gridTranslations[i] += mIsRtl ? focusedTaskWidthAndSpacing : -focusedTaskWidthAndSpacing;
            } else {
                // For task before the focused task, accumulate the width and spacing to
                // calculate the distance focused task need to shift.
                focusedTaskShift += mIsRtl ? taskWidthAndSpacing : -taskWidthAndSpacing;
            }
            int taskId = taskView.getTask().key.id;
            boolean isTopRow = isTaskDismissal ? mTopRowIdSet.contains(taskId) : topRowWidth <= bottomRowWidth;
            if (isTopRow) {
                topRowWidth += taskWidthAndSpacing;
                topSet.add(i);
                mTopRowIdSet.add(taskId);
                taskView.setGridTranslationY(taskGridVerticalDiff);
                // Move horizontally into empty space.
                float widthOffset = 0;
                for (int j = i - 1; !topSet.contains(j) && j >= 0; j--) {
                    if (j == focusedTaskIndex) {
                        continue;
                    }
                    widthOffset += getTaskViewAt(j).getLayoutParams().width + mPageSpacing;
                }
                float currentTaskTranslationX = mIsRtl ? widthOffset : -widthOffset;
                gridTranslations[i] += topAccumulatedTranslationX + currentTaskTranslationX;
                topAccumulatedTranslationX += currentTaskTranslationX;
            } else {
                bottomRowWidth += taskWidthAndSpacing;
                bottomSet.add(i);
                // Move into bottom row.
                taskView.setGridTranslationY(heightOffset + taskGridVerticalDiff);
                // Move horizontally into empty space.
                float widthOffset = 0;
                for (int j = i - 1; !bottomSet.contains(j) && j >= 0; j--) {
                    if (j == focusedTaskIndex) {
                        continue;
                    }
                    widthOffset += getTaskViewAt(j).getLayoutParams().width + mPageSpacing;
                }
                float currentTaskTranslationX = mIsRtl ? widthOffset : -widthOffset;
                gridTranslations[i] += bottomAccumulatedTranslationX + currentTaskTranslationX;
                bottomAccumulatedTranslationX += currentTaskTranslationX;
            }
            if (taskView == snappedTaskView) {
                snappedTaskRowWidth = isTopRow ? topRowWidth : bottomRowWidth;
            }
        }
    }
    // We need to maintain snapped task's page scroll invariant between quick switch and
    // overview, so we sure snapped task's grid translation is 0, and add a non-fullscreen
    // translationX that is the same as snapped task's full scroll adjustment.
    float snappedTaskFullscreenScrollAdjustment = 0;
    float snappedTaskGridTranslationX = 0;
    if (snappedTaskView != null) {
        snappedTaskFullscreenScrollAdjustment = snappedTaskView.getScrollAdjustment(/*fullscreenEnabled=*/
        true, /*gridEnabled=*/
        false);
        snappedTaskGridTranslationX = gridTranslations[snappedPage - mTaskViewStartIndex];
    }
    for (int i = 0; i < taskCount; i++) {
        TaskView taskView = getTaskViewAt(i);
        taskView.setGridTranslationX(gridTranslations[i] - snappedTaskGridTranslationX);
        taskView.getPrimaryNonFullscreenTranslationProperty().set(taskView, snappedTaskFullscreenScrollAdjustment);
        taskView.getSecondaryNonFullscreenTranslationProperty().set(taskView, 0f);
    }
    // Use the accumulated translation of the row containing the last task.
    float clearAllAccumulatedTranslation = topSet.contains(taskCount - 1) ? topAccumulatedTranslationX : bottomAccumulatedTranslationX;
    // If the last task is on the shorter row, ClearAllButton will embed into the shorter row
    // which is not what we want. Compensate the width difference of the 2 rows in that case.
    float shorterRowCompensation = 0;
    if (topRowWidth <= bottomRowWidth) {
        if (topSet.contains(taskCount - 1)) {
            shorterRowCompensation = bottomRowWidth - topRowWidth;
        }
    } else {
        if (bottomSet.contains(taskCount - 1)) {
            shorterRowCompensation = topRowWidth - bottomRowWidth;
        }
    }
    float clearAllShorterRowCompensation = mIsRtl ? -shorterRowCompensation : shorterRowCompensation;
    // If the total width is shorter than one grid's width, move ClearAllButton further away
    // accordingly. Update longRowWidth if ClearAllButton has been moved.
    float clearAllShortTotalCompensation = 0;
    int longRowWidth = Math.max(topRowWidth, bottomRowWidth);
    if (longRowWidth < mLastComputedGridSize.width()) {
        float shortTotalCompensation = mLastComputedGridSize.width() - longRowWidth;
        clearAllShortTotalCompensation = mIsRtl ? -shortTotalCompensation : shortTotalCompensation;
        longRowWidth = mLastComputedGridSize.width();
    }
    float clearAllTotalTranslationX = clearAllAccumulatedTranslation + clearAllShorterRowCompensation + clearAllShortTotalCompensation + snappedTaskFullscreenScrollAdjustment;
    if (focusedTaskIndex < taskCount) {
        // Shift by focused task's width and spacing if a task is focused.
        clearAllTotalTranslationX += mIsRtl ? focusedTaskWidthAndSpacing : -focusedTaskWidthAndSpacing;
    }
    // of swiping up after quick switch.
    if (snappedTaskView != null) {
        int distanceFromClearAll = longRowWidth - snappedTaskRowWidth;
        int minimumDistance = mLastComputedGridSize.width() - snappedTaskView.getLayoutParams().width;
        if (distanceFromClearAll < minimumDistance) {
            int distanceDifference = minimumDistance - distanceFromClearAll;
            clearAllTotalTranslationX += mIsRtl ? -distanceDifference : distanceDifference;
        }
    }
    setGridProgress(mGridProgress);
}
Also used : IntSet(com.android.launcher3.util.IntSet) TextPaint(android.text.TextPaint) Point(android.graphics.Point)

Example 13 with Overview

use of com.android.launcher3.tapl.Overview in project android_packages_apps_Launcher3 by crdroidandroid.

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);
    }
    // When swiping down from overview to tasks, ensures the snapped page's scroll maintain
    // invariant between quick switch and overview, to ensure a smooth animation transition.
    updateGridProperties();
    updateScrollSynchronously();
    int targetSysUiFlags = tv.getThumbnail().getSysUiStatusNavFlags();
    final boolean[] passedOverviewThreshold = new boolean[] { false };
    ValueAnimator progressAnim = ValueAnimator.ofFloat(0, 1);
    progressAnim.addUpdateListener(animator -> {
        // tasks' flags
        if (animator.getAnimatedFraction() > UPDATE_SYSUI_FLAGS_THRESHOLD) {
            mActivity.getSystemUiController().updateUiState(UI_STATE_FULLSCREEN_TASK, targetSysUiFlags);
        } else {
            mActivity.getSystemUiController().updateUiState(UI_STATE_FULLSCREEN_TASK, 0);
        }
        // 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);
    if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
        mLiveTileTaskViewSimulator.addOverviewToAppAnim(mPendingAnimation, interpolator);
        mPendingAnimation.addOnFrameCallback(this::redrawLiveTile);
    }
    mPendingAnimation.addEndListener(isSuccess -> {
        if (isSuccess) {
            if (ENABLE_QUICKSTEP_LIVE_TILE.get() && tv.isRunningTask()) {
                finishRecentsAnimation(false, /* toRecents */
                null);
                onTaskLaunchAnimationEnd(true);
            } else {
                tv.launchTask(this::onTaskLaunchAnimationEnd);
            }
            Task task = tv.getTask();
            if (task != null) {
                mActivity.getStatsLogManager().logger().withItemInfo(tv.getItemInfo()).log(LAUNCHER_TASK_LAUNCH_SWIPE_DOWN);
            }
        } else {
            onTaskLaunchAnimationEnd(false);
        }
        mPendingAnimation = null;
    });
    return mPendingAnimation;
}
Also used : 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 14 with Overview

use of com.android.launcher3.tapl.Overview in project android_packages_apps_Launcher3 by crdroidandroid.

the class TaskView method onTaskListVisibilityChanged.

/**
 * See {@link TaskDataChanges}
 * @param visible If this task view will be visible to the user in overview or hidden
 */
public void onTaskListVisibilityChanged(boolean visible, @TaskDataChanges int changes) {
    if (mTask == null) {
        return;
    }
    cancelPendingLoadTasks();
    if (visible) {
        // These calls are no-ops if the data is already loaded, try and load the high
        // resolution thumbnail if the state permits
        RecentsModel model = RecentsModel.INSTANCE.get(getContext());
        TaskThumbnailCache thumbnailCache = model.getThumbnailCache();
        TaskIconCache iconCache = model.getIconCache();
        if (needsUpdate(changes, FLAG_UPDATE_THUMBNAIL)) {
            mThumbnailLoadRequest = thumbnailCache.updateThumbnailInBackground(mTask, thumbnail -> {
                mSnapshotView.setThumbnail(mTask, thumbnail);
            });
        }
        if (needsUpdate(changes, FLAG_UPDATE_ICON)) {
            mIconLoadRequest = iconCache.updateIconInBackground(mTask, (task) -> {
                setIcon(task.icon);
                mDigitalWellBeingToast.initialize(mTask);
            });
        }
    } else {
        if (needsUpdate(changes, FLAG_UPDATE_THUMBNAIL)) {
            mSnapshotView.setThumbnail(null, null);
            // Reset the task thumbnail reference as well (it will be fetched from the cache or
            // reloaded next time we need it)
            mTask.thumbnail = null;
        }
        if (needsUpdate(changes, FLAG_UPDATE_ICON)) {
            setIcon(null);
        }
    }
}
Also used : Rect(android.graphics.Rect) Task(com.android.systemui.shared.recents.model.Task) Bundle(android.os.Bundle) Utilities.getDescendantCoordRelativeToAncestor(com.android.launcher3.Utilities.getDescendantCoordRelativeToAncestor) NonNull(androidx.annotation.NonNull) TestProtocol(com.android.launcher3.testing.TestProtocol) FrameLayout(android.widget.FrameLayout) END(android.view.Gravity.END) Animator(android.animation.Animator) LauncherSettings(com.android.launcher3.LauncherSettings) SplitPositionOption(com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption) Drawable(android.graphics.drawable.Drawable) TouchDelegate(android.view.TouchDelegate) FloatProperty(android.util.FloatProperty) TOP(android.view.Gravity.TOP) ActivityOptions(android.app.ActivityOptions) AttributeSet(android.util.AttributeSet) ActivityManagerWrapper(com.android.systemui.shared.system.ActivityManagerWrapper) Interpolators(com.android.launcher3.anim.Interpolators) TaskViewUtils(com.android.quickstep.TaskViewUtils) START(android.view.Gravity.START) ROTATION_270(android.view.Surface.ROTATION_270) MAIN_EXECUTOR(com.android.launcher3.util.Executors.MAIN_EXECUTOR) View(android.view.View) TransformingTouchDelegate(com.android.launcher3.util.TransformingTouchDelegate) Log(android.util.Log) RectF(android.graphics.RectF) Utilities(com.android.launcher3.Utilities) UI_HELPER_EXECUTOR(com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR) Surface(android.view.Surface) Interpolator(android.view.animation.Interpolator) ObjectAnimator(android.animation.ObjectAnimator) LAUNCHER_TASK_LAUNCH_TAP(com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_LAUNCH_TAP) TaskUtils(com.android.quickstep.TaskUtils) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ViewGroup(android.view.ViewGroup) DeviceProfile(com.android.launcher3.DeviceProfile) Outline(android.graphics.Outline) List(java.util.List) CancellableTask(com.android.quickstep.util.CancellableTask) CENTER_VERTICAL(android.view.Gravity.CENTER_VERTICAL) TYPE_TASK_MENU(com.android.launcher3.AbstractFloatingView.TYPE_TASK_MENU) ROTATION_180(android.view.Surface.ROTATION_180) ACCEL_DEACCEL(com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL) ActivityOptionsCompat(com.android.systemui.shared.system.ActivityOptionsCompat) Context(android.content.Context) AccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo) TaskThumbnailCache(com.android.quickstep.TaskThumbnailCache) ROTATION_90(android.view.Surface.ROTATION_90) ViewOutlineProvider(android.view.ViewOutlineProvider) QuickStepContract(com.android.systemui.shared.system.QuickStepContract) Intent(android.content.Intent) SystemUiProxy(com.android.quickstep.SystemUiProxy) IntDef(androidx.annotation.IntDef) BOTTOM(android.view.Gravity.BOTTOM) FAST_OUT_SLOW_IN(com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN) RemoteAnimationTargets(com.android.quickstep.RemoteAnimationTargets) Retention(java.lang.annotation.Retention) Utilities.comp(com.android.launcher3.Utilities.comp) ENABLE_QUICKSTEP_LIVE_TILE(com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE) MotionEvent(android.view.MotionEvent) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo) Toast(android.widget.Toast) AnimatorSet(android.animation.AnimatorSet) ActivityOptionsWrapper(com.android.launcher3.util.ActivityOptionsWrapper) TaskOverlayFactory(com.android.quickstep.TaskOverlayFactory) SystemShortcut(com.android.launcher3.popup.SystemShortcut) TaskCornerRadius(com.android.quickstep.util.TaskCornerRadius) Reusable(com.android.launcher3.util.ViewPool.Reusable) StatefulActivity(com.android.launcher3.statemanager.StatefulActivity) TaskIconCache(com.android.quickstep.TaskIconCache) FeatureFlags(com.android.launcher3.config.FeatureFlags) RecentsOrientedState(com.android.quickstep.util.RecentsOrientedState) Consumer(java.util.function.Consumer) LINEAR(com.android.launcher3.anim.Interpolators.LINEAR) OVERVIEW_SPLIT_SELECT(com.android.launcher3.LauncherState.OVERVIEW_SPLIT_SELECT) PreviewPositionHelper(com.android.quickstep.views.TaskThumbnailView.PreviewPositionHelper) R(com.android.launcher3.R) TestLogging(com.android.launcher3.testing.TestLogging) RecentsModel(com.android.quickstep.RecentsModel) CENTER_HORIZONTAL(android.view.Gravity.CENTER_HORIZONTAL) ComponentKey(com.android.launcher3.util.ComponentKey) SOURCE(java.lang.annotation.RetentionPolicy.SOURCE) LAUNCHER_TASK_ICON_TAP_OR_LONGPRESS(com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_ICON_TAP_OR_LONGPRESS) AbstractFloatingView(com.android.launcher3.AbstractFloatingView) PagedOrientationHandler(com.android.launcher3.touch.PagedOrientationHandler) RunnableList(com.android.launcher3.util.RunnableList) Collections(java.util.Collections) LENGTH_SHORT(android.widget.Toast.LENGTH_SHORT) RecentsModel(com.android.quickstep.RecentsModel) TaskThumbnailCache(com.android.quickstep.TaskThumbnailCache) TaskIconCache(com.android.quickstep.TaskIconCache)

Example 15 with Overview

use of com.android.launcher3.tapl.Overview in project android_packages_apps_Launcher3 by crdroidandroid.

the class ItemLongClickListener method onAllAppsItemLongClick.

private static boolean onAllAppsItemLongClick(View v) {
    TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "onAllAppsItemLongClick");
    v.cancelLongPress();
    Launcher launcher = Launcher.getLauncher(v.getContext());
    if (!canStartDrag(launcher))
        return false;
    // When we have exited all apps or are in transition, disregard long clicks
    if (!launcher.isInState(ALL_APPS) && !launcher.isInState(OVERVIEW))
        return false;
    if (launcher.getWorkspace().isSwitchingState())
        return false;
    StatsLogger logger = launcher.getStatsLogManager().logger();
    if (v.getTag() instanceof ItemInfo) {
        logger.withItemInfo((ItemInfo) v.getTag());
    }
    logger.log(LAUNCHER_ALLAPPS_ITEM_LONG_PRESSED);
    // Start the drag
    final DragController dragController = launcher.getDragController();
    dragController.addDragListener(new DragController.DragListener() {

        @Override
        public void onDragStart(DropTarget.DragObject dragObject, DragOptions options) {
            v.setVisibility(INVISIBLE);
        }

        @Override
        public void onDragEnd() {
            v.setVisibility(VISIBLE);
            dragController.removeDragListener(this);
        }
    });
    DeviceProfile grid = launcher.getDeviceProfile();
    DragOptions options = new DragOptions();
    options.intrinsicIconScaleFactor = (float) grid.allAppsIconSizePx / grid.iconSizePx;
    launcher.getWorkspace().beginDragShared(v, launcher.getAppsView(), options);
    return false;
}
Also used : DragOptions(com.android.launcher3.dragndrop.DragOptions) DeviceProfile(com.android.launcher3.DeviceProfile) StatsLogger(com.android.launcher3.logging.StatsLogManager.StatsLogger) ItemInfo(com.android.launcher3.model.data.ItemInfo) DragController(com.android.launcher3.dragndrop.DragController) Launcher(com.android.launcher3.Launcher) DropTarget(com.android.launcher3.DropTarget)

Aggregations

LauncherState (com.android.launcher3.LauncherState)53 Animator (android.animation.Animator)50 ValueAnimator (android.animation.ValueAnimator)42 StateAnimationConfig (com.android.launcher3.states.StateAnimationConfig)41 RecentsView (com.android.quickstep.views.RecentsView)40 AnimatorSet (android.animation.AnimatorSet)38 Launcher (com.android.launcher3.Launcher)36 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)34 ObjectAnimator (android.animation.ObjectAnimator)30 LargeTest (androidx.test.filters.LargeTest)29 Test (org.junit.Test)29 Point (android.graphics.Point)24 View (android.view.View)22 DeviceProfile (com.android.launcher3.DeviceProfile)19 PendingAnimation (com.android.launcher3.anim.PendingAnimation)19 RemoteAnimationTargetCompat (com.android.systemui.shared.system.RemoteAnimationTargetCompat)19 ItemInfo (com.android.launcher3.model.data.ItemInfo)18 DepthController (com.android.launcher3.statehandlers.DepthController)17 Task (com.android.systemui.shared.recents.model.Task)17 Rect (android.graphics.Rect)16