Search in sources :

Example 11 with LauncherTaskbarUIController

use of com.android.launcher3.taskbar.LauncherTaskbarUIController in project android_packages_apps_Launcher3 by crdroidandroid.

the class TaskbarManager method recreateTaskbar.

private void recreateTaskbar() {
    destroyExistingTaskbar();
    if (!FeatureFlags.ENABLE_TASKBAR.get()) {
        return;
    }
    if (!mUserUnlocked) {
        return;
    }
    DeviceProfile dp = LauncherAppState.getIDP(mContext).getDeviceProfile(mContext);
    if (!dp.isTaskbarPresent) {
        return;
    }
    mTaskbarActivityContext = new TaskbarActivityContext(mContext, dp.copy(mContext), mNavButtonController);
    mTaskbarActivityContext.init();
    if (mLauncher != null) {
        mTaskbarActivityContext.setUIController(new LauncherTaskbarUIController(mLauncher, mTaskbarActivityContext));
    }
}
Also used : DeviceProfile(com.android.launcher3.DeviceProfile)

Example 12 with LauncherTaskbarUIController

use of com.android.launcher3.taskbar.LauncherTaskbarUIController in project android_packages_apps_Launcher3 by ArrowOS.

the class LauncherActivityInterface method closeOverlay.

@Override
public void closeOverlay() {
    Launcher launcher = getCreatedActivity();
    if (launcher == null) {
        return;
    }
    LauncherOverlayManager om = launcher.getOverlayManager();
    if (!launcher.isStarted() || launcher.isForceInvisible()) {
        om.hideOverlay(false);
    } else {
        om.hideOverlay(150);
    }
    LauncherTaskbarUIController taskbarController = getTaskbarController();
    if (taskbarController != null) {
        taskbarController.hideEdu();
    }
}
Also used : LauncherTaskbarUIController(com.android.launcher3.taskbar.LauncherTaskbarUIController) Launcher(com.android.launcher3.Launcher) BaseQuickstepLauncher(com.android.launcher3.BaseQuickstepLauncher) LauncherOverlayManager(com.android.systemui.plugins.shared.LauncherOverlayManager)

Example 13 with LauncherTaskbarUIController

use of com.android.launcher3.taskbar.LauncherTaskbarUIController in project android_packages_apps_Launcher3 by ArrowOS.

the class QuickstepTransitionManager method getLauncherContentAnimator.

/**
 * Content is everything on screen except the background and the floating view (if any).
 *
 * @param isAppOpening True when this is called when an app is opening.
 *                     False when this is called when an app is closing.
 * @param startDelay   Start delay duration.
 * @param skipAllAppsScale True if we want to avoid scaling All Apps
 */
private Pair<AnimatorSet, Runnable> getLauncherContentAnimator(boolean isAppOpening, int startDelay, boolean skipAllAppsScale) {
    AnimatorSet launcherAnimator = new AnimatorSet();
    Runnable endListener;
    float[] alphas = isAppOpening ? new float[] { 1, 0 } : new float[] { 0, 1 };
    float[] scales = isAppOpening ? new float[] { 1, mContentScale } : new float[] { mContentScale, 1 };
    if (mLauncher.isInState(ALL_APPS)) {
        // All Apps in portrait mode is full screen, so we only animate AllAppsContainerView.
        final View appsView = mLauncher.getAppsView();
        final float startAlpha = appsView.getAlpha();
        final float startScale = SCALE_PROPERTY.get(appsView);
        appsView.setAlpha(alphas[0]);
        ObjectAnimator alpha = ObjectAnimator.ofFloat(appsView, View.ALPHA, alphas);
        alpha.setDuration(CONTENT_ALPHA_DURATION);
        alpha.setInterpolator(LINEAR);
        appsView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
        alpha.addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                appsView.setLayerType(View.LAYER_TYPE_NONE, null);
            }
        });
        if (!skipAllAppsScale) {
            SCALE_PROPERTY.set(appsView, scales[0]);
            ObjectAnimator scale = ObjectAnimator.ofFloat(appsView, SCALE_PROPERTY, scales);
            scale.setInterpolator(AGGRESSIVE_EASE);
            scale.setDuration(CONTENT_SCALE_DURATION);
            launcherAnimator.play(scale);
        }
        launcherAnimator.play(alpha);
        endListener = () -> {
            appsView.setAlpha(startAlpha);
            SCALE_PROPERTY.set(appsView, startScale);
            appsView.setLayerType(View.LAYER_TYPE_NONE, null);
        };
    } else if (mLauncher.isInState(OVERVIEW)) {
        endListener = composeViewContentAnimator(launcherAnimator, alphas, scales);
    } else {
        List<View> viewsToAnimate = new ArrayList<>();
        Workspace workspace = mLauncher.getWorkspace();
        workspace.forEachVisiblePage(view -> viewsToAnimate.add(((CellLayout) view).getShortcutsAndWidgets()));
        viewsToAnimate.add(mLauncher.getHotseat());
        viewsToAnimate.forEach(view -> {
            view.setLayerType(View.LAYER_TYPE_HARDWARE, null);
            ObjectAnimator scaleAnim = ObjectAnimator.ofFloat(view, SCALE_PROPERTY, scales).setDuration(CONTENT_SCALE_DURATION);
            scaleAnim.setInterpolator(DEACCEL_1_5);
            launcherAnimator.play(scaleAnim);
        });
        final boolean scrimEnabled = ENABLE_SCRIM_FOR_APP_LAUNCH.get();
        if (scrimEnabled) {
            boolean useTaskbarColor = mDeviceProfile.isTaskbarPresentInApps;
            int scrimColor = useTaskbarColor ? mLauncher.getResources().getColor(R.color.taskbar_background) : Themes.getAttrColor(mLauncher, R.attr.overviewScrimColor);
            int scrimColorTrans = ColorUtils.setAlphaComponent(scrimColor, 0);
            int[] colors = isAppOpening ? new int[] { scrimColorTrans, scrimColor } : new int[] { scrimColor, scrimColorTrans };
            ScrimView scrimView = mLauncher.getScrimView();
            if (scrimView.getBackground() instanceof ColorDrawable) {
                scrimView.setBackgroundColor(colors[0]);
                ObjectAnimator scrim = ObjectAnimator.ofArgb(scrimView, VIEW_BACKGROUND_COLOR, colors);
                scrim.setDuration(CONTENT_SCRIM_DURATION);
                scrim.setInterpolator(DEACCEL_1_5);
                if (useTaskbarColor) {
                    // Hide the taskbar background color since it would duplicate the scrim.
                    scrim.addListener(new AnimatorListenerAdapter() {

                        @Override
                        public void onAnimationStart(Animator animation) {
                            LauncherTaskbarUIController taskbarUIController = mLauncher.getTaskbarUIController();
                            if (taskbarUIController != null) {
                                taskbarUIController.forceHideBackground(true);
                            }
                        }

                        @Override
                        public void onAnimationEnd(Animator animation) {
                            LauncherTaskbarUIController taskbarUIController = mLauncher.getTaskbarUIController();
                            if (taskbarUIController != null) {
                                taskbarUIController.forceHideBackground(false);
                            }
                        }
                    });
                }
                launcherAnimator.play(scrim);
            }
        }
        // Pause page indicator animations as they lead to layer trashing.
        mLauncher.getWorkspace().getPageIndicator().pauseAnimations();
        endListener = () -> {
            viewsToAnimate.forEach(view -> {
                SCALE_PROPERTY.set(view, 1f);
                view.setLayerType(View.LAYER_TYPE_NONE, null);
            });
            if (scrimEnabled) {
                mLauncher.getScrimView().setBackgroundColor(Color.TRANSPARENT);
            }
            mLauncher.getWorkspace().getPageIndicator().skipAnimationsToEnd();
        };
    }
    launcherAnimator.setStartDelay(startDelay);
    return new Pair<>(launcherAnimator, endListener);
}
Also used : BACKGROUND_APP(com.android.launcher3.LauncherState.BACKGROUND_APP) BlurUtils(com.android.systemui.shared.system.BlurUtils) NonNull(androidx.annotation.NonNull) ColorDrawable(android.graphics.drawable.ColorDrawable) OVERVIEW(com.android.launcher3.LauncherState.OVERVIEW) LauncherTaskbarUIController(com.android.launcher3.taskbar.LauncherTaskbarUIController) Drawable(android.graphics.drawable.Drawable) KEYGUARD_ANIMATION(com.android.launcher3.config.FeatureFlags.KEYGUARD_ANIMATION) DisplayController.getSingleFrameMs(com.android.launcher3.util.DisplayController.getSingleFrameMs) Handler(android.os.Handler) Looper(android.os.Looper) AnimationSuccessListener(com.android.launcher3.anim.AnimationSuccessListener) InteractionJankMonitorWrapper(com.android.systemui.shared.system.InteractionJankMonitorWrapper) SCALE_PROPERTY(com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY) Utilities.mapBoundToRange(com.android.launcher3.Utilities.mapBoundToRange) PathInterpolator(android.view.animation.PathInterpolator) MODE_CLOSING(com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING) Interpolator(android.view.animation.Interpolator) AGGRESSIVE_EASE(com.android.launcher3.anim.Interpolators.AGGRESSIVE_EASE) STARTING_WINDOW_TYPE_SPLASH_SCREEN(android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_SPLASH_SCREEN) ViewRootImpl(android.view.ViewRootImpl) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) Nullable(androidx.annotation.Nullable) RemoteAnimationFactory(com.android.launcher3.LauncherAnimationRunner.RemoteAnimationFactory) ActivityCompat(com.android.systemui.shared.system.ActivityCompat) RectFSpringAnim(com.android.quickstep.util.RectFSpringAnim) INVISIBLE_BY_APP_TRANSITIONS(com.android.launcher3.BaseActivity.INVISIBLE_BY_APP_TRANSITIONS) LauncherAppWidgetHostView(com.android.launcher3.widget.LauncherAppWidgetHostView) QuickStepContract.getWindowCornerRadius(com.android.systemui.shared.system.QuickStepContract.getWindowCornerRadius) RemoteAnimationDefinitionCompat(com.android.systemui.shared.system.RemoteAnimationDefinitionCompat) DEACCEL_1_5(com.android.launcher3.anim.Interpolators.DEACCEL_1_5) SEPARATE_RECENTS_ACTIVITY(com.android.launcher3.config.FeatureFlags.SEPARATE_RECENTS_ACTIVITY) RemoteAnimationTargetCompat(com.android.systemui.shared.system.RemoteAnimationTargetCompat) StaggeredWorkspaceAnim(com.android.quickstep.util.StaggeredWorkspaceAnim) QuickStepContract(com.android.systemui.shared.system.QuickStepContract) SystemUiProxy(com.android.quickstep.SystemUiProxy) DEACCEL_1_7(com.android.launcher3.anim.Interpolators.DEACCEL_1_7) RemoteAnimationTargets(com.android.quickstep.RemoteAnimationTargets) ArrayList(java.util.ArrayList) WorkspaceRevealAnim(com.android.quickstep.util.WorkspaceRevealAnim) LinkedHashMap(java.util.LinkedHashMap) FloatingIconView(com.android.launcher3.views.FloatingIconView) TaskViewUtils.findTaskViewToLaunch(com.android.quickstep.TaskViewUtils.findTaskViewToLaunch) UserHandle(android.os.UserHandle) RemoteAnimationProvider(com.android.quickstep.util.RemoteAnimationProvider) DEPTH(com.android.launcher3.statehandlers.DepthController.DEPTH) OnDeviceProfileChangeListener(com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener) ComponentName(android.content.ComponentName) FastBitmapDrawable(com.android.launcher3.icons.FastBitmapDrawable) VIEW_BACKGROUND_COLOR(com.android.launcher3.LauncherAnimUtils.VIEW_BACKGROUND_COLOR) DeepShortcutView(com.android.launcher3.shortcuts.DeepShortcutView) DynamicResource(com.android.launcher3.util.DynamicResource) ENABLE_SCRIM_FOR_APP_LAUNCH(com.android.launcher3.config.FeatureFlags.ENABLE_SCRIM_FOR_APP_LAUNCH) EXAGGERATED_EASE(com.android.launcher3.anim.Interpolators.EXAGGERATED_EASE) STARTING_WINDOW_TYPE_NONE(android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_NONE) INVISIBLE_BY_PENDING_FLAGS(com.android.launcher3.BaseActivity.INVISIBLE_BY_PENDING_FLAGS) SystemProperties(android.os.SystemProperties) LINEAR(com.android.launcher3.anim.Interpolators.LINEAR) IStartingWindowListener(com.android.wm.shell.startingsurface.IStartingWindowListener) AlphaProperty(com.android.launcher3.util.MultiValueAlpha.AlphaProperty) ColorUtils(androidx.core.graphics.ColorUtils) RunnableList(com.android.launcher3.util.RunnableList) RemoteAnimationRunnerCompat(com.android.systemui.shared.system.RemoteAnimationRunnerCompat) ValueAnimator(android.animation.ValueAnimator) Rect(android.graphics.Rect) PointF(android.graphics.PointF) NO_MATCHING_ID(com.android.launcher3.model.data.ItemInfo.NO_MATCHING_ID) PackageManager(android.content.pm.PackageManager) Animator(android.animation.Animator) PENDING_INVISIBLE_BY_WALLPAPER_ANIMATION(com.android.launcher3.BaseActivity.PENDING_INVISIBLE_BY_WALLPAPER_ANIMATION) IBinder(android.os.IBinder) ObjectWrapper(com.android.launcher3.util.ObjectWrapper) RemoteAnimationAdapterCompat(com.android.systemui.shared.system.RemoteAnimationAdapterCompat) WindowManagerWrapper(com.android.systemui.shared.system.WindowManagerWrapper) TaskViewUtils(com.android.quickstep.TaskViewUtils) View(android.view.View) Matrix(android.graphics.Matrix) RectF(android.graphics.RectF) DepthController(com.android.launcher3.statehandlers.DepthController) ObjectAnimator(android.animation.ObjectAnimator) CancellationSignal(android.os.CancellationSignal) ALPHA_INDEX_TRANSITIONS(com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_TRANSITIONS) List(java.util.List) ALL_APPS(com.android.launcher3.LauncherState.ALL_APPS) Utilities.postAsyncCallback(com.android.launcher3.Utilities.postAsyncCallback) SHAPE_PROGRESS_DURATION(com.android.launcher3.views.FloatingIconView.SHAPE_PROGRESS_DURATION) Themes(com.android.launcher3.util.Themes) SurfaceTransactionApplier(com.android.quickstep.util.SurfaceTransactionApplier) Size(android.util.Size) ACCEL_1_5(com.android.launcher3.anim.Interpolators.ACCEL_1_5) ActivityOptionsCompat(com.android.systemui.shared.system.ActivityOptionsCompat) Context(android.content.Context) Pair(android.util.Pair) AnimationUtils(android.view.animation.AnimationUtils) MODE_OPENING(com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_OPENING) AnimatorSet(android.animation.AnimatorSet) DragLayer(com.android.launcher3.dragndrop.DragLayer) ActivityOptionsWrapper(com.android.launcher3.util.ActivityOptionsWrapper) SurfaceParams(com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams) INVISIBLE_ALL(com.android.launcher3.BaseActivity.INVISIBLE_ALL) MultiValueUpdateListener(com.android.quickstep.util.MultiValueUpdateListener) Point(android.graphics.Point) ENABLE_BACK_SWIPE_HOME_ANIMATION(com.android.launcher3.config.FeatureFlags.ENABLE_BACK_SWIPE_HOME_ANIMATION) FloatingIconView.getFloatingIconView(com.android.launcher3.views.FloatingIconView.getFloatingIconView) RemoteTransitionCompat(com.android.systemui.shared.system.RemoteTransitionCompat) Color(android.graphics.Color) SurfaceControl(android.view.SurfaceControl) QuickStepContract.supportsRoundedCornersOnWindows(com.android.systemui.shared.system.QuickStepContract.supportsRoundedCornersOnWindows) ViewTreeObserver(android.view.ViewTreeObserver) ScrimView(com.android.launcher3.views.ScrimView) RecentsView(com.android.quickstep.views.RecentsView) FloatingWidgetView(com.android.quickstep.views.FloatingWidgetView) PagedOrientationHandler(com.android.launcher3.touch.PagedOrientationHandler) Resources(android.content.res.Resources) ObjectAnimator(android.animation.ObjectAnimator) AnimatorSet(android.animation.AnimatorSet) ScrimView(com.android.launcher3.views.ScrimView) LauncherAppWidgetHostView(com.android.launcher3.widget.LauncherAppWidgetHostView) FloatingIconView(com.android.launcher3.views.FloatingIconView) DeepShortcutView(com.android.launcher3.shortcuts.DeepShortcutView) View(android.view.View) FloatingIconView.getFloatingIconView(com.android.launcher3.views.FloatingIconView.getFloatingIconView) ScrimView(com.android.launcher3.views.ScrimView) RecentsView(com.android.quickstep.views.RecentsView) FloatingWidgetView(com.android.quickstep.views.FloatingWidgetView) ValueAnimator(android.animation.ValueAnimator) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) LauncherTaskbarUIController(com.android.launcher3.taskbar.LauncherTaskbarUIController) ColorDrawable(android.graphics.drawable.ColorDrawable) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ArrayList(java.util.ArrayList) RunnableList(com.android.launcher3.util.RunnableList) List(java.util.List) Pair(android.util.Pair)

Example 14 with LauncherTaskbarUIController

use of com.android.launcher3.taskbar.LauncherTaskbarUIController in project android_packages_apps_Launcher3 by ProtonAOSP.

the class LauncherActivityInterface method getParallelAnimationToLauncher.

@Override
@Nullable
public Animator getParallelAnimationToLauncher(GestureEndTarget endTarget, long duration, RecentsAnimationCallbacks callbacks) {
    LauncherTaskbarUIController uiController = getTaskbarController();
    Animator superAnimator = super.getParallelAnimationToLauncher(endTarget, duration, callbacks);
    if (uiController == null || callbacks == null) {
        return superAnimator;
    }
    LauncherState toState = stateFromGestureEndTarget(endTarget);
    Animator taskbarAnimator = uiController.createAnimToLauncher(toState, callbacks, duration);
    if (superAnimator == null) {
        return taskbarAnimator;
    } else {
        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.playTogether(superAnimator, taskbarAnimator);
        return animatorSet;
    }
}
Also used : LauncherState(com.android.launcher3.LauncherState) LauncherTaskbarUIController(com.android.launcher3.taskbar.LauncherTaskbarUIController) Animator(android.animation.Animator) AnimatorSet(android.animation.AnimatorSet) Nullable(androidx.annotation.Nullable)

Example 15 with LauncherTaskbarUIController

use of com.android.launcher3.taskbar.LauncherTaskbarUIController in project android_packages_apps_Launcher3 by ProtonAOSP.

the class LauncherActivityInterface method closeOverlay.

@Override
public void closeOverlay() {
    Launcher launcher = getCreatedActivity();
    if (launcher == null) {
        return;
    }
    LauncherOverlayManager om = launcher.getOverlayManager();
    if (!launcher.isStarted() || launcher.isForceInvisible()) {
        om.hideOverlay(false);
    } else {
        om.hideOverlay(150);
    }
    LauncherTaskbarUIController taskbarController = getTaskbarController();
    if (taskbarController != null) {
        taskbarController.hideEdu();
    }
}
Also used : LauncherTaskbarUIController(com.android.launcher3.taskbar.LauncherTaskbarUIController) Launcher(com.android.launcher3.Launcher) BaseQuickstepLauncher(com.android.launcher3.BaseQuickstepLauncher) LauncherOverlayManager(com.android.systemui.plugins.shared.LauncherOverlayManager)

Aggregations

LauncherTaskbarUIController (com.android.launcher3.taskbar.LauncherTaskbarUIController)17 Animator (android.animation.Animator)13 AnimatorSet (android.animation.AnimatorSet)13 Nullable (androidx.annotation.Nullable)9 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)8 ObjectAnimator (android.animation.ObjectAnimator)8 ValueAnimator (android.animation.ValueAnimator)8 Matrix (android.graphics.Matrix)8 Point (android.graphics.Point)8 Rect (android.graphics.Rect)8 RectF (android.graphics.RectF)8 FloatingIconView (com.android.launcher3.views.FloatingIconView)8 FloatingIconView.getFloatingIconView (com.android.launcher3.views.FloatingIconView.getFloatingIconView)8 RemoteAnimationTargets (com.android.quickstep.RemoteAnimationTargets)8 MultiValueUpdateListener (com.android.quickstep.util.MultiValueUpdateListener)8 SurfaceTransactionApplier (com.android.quickstep.util.SurfaceTransactionApplier)8 RemoteAnimationTargetCompat (com.android.systemui.shared.system.RemoteAnimationTargetCompat)8 SurfaceParams (com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams)8 ArrayList (java.util.ArrayList)8 ComponentName (android.content.ComponentName)4