From 184a04266dab5fcb8ea563f13eff2972a9452604 Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Thu, 20 Oct 2022 13:15:19 -0700 Subject: [PATCH] Add transient taskbar UI This change is only for the visual appearance of the transient taskbar. Bug: 252905206 Test: manual Change-Id: I4990b20b39089a0c27ec2a72dd3010cf64ddba1d --- quickstep/res/layout/transient_taskbar.xml | 81 +++++++++++++++++++ quickstep/res/values/dimens.xml | 6 ++ .../launcher3/QuickstepTransitionManager.java | 5 +- .../taskbar/LauncherTaskbarUIController.java | 9 ++- .../taskbar/TaskbarActivityContext.java | 43 +++++++--- .../taskbar/TaskbarBackgroundRenderer.kt | 65 ++++++++++++--- .../launcher3/taskbar/TaskbarView.java | 8 +- .../taskbar/TaskbarViewController.java | 11 +++ .../overlay/TaskbarOverlayContext.java | 2 +- .../overlay/TaskbarOverlayController.java | 14 ++-- .../com/android/quickstep/views/TaskView.java | 12 ++- .../transient_taskbar_background.xml | 19 +++++ res/values/dimens.xml | 7 ++ src/com/android/launcher3/DeviceProfile.java | 4 +- .../launcher3/util/DisplayController.java | 9 +++ 15 files changed, 260 insertions(+), 35 deletions(-) create mode 100644 quickstep/res/layout/transient_taskbar.xml create mode 100644 res/color-v31/transient_taskbar_background.xml diff --git a/quickstep/res/layout/transient_taskbar.xml b/quickstep/res/layout/transient_taskbar.xml new file mode 100644 index 0000000000..f9ece84a4d --- /dev/null +++ b/quickstep/res/layout/transient_taskbar.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml index 3add4dc372..aadf853b5a 100644 --- a/quickstep/res/values/dimens.xml +++ b/quickstep/res/values/dimens.xml @@ -279,6 +279,12 @@ 48dp 32dp + + 76dp + 24dp + 40dp + 10dp + 24dp 40dp diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java index 8239d5e892..075fac242d 100644 --- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java +++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java @@ -108,6 +108,7 @@ import com.android.launcher3.testing.shared.ResourceUtils; import com.android.launcher3.touch.PagedOrientationHandler; import com.android.launcher3.uioverrides.QuickstepLauncher; import com.android.launcher3.util.ActivityOptionsWrapper; +import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.DynamicResource; import com.android.launcher3.util.ObjectWrapper; import com.android.launcher3.util.RunnableList; @@ -449,7 +450,9 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener 4 - rotationChange); } } - if (mDeviceProfile.isTaskbarPresentInApps && !target.willShowImeOnTarget) { + if (mDeviceProfile.isTaskbarPresentInApps + && !target.willShowImeOnTarget + && !DisplayController.isTransientTaskbar(mLauncher)) { // Animate to above the taskbar. bounds.bottom -= target.contentInsets.bottom; } diff --git a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java index 555cd65b3a..c9e42b7bac 100644 --- a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java @@ -44,6 +44,7 @@ import com.android.launcher3.logging.InstanceIdSequence; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.ItemInfoWithIcon; import com.android.launcher3.uioverrides.QuickstepLauncher; +import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.OnboardingPrefs; import com.android.quickstep.AnimatedFloat; import com.android.quickstep.RecentsAnimationCallbacks; @@ -227,7 +228,9 @@ public class LauncherTaskbarUIController extends TaskbarUIController { } else { // Adjust task transition spec to account for taskbar being visible @ColorInt int taskAnimationBackgroundColor = - mLauncher.getColor(R.color.taskbar_background); + DisplayController.isTransientTaskbar(mLauncher) + ? mLauncher.getColor(R.color.transient_taskbar_background) + : mLauncher.getColor(R.color.taskbar_background); TaskTransitionSpec customTaskAnimationSpec = new TaskTransitionSpec( taskAnimationBackgroundColor, @@ -286,6 +289,10 @@ public class LauncherTaskbarUIController extends TaskbarUIController { @Override public void setSystemGestureInProgress(boolean inProgress) { super.setSystemGestureInProgress(inProgress); + if (DisplayController.isTransientTaskbar(mLauncher)) { + forceHideBackground(false); + return; + } if (!FeatureFlags.ENABLE_TASKBAR_IN_OVERVIEW.get()) { // Launcher's ScrimView will draw the background throughout the gesture. But once the // gesture ends, start drawing taskbar's background again since launcher might stop diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 4c5e0bea8c..aab5d68b3d 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -135,14 +135,16 @@ public class TaskbarActivityContext extends BaseTaskbarContext { private boolean mBindingItems = false; private boolean mAddedWindow = false; + // The bounds of the taskbar items relative to TaskbarDragLayer + private final Rect mTransientTaskbarBounds = new Rect(); private final TaskbarShortcutMenuAccessibilityDelegate mAccessibilityDelegate; - public TaskbarActivityContext(Context windowContext, DeviceProfile dp, + public TaskbarActivityContext(Context windowContext, DeviceProfile launcherDp, TaskbarNavButtonController buttonController, ScopedUnfoldTransitionProgressProvider unfoldTransitionProgressProvider) { super(windowContext); - mDeviceProfile = dp.copy(this); + mDeviceProfile = launcherDp.copy(this); final Resources resources = getResources(); @@ -172,8 +174,10 @@ public class TaskbarActivityContext extends BaseTaskbarContext { mRightCorner = display.getRoundedCorner(RoundedCorner.POSITION_BOTTOM_RIGHT); // Inflate views. - mDragLayer = (TaskbarDragLayer) mLayoutInflater.inflate( - R.layout.taskbar, null, false); + int taskbarLayout = DisplayController.isTransientTaskbar(this) + ? R.layout.transient_taskbar + : R.layout.taskbar; + mDragLayer = (TaskbarDragLayer) mLayoutInflater.inflate(taskbarLayout, null, false); TaskbarView taskbarView = mDragLayer.findViewById(R.id.taskbar_view); TaskbarScrimView taskbarScrimView = mDragLayer.findViewById(R.id.taskbar_scrim); FrameLayout navButtonsView = mDragLayer.findViewById(R.id.navbuttons_view); @@ -212,7 +216,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { new TaskbarAutohideSuspendController(this), new TaskbarPopupController(this), new TaskbarForceVisibleImmersiveController(this), - new TaskbarOverlayController(this, dp), + new TaskbarOverlayController(this, launcherDp), new TaskbarAllAppsController(), new TaskbarInsetsController(this), new VoiceInteractionWindowController(this), @@ -243,10 +247,10 @@ public class TaskbarActivityContext extends BaseTaskbarContext { } /** Updates {@link DeviceProfile} instances for any Taskbar windows. */ - public void updateDeviceProfile(DeviceProfile dp, NavigationMode navMode) { + public void updateDeviceProfile(DeviceProfile launcherDp, NavigationMode navMode) { mNavMode = navMode; - mControllers.taskbarOverlayController.updateDeviceProfile(dp); - mDeviceProfile = dp.copy(this); + mControllers.taskbarOverlayController.updateLauncherDeviceProfile(launcherDp); + mDeviceProfile = launcherDp.copy(this); updateIconSize(getResources()); AbstractFloatingView.closeAllOpenViewsExcept(this, false, TYPE_REBIND_SAFE); @@ -257,12 +261,21 @@ public class TaskbarActivityContext extends BaseTaskbarContext { } private void updateIconSize(Resources resources) { - float taskbarIconSize = resources.getDimension(R.dimen.taskbar_icon_size); + float taskbarIconSize = DisplayController.isTransientTaskbar(this) + ? resources.getDimension(R.dimen.transient_taskbar_icon_size) + : resources.getDimension(R.dimen.taskbar_icon_size); mDeviceProfile.updateIconSize(1, resources); float iconScale = taskbarIconSize / mDeviceProfile.iconSizePx; mDeviceProfile.updateIconSize(iconScale, resources); } + /** + * Returns the View bounds of transient taskbar. + */ + public Rect getTransientTaskbarBounds() { + return mTransientTaskbarBounds; + } + @VisibleForTesting @Override public StatsLogManager getStatsLogManager() { @@ -623,16 +636,24 @@ public class TaskbarActivityContext extends BaseTaskbarContext { * Returns the default height of the window, including the static corner radii above taskbar. */ public int getDefaultTaskbarWindowHeight() { + Resources resources = getResources(); + if (FLAG_HIDE_NAVBAR_WINDOW && mDeviceProfile.isPhone) { - Resources resources = getResources(); return isThreeButtonNav() ? resources.getDimensionPixelSize(R.dimen.taskbar_size) : resources.getDimensionPixelSize(R.dimen.taskbar_stashed_size); } if (!isUserSetupComplete()) { - return getResources().getDimensionPixelSize(R.dimen.taskbar_suw_frame); + return resources.getDimensionPixelSize(R.dimen.taskbar_suw_frame); } + + if (DisplayController.isTransientTaskbar(this)) { + return resources.getDimensionPixelSize(R.dimen.transient_taskbar_size) + + (2 * resources.getDimensionPixelSize(R.dimen.transient_taskbar_margin)) + + resources.getDimensionPixelSize(R.dimen.transient_taskbar_shadow_blur); + } + return mDeviceProfile.taskbarSize + Math.max(getLeftCornerRadius(), getRightCornerRadius()); } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarBackgroundRenderer.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarBackgroundRenderer.kt index 1177bdb484..d0e2b22c19 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarBackgroundRenderer.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarBackgroundRenderer.kt @@ -16,10 +16,16 @@ package com.android.launcher3.taskbar +import com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound +import com.android.launcher3.Utilities.mapToRange + import android.graphics.Canvas +import android.graphics.Color import android.graphics.Paint import android.graphics.Path import com.android.launcher3.R +import com.android.launcher3.anim.Interpolators +import com.android.launcher3.util.DisplayController /** * Helps draw the taskbar background, made up of a rectangle plus two inverted rounded corners. @@ -29,6 +35,13 @@ class TaskbarBackgroundRenderer(context: TaskbarActivityContext) { val paint: Paint = Paint() var backgroundHeight = context.deviceProfile.taskbarSize.toFloat() + private var maxBackgroundHeight = context.deviceProfile.taskbarSize.toFloat() + private val transientBackgroundBounds = context.transientTaskbarBounds + + private var shadowBlur = 0f + private var keyShadowDistance = 0f + private var bottomMargin = 0 + private val leftCornerRadius = context.leftCornerRadius.toFloat() private val rightCornerRadius = context.rightCornerRadius.toFloat() private val invertedLeftCornerPath: Path = Path() @@ -39,6 +52,15 @@ class TaskbarBackgroundRenderer(context: TaskbarActivityContext) { paint.flags = Paint.ANTI_ALIAS_FLAG paint.style = Paint.Style.FILL + if (DisplayController.isTransientTaskbar(context)) { + paint.color = context.getColor(R.color.transient_taskbar_background) + + val res = context.resources + bottomMargin = res.getDimensionPixelSize(R.dimen.transient_taskbar_margin) + shadowBlur = res.getDimension(R.dimen.transient_taskbar_shadow_blur) + keyShadowDistance = res.getDimension(R.dimen.transient_taskbar_key_shadow_distance) + } + // Create the paths for the inverted rounded corners above the taskbar. Start with a filled // square, and then subtract out a circle from the appropriate corner. val square = Path() @@ -58,17 +80,42 @@ class TaskbarBackgroundRenderer(context: TaskbarActivityContext) { */ fun draw(canvas: Canvas) { canvas.save() - canvas.translate(0f, canvas.height - backgroundHeight) + canvas.translate(0f, canvas.height - backgroundHeight - bottomMargin) + if (transientBackgroundBounds.isEmpty) { + // Draw the background behind taskbar content. + canvas.drawRect(0f, 0f, canvas.width.toFloat(), backgroundHeight, paint) - // Draw the background behind taskbar content. - canvas.drawRect(0f, 0f, canvas.width.toFloat(), backgroundHeight, paint) + // Draw the inverted rounded corners above the taskbar. + canvas.translate(0f, -leftCornerRadius) + canvas.drawPath(invertedLeftCornerPath, paint) + canvas.translate(0f, leftCornerRadius) + canvas.translate(canvas.width - rightCornerRadius, -rightCornerRadius) + canvas.drawPath(invertedRightCornerPath, paint) + } else { + val scaleFactor = backgroundHeight / maxBackgroundHeight + val width = transientBackgroundBounds.width() + val widthScale = mapToRange(scaleFactor, 0f, 1f, 0.4f, 1f, Interpolators.LINEAR) + val newWidth = widthScale * width + val delta = width - newWidth - // Draw the inverted rounded corners above the taskbar. - canvas.translate(0f, -leftCornerRadius) - canvas.drawPath(invertedLeftCornerPath, paint) - canvas.translate(0f, leftCornerRadius) - canvas.translate(canvas.width - rightCornerRadius, -rightCornerRadius) - canvas.drawPath(invertedRightCornerPath, paint) + // Draw shadow. + val shadowAlpha = mapToRange(paint.alpha.toFloat(), 0f, 255f, 0f, 25f, + Interpolators.LINEAR) + paint.setShadowLayer(shadowBlur, 0f, keyShadowDistance, + setColorAlphaBound(Color.BLACK, Math.round(shadowAlpha)) + ) + + // Draw background. + val radius = backgroundHeight / 2f; + + canvas.drawRoundRect( + transientBackgroundBounds.left + (delta / 2f), + 0f, + transientBackgroundBounds.right - (delta / 2f), + backgroundHeight, + radius, radius, paint + ) + } canvas.restore() } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java index 31c2132888..55734955cc 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java @@ -44,6 +44,7 @@ import com.android.launcher3.icons.ThemedIconDrawable; import com.android.launcher3.model.data.FolderInfo; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.WorkspaceItemInfo; +import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.LauncherBindableItemsContainer; import com.android.launcher3.views.ActivityContext; import com.android.launcher3.views.DoubleShadowBubbleTextView; @@ -60,7 +61,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar public int mThemeIconsBackground; private final int[] mTempOutLocation = new int[2]; - private final Rect mIconLayoutBounds = new Rect(); + private final Rect mIconLayoutBounds; private final int mIconTouchSize; private final int mItemMarginLeftRight; private final int mItemPadding; @@ -106,11 +107,14 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); mActivityContext = ActivityContext.lookupContext(context); + mIconLayoutBounds = mActivityContext.getTransientTaskbarBounds(); Resources resources = getResources(); mIconTouchSize = resources.getDimensionPixelSize(R.dimen.taskbar_icon_touch_size); - int actualMargin = resources.getDimensionPixelSize(R.dimen.taskbar_icon_spacing); + int actualMargin = DisplayController.isTransientTaskbar(mActivityContext) + ? resources.getDimensionPixelSize(R.dimen.transient_taskbar_icon_spacing) + : resources.getDimensionPixelSize(R.dimen.taskbar_icon_spacing); int actualIconSize = mActivityContext.getDeviceProfile().iconSizePx; // We layout the icons to be of mIconTouchSize in width and height diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java index 16dd90db29..87198f68c0 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java @@ -17,6 +17,7 @@ package com.android.launcher3.taskbar; import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY; import static com.android.launcher3.LauncherAnimUtils.VIEW_ALPHA; +import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_Y; import static com.android.launcher3.Utilities.squaredHypot; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_ALLAPPS_BUTTON_TAP; @@ -47,6 +48,7 @@ import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.folder.FolderIcon; import com.android.launcher3.icons.ThemedIconDrawable; import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.HorizontalInsettableView; import com.android.launcher3.util.ItemInfoMatcher; import com.android.launcher3.util.LauncherBindableItemsContainer; @@ -87,6 +89,8 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar private AnimatedFloat mTaskbarNavButtonTranslationY; private AnimatedFloat mTaskbarNavButtonTranslationYForInAppDisplay; + private final int mTaskbarBottomMargin; + private final AnimatedFloat mThemeIconsBackground = new AnimatedFloat( this::updateIconsBackground); @@ -111,6 +115,9 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar mTaskbarIconAlpha = new MultiValueAlpha(mTaskbarView, NUM_ALPHA_CHANNELS); mTaskbarIconAlpha.setUpdateVisibility(true); mModelCallbacks = new TaskbarModelCallbacks(activity, mTaskbarView); + mTaskbarBottomMargin = DisplayController.isTransientTaskbar(activity) + ? activity.getResources().getDimensionPixelSize(R.dimen.transient_taskbar_margin) + : 0; } public void init(TaskbarControllers controllers) { @@ -316,6 +323,8 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar float scale = ((float) taskbarDp.iconSizePx) / launcherDp.hotseatQsbVisualHeight; setter.addFloat(child, SCALE_PROPERTY, scale, 1f, LINEAR); + setter.setFloat(child, VIEW_TRANSLATE_Y, mTaskbarBottomMargin, LINEAR); + setter.addFloat(child, VIEW_ALPHA, 0f, 1f, isToHome ? Interpolators.clampToProgress(LINEAR, 0f, 0.35f) @@ -341,6 +350,8 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar float childCenter = (child.getLeft() + child.getRight()) / 2f; setter.setFloat(child, ICON_TRANSLATE_X, hotseatIconCenter - childCenter, LINEAR); + setter.setFloat(child, VIEW_TRANSLATE_Y, mTaskbarBottomMargin, LINEAR); + setter.setFloat(child, SCALE_PROPERTY, scaleUp, LINEAR); } diff --git a/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayContext.java b/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayContext.java index 5701de0e9c..7e3163ddc5 100644 --- a/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayContext.java @@ -84,7 +84,7 @@ public class TaskbarOverlayContext extends BaseTaskbarContext { @Override public DeviceProfile getDeviceProfile() { - return mOverlayController.getDeviceProfile(); + return mOverlayController.getLauncherDeviceProfile(); } @Override diff --git a/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayController.java b/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayController.java index 0574058dcc..6c7bdbfd21 100644 --- a/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayController.java +++ b/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayController.java @@ -63,17 +63,17 @@ public final class TaskbarOverlayController { } }; - private DeviceProfile mDeviceProfile; + private DeviceProfile mLauncherDeviceProfile; private @Nullable TaskbarOverlayContext mOverlayContext; private TaskbarControllers mControllers; // Initialized in init. public TaskbarOverlayController( - TaskbarActivityContext taskbarContext, DeviceProfile deviceProfile) { + TaskbarActivityContext taskbarContext, DeviceProfile launcherDeviceProfile) { mTaskbarContext = taskbarContext; mWindowContext = mTaskbarContext.createWindowContext(TYPE_APPLICATION_OVERLAY, null); mProxyView = new TaskbarOverlayProxyView(); mLayoutParams = createLayoutParams(); - mDeviceProfile = deviceProfile; + mLauncherDeviceProfile = launcherDeviceProfile; } /** Initialize the controller. */ @@ -132,13 +132,13 @@ public final class TaskbarOverlayController { } /** The current device profile for the overlay window. */ - public DeviceProfile getDeviceProfile() { - return mDeviceProfile; + public DeviceProfile getLauncherDeviceProfile() { + return mLauncherDeviceProfile; } /** Updates {@link DeviceProfile} instance for Taskbar's overlay window. */ - public void updateDeviceProfile(DeviceProfile dp) { - mDeviceProfile = dp; + public void updateLauncherDeviceProfile(DeviceProfile dp) { + mLauncherDeviceProfile = dp; Optional.ofNullable(mOverlayContext).ifPresent(c -> { AbstractFloatingView.closeAllOpenViewsExcept(c, false, TYPE_REBIND_SAFE); c.dispatchDeviceProfileChanged(); diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java index 35f0f5d1df..188e643db5 100644 --- a/quickstep/src/com/android/quickstep/views/TaskView.java +++ b/quickstep/src/com/android/quickstep/views/TaskView.java @@ -78,6 +78,7 @@ import com.android.launcher3.testing.shared.TestProtocol; import com.android.launcher3.touch.PagedOrientationHandler; import com.android.launcher3.util.ActivityOptionsWrapper; import com.android.launcher3.util.ComponentKey; +import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.RunnableList; import com.android.launcher3.util.SplitConfigurationOptions; import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption; @@ -1574,9 +1575,12 @@ public class TaskView extends FrameLayout implements Reusable { /** The current scale we apply to the thumbnail to adjust for new left/right insets. */ public float mScale = 1; + private boolean mIsTaskbarTransient; + public FullscreenDrawParams(Context context) { mCornerRadius = TaskCornerRadius.get(context); mWindowCornerRadius = QuickStepContract.getWindowCornerRadius(context); + mIsTaskbarTransient = DisplayController.isTransientTaskbar(context); mCurrentDrawnCornerRadius = mCornerRadius; } @@ -1586,7 +1590,7 @@ public class TaskView extends FrameLayout implements Reusable { */ public void setProgress(float fullscreenProgress, float parentScale, float taskViewScale, int previewWidth, DeviceProfile dp, PreviewPositionHelper pph) { - RectF insets = getInsetsToDrawInFullscreen(pph, dp); + RectF insets = getInsetsToDrawInFullscreen(pph, dp, mIsTaskbarTransient); float currentInsetsLeft = insets.left * fullscreenProgress; float currentInsetsTop = insets.top * fullscreenProgress; @@ -1609,7 +1613,11 @@ public class TaskView extends FrameLayout implements Reusable { /** * Insets to used for clipping the thumbnail (in case it is drawing outside its own space) */ - private static RectF getInsetsToDrawInFullscreen(PreviewPositionHelper pph, DeviceProfile dp) { + private static RectF getInsetsToDrawInFullscreen(PreviewPositionHelper pph, + DeviceProfile dp, boolean isTaskbarTransient) { + if (isTaskbarTransient) { + return pph.getClippedInsets(); + } return dp.isTaskbarPresent && !dp.isTaskbarPresentInApps ? pph.getClippedInsets() : EMPTY_RECT_F; } diff --git a/res/color-v31/transient_taskbar_background.xml b/res/color-v31/transient_taskbar_background.xml new file mode 100644 index 0000000000..bce947da79 --- /dev/null +++ b/res/color-v31/transient_taskbar_background.xml @@ -0,0 +1,19 @@ + + + + + + diff --git a/res/values/dimens.xml b/res/values/dimens.xml index a9ba07d2b1..0a28b6c62f 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -361,6 +361,13 @@ 18dp 0dp 44dp + 57dp + + 0dp + 0dp + 0dp + 0dp + 10dp 8dp 0dp diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 1c26f04b25..edd809c39b 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -312,7 +312,9 @@ public class DeviceProfile { } if (isTaskbarPresent) { - taskbarSize = res.getDimensionPixelSize(R.dimen.taskbar_size); + taskbarSize = DisplayController.isTransientTaskbar(context) + ? res.getDimensionPixelSize(R.dimen.transient_taskbar_size) + : res.getDimensionPixelSize(R.dimen.taskbar_size); stashedTaskbarSize = res.getDimensionPixelSize(R.dimen.taskbar_stashed_size); } diff --git a/src/com/android/launcher3/util/DisplayController.java b/src/com/android/launcher3/util/DisplayController.java index e57c88d98c..f9f7ac0df1 100644 --- a/src/com/android/launcher3/util/DisplayController.java +++ b/src/com/android/launcher3/util/DisplayController.java @@ -20,6 +20,7 @@ import static android.view.Display.DEFAULT_DISPLAY; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION; import static com.android.launcher3.Utilities.dpiFromPx; +import static com.android.launcher3.config.FeatureFlags.ENABLE_TRANSIENT_TASKBAR; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.launcher3.util.PackageManagerHelper.getPackageFilter; import static com.android.launcher3.util.window.WindowManagerProxy.MIN_TABLET_WIDTH; @@ -123,6 +124,14 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable { return INSTANCE.get(context).getInfo().navigationMode; } + /** + * Returns whether taskbar is transient. + */ + public static boolean isTransientTaskbar(Context context) { + return ENABLE_TRANSIENT_TASKBAR.get() + && getNavigationMode(context) == NavigationMode.NO_BUTTON; + } + @Override public void close() { mDestroyed = true;