Search in sources :

Example 61 with Background

use of com.android.launcher3.tapl.Background in project android_packages_apps_404Launcher by P-404.

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 62 with Background

use of com.android.launcher3.tapl.Background in project android_packages_apps_404Launcher by P-404.

the class TouchInteractionService method onConfigurationChanged.

@Override
public void onConfigurationChanged(Configuration newConfig) {
    if (!mDeviceState.isUserUnlocked()) {
        return;
    }
    final BaseActivityInterface activityInterface = mOverviewComponentObserver.getActivityInterface();
    final BaseDraggingActivity activity = activityInterface.getCreatedActivity();
    if (activity == null || activity.isStarted()) {
        // We only care about the existing background activity.
        return;
    }
    if (mOverviewComponentObserver.canHandleConfigChanges(activity.getComponentName(), activity.getResources().getConfiguration().diff(newConfig))) {
        // Since navBar gestural height are different between portrait and landscape,
        // can handle orientation changes and refresh navigation gestural region through
        // onOneHandedModeChanged()
        int newGesturalHeight = ResourceUtils.getNavbarSize(ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE, getApplicationContext().getResources());
        mDeviceState.onOneHandedModeChanged(newGesturalHeight);
        return;
    }
    preloadOverview(false);
}
Also used : BaseDraggingActivity(com.android.launcher3.BaseDraggingActivity) Point(android.graphics.Point)

Example 63 with Background

use of com.android.launcher3.tapl.Background in project android_packages_apps_404Launcher by P-404.

the class NavbarButtonsViewController method init.

/**
 * Initializes the controller
 */
public void init(TaskbarControllers controllers) {
    mControllers = controllers;
    mNavButtonsView.getLayoutParams().height = mContext.getDeviceProfile().taskbarSize;
    mNavButtonTranslationYMultiplier.value = 1;
    boolean isThreeButtonNav = mContext.isThreeButtonNav();
    // IME switcher
    View imeSwitcherButton = addButton(R.drawable.ic_ime_switcher, BUTTON_IME_SWITCH, isThreeButtonNav ? mStartContextualContainer : mEndContextualContainer, mControllers.navButtonController, R.id.ime_switcher);
    mPropertyHolders.add(new StatePropertyHolder(imeSwitcherButton, flags -> ((flags & MASK_IME_SWITCHER_VISIBLE) == MASK_IME_SWITCHER_VISIBLE) && ((flags & FLAG_ROTATION_BUTTON_VISIBLE) == 0)));
    mPropertyHolders.add(new StatePropertyHolder(mControllers.taskbarViewController.getTaskbarIconAlpha().getProperty(ALPHA_INDEX_KEYGUARD), flags -> (flags & FLAG_KEYGUARD_VISIBLE) == 0 && (flags & FLAG_SCREEN_PINNING_ACTIVE) == 0, MultiValueAlpha.VALUE, 1, 0));
    mPropertyHolders.add(new StatePropertyHolder(mControllers.taskbarDragLayerController.getKeyguardBgTaskbar(), flags -> (flags & FLAG_KEYGUARD_VISIBLE) == 0, AnimatedFloat.VALUE, 1, 0));
    // Force nav buttons (specifically back button) to be visible during setup wizard.
    boolean isInSetup = !mContext.isUserSetupComplete();
    boolean alwaysShowButtons = isThreeButtonNav || isInSetup;
    // Make sure to remove nav bar buttons translation when notification shade is expanded or
    // IME is showing (add separate translation for IME).
    int flagsToRemoveTranslation = FLAG_NOTIFICATION_SHADE_EXPANDED | FLAG_IME_VISIBLE;
    mPropertyHolders.add(new StatePropertyHolder(mNavButtonTranslationYMultiplier, flags -> (flags & flagsToRemoveTranslation) != 0, AnimatedFloat.VALUE, 0, 1));
    // Center nav buttons in new height for IME.
    float transForIme = (mContext.getDeviceProfile().taskbarSize - mContext.getTaskbarHeightForIme()) / 2f;
    // For gesture nav, nav buttons only show for IME anyway so keep them translated down.
    float defaultButtonTransY = alwaysShowButtons ? 0 : transForIme;
    mPropertyHolders.add(new StatePropertyHolder(mTaskbarNavButtonTranslationYForIme, flags -> (flags & FLAG_IME_VISIBLE) != 0, AnimatedFloat.VALUE, transForIme, defaultButtonTransY));
    if (alwaysShowButtons) {
        initButtons(mNavButtonContainer, mEndContextualContainer, mControllers.navButtonController);
        if (isInSetup) {
            // Since setup wizard only has back button enabled, it looks strange to be
            // end-aligned, so start-align instead.
            FrameLayout.LayoutParams navButtonsLayoutParams = (FrameLayout.LayoutParams) mNavButtonContainer.getLayoutParams();
            navButtonsLayoutParams.setMarginStart(navButtonsLayoutParams.getMarginEnd());
            navButtonsLayoutParams.setMarginEnd(0);
            navButtonsLayoutParams.gravity = Gravity.START;
            mNavButtonContainer.requestLayout();
            // TODO(b/210906568) Dark intensity is currently not propagated during setup, so set
            // it based on dark theme for now.
            int mode = mContext.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
            boolean isDarkTheme = mode == Configuration.UI_MODE_NIGHT_YES;
            mTaskbarNavButtonDarkIntensity.updateValue(isDarkTheme ? 0 : 1);
        }
        // Animate taskbar background when any of these flags are enabled
        int flagsToShowBg = FLAG_ONLY_BACK_FOR_BOUNCER_VISIBLE | FLAG_NOTIFICATION_SHADE_EXPANDED;
        mPropertyHolders.add(new StatePropertyHolder(mControllers.taskbarDragLayerController.getNavbarBackgroundAlpha(), flags -> (flags & flagsToShowBg) != 0, AnimatedFloat.VALUE, 1, 0));
        // Rotation button
        RotationButton rotationButton = new RotationButtonImpl(addButton(mEndContextualContainer, R.id.rotate_suggestion, R.layout.taskbar_contextual_button));
        rotationButton.hide();
        mControllers.rotationButtonController.setRotationButton(rotationButton, null);
    } else {
        mFloatingRotationButton = new FloatingRotationButton(mContext, R.string.accessibility_rotate_button, R.layout.rotate_suggestion, R.id.rotate_suggestion, R.dimen.floating_rotation_button_min_margin, R.dimen.rounded_corner_content_padding, R.dimen.floating_rotation_button_taskbar_left_margin, R.dimen.floating_rotation_button_taskbar_bottom_margin, R.dimen.floating_rotation_button_diameter, R.dimen.key_button_ripple_max_width);
        mControllers.rotationButtonController.setRotationButton(mFloatingRotationButton, mRotationButtonListener);
        View imeDownButton = addButton(R.drawable.ic_sysbar_back, BUTTON_BACK, mStartContextualContainer, mControllers.navButtonController, R.id.back);
        imeDownButton.setRotation(Utilities.isRtl(mContext.getResources()) ? 90 : -90);
        // Rotate when Ime visible
        mPropertyHolders.add(new StatePropertyHolder(imeDownButton, flags -> (flags & FLAG_IME_VISIBLE) != 0));
    }
    applyState();
    mPropertyHolders.forEach(StatePropertyHolder::endAnimation);
}
Also used : Rect(android.graphics.Rect) BUTTON_A11Y(com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_A11Y) Config(android.content.pm.ActivityInfo.Config) FrameLayout(android.widget.FrameLayout) ImageView(android.widget.ImageView) IntPredicate(java.util.function.IntPredicate) BUTTON_HOME(com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_HOME) Property(android.util.Property) ColorStateList(android.content.res.ColorStateList) BUTTON_BACK(com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_BACK) View(android.view.View) ArgbEvaluator(android.animation.ArgbEvaluator) Op(android.graphics.Region.Op) RotationButtonController(com.android.systemui.shared.rotation.RotationButtonController) LayoutRes(android.annotation.LayoutRes) Utilities(com.android.launcher3.Utilities) RotationButton(com.android.systemui.shared.rotation.RotationButton) AnimatedFloat(com.android.quickstep.AnimatedFloat) SYSUI_STATE_SCREEN_PINNING(com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_PINNING) ObjectAnimator(android.animation.ObjectAnimator) Region(android.graphics.Region) ViewGroup(android.view.ViewGroup) MultiValueAlpha(com.android.launcher3.util.MultiValueAlpha) SYSUI_STATE_BACK_DISABLED(com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BACK_DISABLED) IdRes(android.annotation.IdRes) SYSUI_STATE_HOME_DISABLED(com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_HOME_DISABLED) SYSUI_STATE_OVERVIEW_DISABLED(com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED) BUTTON_IME_SWITCH(com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_IME_SWITCH) OnHoverListener(android.view.View.OnHoverListener) LauncherAnimUtils(com.android.launcher3.LauncherAnimUtils) AlphaUpdateListener(com.android.launcher3.anim.AlphaUpdateListener) BUTTON_RECENTS(com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_RECENTS) SYSUI_STATE_A11Y_BUTTON_CLICKABLE(com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A11Y_BUTTON_CLICKABLE) AnimatedVectorDrawable(android.graphics.drawable.AnimatedVectorDrawable) ArrayList(java.util.ArrayList) SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED(com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED) MotionEvent(android.view.MotionEvent) DrawableRes(android.annotation.DrawableRes) SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE(com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE) SYSUI_STATE_QUICK_SETTINGS_EXPANDED(com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_QUICK_SETTINGS_EXPANDED) VIEW_TRANSLATE_X(com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_X) ALPHA_INDEX_KEYGUARD(com.android.launcher3.taskbar.TaskbarViewController.ALPHA_INDEX_KEYGUARD) TaskbarButton(com.android.launcher3.taskbar.TaskbarNavButtonController.TaskbarButton) FloatingRotationButton(com.android.systemui.shared.rotation.FloatingRotationButton) SYSUI_STATE_IME_SWITCHER_SHOWING(com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_SWITCHER_SHOWING) Gravity(android.view.Gravity) R(com.android.launcher3.R) Configuration(android.content.res.Configuration) SYSUI_STATE_IME_SHOWING(com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_SHOWING) OnClickListener(android.view.View.OnClickListener) RotationButton(com.android.systemui.shared.rotation.RotationButton) FloatingRotationButton(com.android.systemui.shared.rotation.FloatingRotationButton) FloatingRotationButton(com.android.systemui.shared.rotation.FloatingRotationButton) FrameLayout(android.widget.FrameLayout) ImageView(android.widget.ImageView) View(android.view.View)

Example 64 with Background

use of com.android.launcher3.tapl.Background in project android_packages_apps_404Launcher by P-404.

the class ViewInflationDuringSwipeUp method executeSwipeUpTestWithWidget.

private void executeSwipeUpTestWithWidget(IntConsumer widgetIdCreationCallback, IntConsumer updateBeforeSwipeUp, String finalWidgetText) {
    try {
        // Clear all existing data
        LauncherSettings.Settings.call(mResolver, LauncherSettings.Settings.METHOD_CREATE_EMPTY_DB);
        LauncherSettings.Settings.call(mResolver, LauncherSettings.Settings.METHOD_CLEAR_EMPTY_DB_FLAG);
        LauncherAppWidgetProviderInfo info = TestViewHelpers.findWidgetProvider(this, false);
        // Make sure the widget is big enough to show a list of items
        info.minSpanX = 2;
        info.minSpanY = 2;
        info.spanX = 2;
        info.spanY = 2;
        LauncherAppWidgetInfo item = createWidgetInfo(info, getTargetContext(), true);
        addItemToScreen(item);
        assertTrue("Widget is not present", mLauncher.pressHome().tryGetWidget(info.label, DEFAULT_UI_TIMEOUT) != null);
        int widgetId = item.appWidgetId;
        // Verify widget id
        widgetIdCreationCallback.accept(widgetId);
        // Go to overview once so that all views are initialized and cached
        startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR));
        mLauncher.getBackground().switchToOverview().dismissAllTasks();
        // Track view creations
        mInitTracker.startTracking();
        startTestActivity(2);
        Background background = mLauncher.getBackground();
        // Update widget
        updateBeforeSwipeUp.accept(widgetId);
        background.switchToOverview();
        assertEquals("Views inflated during swipe up", 0, mInitTracker.viewInitCount);
        // Widget is updated when going home
        mInitTracker.disableLog();
        mLauncher.pressHome();
        verifyWidget(finalWidgetText);
        assertNotEquals(1, mInitTracker.viewInitCount);
    } finally {
        mConfigMap.clear();
    }
}
Also used : LauncherAppWidgetProviderInfo(com.android.launcher3.widget.LauncherAppWidgetProviderInfo) Background(com.android.launcher3.tapl.Background) LauncherAppWidgetInfo(com.android.launcher3.model.data.LauncherAppWidgetInfo)

Example 65 with Background

use of com.android.launcher3.tapl.Background in project android_packages_apps_404Launcher by P-404.

the class Launcher method getFirstMatchForAppClose.

/**
 * Similar to {@link #getFirstMatch} but optimized to finding a suitable view for the app close
 * animation.
 *
 * @param preferredItemId The id of the preferred item to match to if it exists.
 * @param packageName The package name of the app to match.
 * @param user The user of the app to match.
 */
public View getFirstMatchForAppClose(int preferredItemId, String packageName, UserHandle user) {
    final ItemInfoMatcher preferredItem = (info, cn) -> info != null && info.id == preferredItemId;
    final ItemInfoMatcher packageAndUserAndApp = (info, cn) -> info != null && info.itemType == ITEM_TYPE_APPLICATION && info.user.equals(user) && info.getTargetComponent() != null && TextUtils.equals(info.getTargetComponent().getPackageName(), packageName);
    if (isInState(LauncherState.ALL_APPS)) {
        return getFirstMatch(Collections.singletonList(mAppsView.getActiveRecyclerView()), preferredItem, packageAndUserAndApp);
    } else {
        List<ViewGroup> containers = new ArrayList<>(mWorkspace.getPanelCount() + 1);
        containers.add(mWorkspace.getHotseat().getShortcutsAndWidgets());
        mWorkspace.forEachVisiblePage(page -> containers.add(((CellLayout) page).getShortcutsAndWidgets()));
        // Order: Preferred item by itself or in folder, then by matching package/user
        if (ADAPTIVE_ICON_WINDOW_ANIM.get()) {
            return getFirstMatch(containers, preferredItem, forFolderMatch(preferredItem), packageAndUserAndApp, forFolderMatch(packageAndUserAndApp));
        } else {
            // FolderAdaptiveIcon as the background.
            return getFirstMatch(containers, preferredItem, packageAndUserAndApp);
        }
    }
}
Also used : Bundle(android.os.Bundle) BitmapRenderer(com.android.launcher3.icons.BitmapRenderer) NonNull(androidx.annotation.NonNull) PendingAddWidgetInfo(com.android.launcher3.widget.PendingAddWidgetInfo) AccessibilityManagerCompat(com.android.launcher3.compat.AccessibilityManagerCompat) CONFIG_ORIENTATION(android.content.pm.ActivityInfo.CONFIG_ORIENTATION) NO_OFFSET(com.android.launcher3.LauncherState.NO_OFFSET) SQLiteDatabase(android.database.sqlite.SQLiteDatabase) LauncherAtom(com.android.launcher3.logger.LauncherAtom) Log(android.util.Log) ALPHA_INDEX_LAUNCHER_LOAD(com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_LAUNCHER_LOAD) IntentFilter(android.content.IntentFilter) UserCache(com.android.launcher3.pm.UserCache) ActivityTracker(com.android.launcher3.util.ActivityTracker) Stream(java.util.stream.Stream) LayoutParams(android.view.WindowManager.LayoutParams) AbstractFloatingView.getTopOpenViewWithType(com.android.launcher3.AbstractFloatingView.getTopOpenViewWithType) ItemInfoMatcher(com.android.launcher3.util.ItemInfoMatcher) QsbContainerView(com.android.launcher3.qsb.QsbContainerView) TextKeyListener(android.text.method.TextKeyListener) TYPE_REBIND_SAFE(com.android.launcher3.AbstractFloatingView.TYPE_REBIND_SAFE) ModelUtils(com.android.launcher3.model.ModelUtils) ViewGroupFocusHelper(com.android.launcher3.keyboard.ViewGroupFocusHelper) ITEM_TYPE_APPLICATION(com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION) SystemClock(android.os.SystemClock) SystemUiController(com.android.launcher3.util.SystemUiController) Supplier(java.util.function.Supplier) LAUNCHER_ALLAPPS_EXIT(com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_EXIT) PendingRequestArgs(com.android.launcher3.util.PendingRequestArgs) Toast(android.widget.Toast) TYPE_ALL(com.android.launcher3.AbstractFloatingView.TYPE_ALL) Menu(android.view.Menu) ItemInfoMatcher.forFolderMatch(com.android.launcher3.util.ItemInfoMatcher.forFolderMatch) LauncherAction(com.android.launcher3.accessibility.LauncherAccessibilityDelegate.LauncherAction) IntArray(com.android.launcher3.util.IntArray) Parcelable(android.os.Parcelable) InstanceId(com.android.launcher3.logging.InstanceId) DragController(com.android.launcher3.dragndrop.DragController) LAUNCHER_ALLAPPS_ENTRY_WITH_DEVICE_SEARCH(com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_ENTRY_WITH_DEVICE_SEARCH) FLAG_DRAG_AND_DROP(com.android.launcher3.model.ItemInstallQueue.FLAG_DRAG_AND_DROP) CallSuper(androidx.annotation.CallSuper) ItemClickHandler(com.android.launcher3.touch.ItemClickHandler) IntSet(com.android.launcher3.util.IntSet) LauncherAppWidgetHost(com.android.launcher3.widget.LauncherAppWidgetHost) FolderGridOrganizer(com.android.launcher3.folder.FolderGridOrganizer) SharedPreferences(android.content.SharedPreferences) FLAG_CLOSE_POPUPS(com.android.launcher3.LauncherState.FLAG_CLOSE_POPUPS) TestLogging(com.android.launcher3.testing.TestLogging) ComponentKey(com.android.launcher3.util.ComponentKey) RunnableList(com.android.launcher3.util.RunnableList) DotInfo(com.android.launcher3.dot.DotInfo) Rect(android.graphics.Rect) Trace(android.os.Trace) PackageManager(android.content.pm.PackageManager) LAUNCHER_STATE_BACKGROUND(com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKGROUND) Animator(android.animation.Animator) IconCache(com.android.launcher3.icons.IconCache) OptionsPopupView(com.android.launcher3.views.OptionsPopupView) SPRING_LOADED(com.android.launcher3.LauncherState.SPRING_LOADED) LauncherAccessibilityDelegate.getSupportedActions(com.android.launcher3.accessibility.LauncherAccessibilityDelegate.getSupportedActions) RotationHelper(com.android.launcher3.states.RotationHelper) OverlayPlugin(com.android.systemui.plugins.OverlayPlugin) FLAG_ACTIVITY_PAUSED(com.android.launcher3.model.ItemInstallQueue.FLAG_ACTIVITY_PAUSED) FolderInfo(com.android.launcher3.model.data.FolderInfo) RectF(android.graphics.RectF) AllAppsSwipeController(com.android.launcher3.touch.AllAppsSwipeController) LauncherExterns(com.android.systemui.plugins.shared.LauncherExterns) Collection(java.util.Collection) PendingAppWidgetHostView(com.android.launcher3.widget.PendingAppWidgetHostView) MultiValueAlpha(com.android.launcher3.util.MultiValueAlpha) DragOptions(com.android.launcher3.dragndrop.DragOptions) ALL_APPS(com.android.launcher3.LauncherState.ALL_APPS) WIDGETS(com.android.launcher3.popup.SystemShortcut.WIDGETS) ActivityNotFoundException(android.content.ActivityNotFoundException) Notification(android.app.Notification) ModelWriter(com.android.launcher3.model.ModelWriter) CONFIG_SCREEN_SIZE(android.content.pm.ActivityInfo.CONFIG_SCREEN_SIZE) AppInfo(com.android.launcher3.model.data.AppInfo) ActivityResultInfo(com.android.launcher3.util.ActivityResultInfo) LauncherOverlay(com.android.systemui.plugins.shared.LauncherOverlayManager.LauncherOverlay) ItemInfo(com.android.launcher3.model.data.ItemInfo) CustomWidgetManager(com.android.launcher3.widget.custom.CustomWidgetManager) PopupContainerWithArrow(com.android.launcher3.popup.PopupContainerWithArrow) HashSet(java.util.HashSet) ActivityOptionsWrapper(com.android.launcher3.util.ActivityOptionsWrapper) Build(android.os.Build) ADAPTIVE_ICON_WINDOW_ANIM(com.android.launcher3.config.FeatureFlags.ADAPTIVE_ICON_WINDOW_ANIM) LayoutInflater(android.view.LayoutInflater) SafeCloseable(com.android.launcher3.util.SafeCloseable) OnboardingPrefs(com.android.launcher3.util.OnboardingPrefs) PendingAddShortcutInfo(com.android.launcher3.widget.PendingAddShortcutInfo) Bitmap(android.graphics.Bitmap) OvershootInterpolator(android.view.animation.OvershootInterpolator) IMPORTANT_FOR_ACCESSIBILITY_NO(android.view.View.IMPORTANT_FOR_ACCESSIBILITY_NO) DragView(com.android.launcher3.dragndrop.DragView) TraceHelper(com.android.launcher3.util.TraceHelper) LAUNCHER_ONRESUME(com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ONRESUME) AllAppsTransitionController(com.android.launcher3.allapps.AllAppsTransitionController) LauncherDragController(com.android.launcher3.dragndrop.LauncherDragController) ViewOnDrawExecutor(com.android.launcher3.util.ViewOnDrawExecutor) TestProtocol(com.android.launcher3.testing.TestProtocol) ImageView(android.widget.ImageView) AnimatorListeners(com.android.launcher3.anim.AnimatorListeners) TYPE_WINDOW_STATE_CHANGED(android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) Process(android.os.Process) LAUNCHER_ALLAPPS_ENTRY(com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_ENTRY) AccessibilityEvent(android.view.accessibility.AccessibilityEvent) TargetApi(android.annotation.TargetApi) WidgetsModel(com.android.launcher3.model.WidgetsModel) PrintWriter(java.io.PrintWriter) KeyboardShortcutInfo(android.view.KeyboardShortcutInfo) AllAppsStore(com.android.launcher3.allapps.AllAppsStore) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) LauncherAccessibilityDelegate(com.android.launcher3.accessibility.LauncherAccessibilityDelegate) StringRes(androidx.annotation.StringRes) Nullable(androidx.annotation.Nullable) ItemInstallQueue(com.android.launcher3.model.ItemInstallQueue) TYPE_FOLDER(com.android.launcher3.AbstractFloatingView.TYPE_FOLDER) LauncherAppWidgetHostView(com.android.launcher3.widget.LauncherAppWidgetHostView) DiscoveryBounce(com.android.launcher3.allapps.DiscoveryBounce) NORMAL(com.android.launcher3.LauncherState.NORMAL) PackageManagerHelper(com.android.launcher3.util.PackageManagerHelper) ArrowPopup(com.android.launcher3.popup.ArrowPopup) WidgetsFullSheet(com.android.launcher3.widget.picker.WidgetsFullSheet) FileLog(com.android.launcher3.logging.FileLog) FloatingSurfaceView(com.android.launcher3.views.FloatingSurfaceView) FLAG_NON_INTERACTIVE(com.android.launcher3.LauncherState.FLAG_NON_INTERACTIVE) ArrayList(java.util.ArrayList) FLAG_MULTI_PAGE(com.android.launcher3.LauncherState.FLAG_MULTI_PAGE) IntentSender(android.content.IntentSender) REQUEST_NONE(com.android.launcher3.states.RotationHelper.REQUEST_NONE) AppWidgetHostView(android.appwidget.AppWidgetHostView) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo) UserHandle(android.os.UserHandle) DragObject(com.android.launcher3.DropTarget.DragObject) SystemShortcut(com.android.launcher3.popup.SystemShortcut) PluginListener(com.android.systemui.plugins.PluginListener) PopupDataProvider(com.android.launcher3.popup.PopupDataProvider) ActivityContext(com.android.launcher3.views.ActivityContext) LauncherAppWidgetInfo(com.android.launcher3.model.data.LauncherAppWidgetInfo) StateManager(com.android.launcher3.statemanager.StateManager) TextUtils(android.text.TextUtils) FeatureFlags(com.android.launcher3.config.FeatureFlags) QuickstepTransitionManager(com.android.launcher3.QuickstepTransitionManager) AppWidgetManager(android.appwidget.AppWidgetManager) ComponentCallbacks2(android.content.ComponentCallbacks2) TouchController(com.android.launcher3.util.TouchController) WidgetsListBaseEntry(com.android.launcher3.widget.model.WidgetsListBaseEntry) Configuration(android.content.res.Configuration) AlphaProperty(com.android.launcher3.util.MultiValueAlpha.AlphaProperty) LAUNCHER_ONSTOP(com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ONSTOP) LauncherOverlayCallbacks(com.android.systemui.plugins.shared.LauncherOverlayManager.LauncherOverlayCallbacks) INSTALL(com.android.launcher3.popup.SystemShortcut.INSTALL) ValueAnimator(android.animation.ValueAnimator) Callbacks(com.android.launcher3.model.BgDataModel.Callbacks) SPRING_LOADED_EXIT_DELAY(com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY) PendingIntent(android.app.PendingIntent) KeyboardShortcutGroup(android.view.KeyboardShortcutGroup) NotificationChannel(android.app.NotificationChannel) View(android.view.View) NO_SCALE(com.android.launcher3.LauncherState.NO_SCALE) NotificationManager(android.app.NotificationManager) PinRequestHelper(com.android.launcher3.pm.PinRequestHelper) Predicate(java.util.function.Predicate) ObjectAnimator(android.animation.ObjectAnimator) CancellationSignal(android.os.CancellationSignal) BroadcastReceiver(android.content.BroadcastReceiver) PluginManagerWrapper(com.android.launcher3.uioverrides.plugins.PluginManagerWrapper) ViewGroup(android.view.ViewGroup) SparseArray(android.util.SparseArray) List(java.util.List) Utilities.postAsyncCallback(com.android.launcher3.Utilities.postAsyncCallback) LAUNCHER_STATE_HOME(com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME) NotificationListener(com.android.launcher3.notification.NotificationListener) REQUEST_LOCK(com.android.launcher3.states.RotationHelper.REQUEST_LOCK) LauncherAppWidgetProviderInfo(com.android.launcher3.widget.LauncherAppWidgetProviderInfo) LAUNCHER_WIDGET_RECONFIGURED(com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WIDGET_RECONFIGURED) CONFIG_UI_MODE(android.content.pm.ActivityInfo.CONFIG_UI_MODE) AllAppsContainerView(com.android.launcher3.allapps.AllAppsContainerView) Themes(com.android.launcher3.util.Themes) Context(android.content.Context) KeyEvent(android.view.KeyEvent) WidgetAddFlowHandler(com.android.launcher3.widget.WidgetAddFlowHandler) TYPE_SNACKBAR(com.android.launcher3.AbstractFloatingView.TYPE_SNACKBAR) FolderIcon(com.android.launcher3.folder.FolderIcon) Intent(android.content.Intent) HashMap(java.util.HashMap) UiThreadHelper(com.android.launcher3.util.UiThreadHelper) InstanceIdSequence(com.android.launcher3.logging.InstanceIdSequence) MotionEvent(android.view.MotionEvent) AnimatorSet(android.animation.AnimatorSet) DragLayer(com.android.launcher3.dragndrop.DragLayer) TYPE_ICON_SURFACE(com.android.launcher3.AbstractFloatingView.TYPE_ICON_SURFACE) UNINSTALL(com.android.launcher3.popup.SystemShortcut.UNINSTALL) StatefulActivity(com.android.launcher3.statemanager.StatefulActivity) PackageUserKey(com.android.launcher3.util.PackageUserKey) APP_INFO(com.android.launcher3.popup.SystemShortcut.APP_INFO) WidgetManagerHelper(com.android.launcher3.widget.WidgetManagerHelper) PropertyListBuilder(com.android.launcher3.anim.PropertyListBuilder) StatsLogManager(com.android.launcher3.logging.StatsLogManager) StrictMode(android.os.StrictMode) LauncherOverlayManager(com.android.systemui.plugins.shared.LauncherOverlayManager) FileDescriptor(java.io.FileDescriptor) StateHandler(com.android.launcher3.statemanager.StateManager.StateHandler) ScrimView(com.android.launcher3.views.ScrimView) Thunk(com.android.launcher3.util.Thunk) VisibleForTesting(androidx.annotation.VisibleForTesting) Collections(java.util.Collections) ViewGroup(android.view.ViewGroup) ItemInfoMatcher(com.android.launcher3.util.ItemInfoMatcher) ArrayList(java.util.ArrayList)

Aggregations

View (android.view.View)48 Point (android.graphics.Point)39 Rect (android.graphics.Rect)39 ItemInfo (com.android.launcher3.model.data.ItemInfo)29 WorkspaceItemInfo (com.android.launcher3.model.data.WorkspaceItemInfo)29 ObjectAnimator (android.animation.ObjectAnimator)28 Background (com.android.launcher3.tapl.Background)28 DragView (com.android.launcher3.dragndrop.DragView)26 DragLayer (com.android.launcher3.dragndrop.DragLayer)25 Animator (android.animation.Animator)24 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)24 LauncherAppWidgetHostView (com.android.launcher3.widget.LauncherAppWidgetHostView)24 Drawable (android.graphics.drawable.Drawable)23 ArrayList (java.util.ArrayList)23 ViewGroup (android.view.ViewGroup)22 ColorDrawable (android.graphics.drawable.ColorDrawable)21 Handler (android.os.Handler)21 FolderIcon (com.android.launcher3.folder.FolderIcon)21 DeepShortcutView (com.android.launcher3.shortcuts.DeepShortcutView)21 Bitmap (android.graphics.Bitmap)20