Search in sources :

Example 66 with Launcher

use of com.android.launcher3.Launcher in project android_packages_apps_Launcher3 by AOSPA.

the class ItemLongClickListener method beginDrag.

public static void beginDrag(View v, Launcher launcher, ItemInfo info, DragOptions dragOptions) {
    if (info.container >= 0) {
        Folder folder = Folder.getOpen(launcher);
        if (folder != null) {
            if (!folder.getIconsInReadingOrder().contains(v)) {
                folder.close(true);
            } else {
                folder.startDrag(v, dragOptions);
                return;
            }
        }
    }
    CellLayout.CellInfo longClickCellInfo = new CellLayout.CellInfo(v, info);
    launcher.getWorkspace().startDrag(longClickCellInfo, dragOptions);
}
Also used : CellLayout(com.android.launcher3.CellLayout) Folder(com.android.launcher3.folder.Folder)

Example 67 with Launcher

use of com.android.launcher3.Launcher in project android_packages_apps_Launcher3 by AOSPA.

the class QuickstepTransitionManager method getBackgroundAnimator.

/**
 * Returns animator that controls depth/blur of the background.
 */
private ObjectAnimator getBackgroundAnimator() {
    // When launching an app from overview that doesn't map to a task, we still want to just
    // blur the wallpaper instead of the launcher surface as well
    boolean allowBlurringLauncher = mLauncher.getStateManager().getState() != OVERVIEW;
    DepthController depthController = mLauncher.getDepthController();
    ObjectAnimator backgroundRadiusAnim = ObjectAnimator.ofFloat(depthController, DEPTH, BACKGROUND_APP.getDepth(mLauncher)).setDuration(APP_LAUNCH_DURATION);
    if (allowBlurringLauncher) {
        final SurfaceControl dimLayer;
        if (BlurUtils.supportsBlursOnWindows()) {
            // Create a temporary effect layer, that lives on top of launcher, so we can apply
            // the blur to it. The EffectLayer will be fullscreen, which will help with caching
            // optimizations on the SurfaceFlinger side:
            // - Results would be able to be cached as a texture
            // - There won't be texture allocation overhead, because EffectLayers don't have
            // buffers
            ViewRootImpl viewRootImpl = mLauncher.getDragLayer().getViewRootImpl();
            SurfaceControl parent = viewRootImpl != null ? viewRootImpl.getSurfaceControl() : null;
            dimLayer = new SurfaceControl.Builder().setName("Blur layer").setParent(parent).setOpaque(false).setHidden(false).setEffectLayer().build();
        } else {
            dimLayer = null;
        }
        depthController.setSurface(dimLayer);
        backgroundRadiusAnim.addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationStart(Animator animation) {
                depthController.setIsInLaunchTransition(true);
            }

            @Override
            public void onAnimationEnd(Animator animation) {
                depthController.setIsInLaunchTransition(false);
                depthController.setSurface(null);
                if (dimLayer != null) {
                    new SurfaceControl.Transaction().remove(dimLayer).apply();
                }
            }
        });
    }
    return backgroundRadiusAnim;
}
Also used : ViewRootImpl(android.view.ViewRootImpl) ValueAnimator(android.animation.ValueAnimator) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ObjectAnimator(android.animation.ObjectAnimator) SurfaceControl(android.view.SurfaceControl) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) DepthController(com.android.launcher3.statehandlers.DepthController)

Example 68 with Launcher

use of com.android.launcher3.Launcher in project android_packages_apps_Launcher3 by AOSPA.

the class QuickstepModelDelegate method registerSnapshotLoggingCallback.

/**
 * Registers a callback to log launcher workspace layout using Statsd pulled atom.
 */
protected void registerSnapshotLoggingCallback() {
    if (mStatsManager == null) {
        Log.d(TAG, "Failed to get StatsManager");
    }
    try {
        mStatsManager.setPullAtomCallback(SysUiStatsLog.LAUNCHER_LAYOUT_SNAPSHOT, null, /* PullAtomMetadata */
        MODEL_EXECUTOR, (i, eventList) -> {
            InstanceId instanceId = new InstanceIdSequence().newInstanceId();
            IntSparseArrayMap<ItemInfo> itemsIdMap;
            synchronized (mDataModel) {
                itemsIdMap = mDataModel.itemsIdMap.clone();
            }
            for (ItemInfo info : itemsIdMap) {
                FolderInfo parent = getContainer(info, itemsIdMap);
                LauncherAtom.ItemInfo itemInfo = info.buildProto(parent);
                Log.d(TAG, itemInfo.toString());
                StatsEvent statsEvent = StatsLogCompatManager.buildStatsEvent(itemInfo, instanceId);
                eventList.add(statsEvent);
            }
            Log.d(TAG, String.format("Successfully logged %d workspace items with instanceId=%d", itemsIdMap.size(), instanceId.getId()));
            additionalSnapshotEvents(instanceId);
            SettingsChangeLogger.INSTANCE.get(mContext).logSnapshot(instanceId);
            return StatsManager.PULL_SUCCESS;
        });
        Log.d(TAG, "Successfully registered for launcher snapshot logging!");
    } catch (RuntimeException e) {
        Log.e(TAG, "Failed to register launcher snapshot logging callback with StatsManager", e);
    }
}
Also used : InstanceId(com.android.launcher3.logging.InstanceId) InstanceIdSequence(com.android.launcher3.logging.InstanceIdSequence) ItemInfo(com.android.launcher3.model.data.ItemInfo) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo) PredictionHelper.getAppTargetFromItemInfo(com.android.launcher3.model.PredictionHelper.getAppTargetFromItemInfo) LauncherAtom(com.android.launcher3.logger.LauncherAtom) StatsEvent(android.util.StatsEvent) FolderInfo(com.android.launcher3.model.data.FolderInfo)

Example 69 with Launcher

use of com.android.launcher3.Launcher in project android_packages_apps_Launcher3 by AOSPA.

the class TaskbarLauncherStateController method init.

public void init(TaskbarControllers controllers, BaseQuickstepLauncher launcher) {
    mControllers = controllers;
    mLauncher = launcher;
    mTaskbarBackgroundAlpha = mControllers.taskbarDragLayerController.getTaskbarBackgroundAlpha();
    MultiValueAlpha taskbarIconAlpha = mControllers.taskbarViewController.getTaskbarIconAlpha();
    mIconAlphaForHome = taskbarIconAlpha.getProperty(ALPHA_INDEX_HOME);
    mIconAlphaForHome.setConsumer((Consumer<Float>) alpha -> mLauncher.getHotseat().setIconsAlpha(alpha > 0 ? 0 : 1));
    mIconAlignmentForResumedState.finishAnimation();
    onIconAlignmentRatioChangedForAppAndHomeTransition();
    mLauncher.getStateManager().addStateListener(mStateListener);
    // Initialize to the current launcher state
    updateStateForFlag(FLAG_RESUMED, launcher.hasBeenResumed());
    mLauncherState = launcher.getStateManager().getState();
    applyState(0);
}
Also used : AnimatedFloat(com.android.quickstep.AnimatedFloat) NonNull(androidx.annotation.NonNull) ObjectAnimator(android.animation.ObjectAnimator) RecentsAnimationController(com.android.quickstep.RecentsAnimationController) FLAG_IN_APP(com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_APP) BaseQuickstepLauncher(com.android.launcher3.BaseQuickstepLauncher) StateManager(com.android.launcher3.statemanager.StateManager) RecentsAnimationCallbacks(com.android.quickstep.RecentsAnimationCallbacks) HashMap(java.util.HashMap) Animator(android.animation.Animator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) Supplier(java.util.function.Supplier) MultiValueAlpha(com.android.launcher3.util.MultiValueAlpha) TASKBAR_STASH_DURATION(com.android.launcher3.taskbar.TaskbarStashController.TASKBAR_STASH_DURATION) LauncherState(com.android.launcher3.LauncherState) Consumer(java.util.function.Consumer) FLAG_IN_STASHED_LAUNCHER_STATE(com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_STASHED_LAUNCHER_STATE) ALPHA_INDEX_HOME(com.android.launcher3.taskbar.TaskbarViewController.ALPHA_INDEX_HOME) ThumbnailData(com.android.systemui.shared.recents.model.ThumbnailData) AnimatorSet(android.animation.AnimatorSet) RecentsView(com.android.quickstep.views.RecentsView) AnimatedFloat(com.android.quickstep.AnimatedFloat) MultiValueAlpha(com.android.launcher3.util.MultiValueAlpha)

Example 70 with Launcher

use of com.android.launcher3.Launcher in project android_packages_apps_Launcher3 by AOSPA.

the class DragViewStateAnnouncer method completeAction.

public void completeAction(int announceResId) {
    cancel();
    Launcher launcher = Launcher.getLauncher(mTargetView.getContext());
    launcher.getDragLayer().announceForAccessibility(launcher.getText(announceResId));
}
Also used : Launcher(com.android.launcher3.Launcher)

Aggregations

Launcher (com.android.launcher3.Launcher)194 WorkspaceItemInfo (com.android.launcher3.model.data.WorkspaceItemInfo)102 Test (org.junit.Test)102 View (android.view.View)87 LargeTest (androidx.test.filters.LargeTest)83 ItemInfo (com.android.launcher3.model.data.ItemInfo)83 Rect (android.graphics.Rect)80 Point (android.graphics.Point)77 Intent (android.content.Intent)71 ArrayList (java.util.ArrayList)69 DeviceProfile (com.android.launcher3.DeviceProfile)66 BaseQuickstepLauncher (com.android.launcher3.BaseQuickstepLauncher)64 Context (android.content.Context)61 LauncherAppWidgetInfo (com.android.launcher3.model.data.LauncherAppWidgetInfo)49 RecentsView (com.android.quickstep.views.RecentsView)46 DragLayer (com.android.launcher3.dragndrop.DragLayer)45 ComponentName (android.content.ComponentName)43 FolderInfo (com.android.launcher3.model.data.FolderInfo)42 ViewGroup (android.view.ViewGroup)41 AllApps (com.android.launcher3.tapl.AllApps)40