diff --git a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java index 85db194d46..5dc4fd142a 100644 --- a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java @@ -172,8 +172,9 @@ public class KeyboardQuickSwitchViewController { // Calculate the additional margin space that the KQS should move up for the transient // taskbar. The value of spaceForTaskbar is the distance between the bottom of the KQS // view with 0 bottom margin to the top of the transient taskbar view. - final int spaceForTaskbar = isTransientTaskbar ? dp.taskbarHeight + dp.taskbarBottomMargin - - dp.stashedTaskbarHeight : 0; + final int spaceForTaskbar = isTransientTaskbar ? dp.getTaskbarProfile().getHeight() + + dp.getTaskbarProfile().getBottomMargin() + - dp.getTaskbarProfile().getStashedTaskbarHeight() : 0; final int marginBottom = spaceForTaskbar + resources.getDimensionPixelSize( R.dimen.keyboard_quick_switch_margin_bottom); diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java index 4120a90020..e70e59d655 100644 --- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java @@ -366,7 +366,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT flags -> (flags & flagsToRemoveTranslation) != 0, AnimatedFloat.VALUE, 1, 0)); // Center nav buttons in new height for IME. - float transForIme = (mContext.getDeviceProfile().taskbarHeight + float transForIme = (mContext.getDeviceProfile().getTaskbarProfile().getHeight() - mControllers.taskbarInsetsController.getTaskbarHeightForIme()) / 2f; // For gesture nav, nav buttons only show for IME anyway so keep them translated down. float defaultButtonTransY = alwaysShowButtons ? 0 : transForIme; diff --git a/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java b/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java index 20a049313a..c19d883e96 100644 --- a/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java @@ -130,11 +130,11 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT mStashedHandleWidth = resources.getDimensionPixelSize(R.dimen.taskbar_stashed_small_screen); } else { - mTaskbarSize = deviceProfile.taskbarHeight; + mTaskbarSize = deviceProfile.getTaskbarProfile().getHeight(); mStashedHandleWidth = resources .getDimensionPixelSize(R.dimen.taskbar_stashed_handle_width); } - int taskbarBottomMargin = deviceProfile.taskbarBottomMargin; + int taskbarBottomMargin = deviceProfile.getTaskbarProfile().getBottomMargin(); mStashedHandleView.getLayoutParams().height = mTaskbarSize + taskbarBottomMargin; mTaskbarStashedHandleAlpha.get(ALPHA_INDEX_STASHED).setValue( diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 9ce3fe83c7..0fe3eefd89 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -472,7 +472,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { deviceProfile.hotseatQsbWidth = originDeviceProfile.hotseatQsbWidth; // Update icon size - deviceProfile.iconSizePx = deviceProfile.taskbarIconSize; + deviceProfile.iconSizePx = deviceProfile.getTaskbarProfile().getIconSize(); deviceProfile.updateIconSize(1f, this); }; mDeviceProfile = originDeviceProfile.toBuilder(this) @@ -816,7 +816,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { /** Returns whether taskbar should start align. */ public boolean shouldStartAlignTaskbar() { - return isThreeButtonNav() && mDeviceProfile.startAlignTaskbar; + return isThreeButtonNav() && mDeviceProfile.getTaskbarProfile().isStartAlignTaskbar(); } public boolean isGestureNav() { @@ -1382,15 +1382,15 @@ public class TaskbarActivityContext extends BaseTaskbarContext { DeviceProfile transientTaskbarDp = mDeviceProfile.toBuilder(this) .setIsTransientTaskbar(true).build(); - taskbarWindowSize = transientTaskbarDp.taskbarHeight - + (2 * transientTaskbarDp.taskbarBottomMargin) + taskbarWindowSize = transientTaskbarDp.getTaskbarProfile().getHeight() + + (2 * transientTaskbarDp.getTaskbarProfile().getBottomMargin()) + Math.max(extraHeightForTaskbarTooltips, resources.getDimensionPixelSize( R.dimen.transient_taskbar_shadow_blur)); return Math.max(taskbarWindowSize, bubbleBarTop); } - taskbarWindowSize = mDeviceProfile.taskbarHeight + taskbarWindowSize = mDeviceProfile.getTaskbarProfile().getHeight() + getCornerRadius() + extraHeightForTaskbarTooltips; return Math.max(taskbarWindowSize, bubbleBarTop); diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarBackgroundRenderer.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarBackgroundRenderer.kt index 70a303ca8e..bd33177bfa 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarBackgroundRenderer.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarBackgroundRenderer.kt @@ -40,9 +40,9 @@ class TaskbarBackgroundRenderer(private val context: TaskbarActivityContext) { private val isInSetup: Boolean = !context.isUserSetupComplete private val maxTransientTaskbarHeight = - context.transientTaskbarDeviceProfile.taskbarHeight.toFloat() + context.transientTaskbarDeviceProfile.taskbarProfile.height.toFloat() private val maxPersistentTaskbarHeight = - context.persistentTaskbarDeviceProfile.taskbarHeight.toFloat() + context.persistentTaskbarDeviceProfile.taskbarProfile.height.toFloat() var backgroundProgress = if (context.isTransientTaskbar) { PINNING_TRANSIENT @@ -57,7 +57,7 @@ class TaskbarBackgroundRenderer(private val context: TaskbarActivityContext) { val paint = Paint() private val strokePaint = Paint() val lastDrawnTransientRect = RectF() - var backgroundHeight = context.deviceProfile.taskbarHeight.toFloat() + var backgroundHeight = context.deviceProfile.taskbarProfile.height.toFloat() var translationYForSwipe = 0f var translationYForStash = 0f var translationXForBubbleBar = 0f @@ -195,10 +195,10 @@ class TaskbarBackgroundRenderer(private val context: TaskbarActivityContext) { scale = Math.round(scale * 100f) / 100f bottomMargin = mapRange( - scale, - 0f, - res.getDimensionPixelSize(R.dimen.transient_taskbar_bottom_margin).toFloat(), - ) + scale, + 0f, + res.getDimensionPixelSize(R.dimen.transient_taskbar_bottom_margin).toFloat(), + ) .toInt() shadowBlur = mapRange(scale, 0f, res.getDimension(R.dimen.transient_taskbar_shadow_blur)) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt index 7f6185dab3..3ae06abea4 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDividerPopupView.kt @@ -267,8 +267,8 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 } override fun getExtraVerticalOffset(): Int { - return (mActivityContext.deviceProfile.taskbarHeight - - mActivityContext.deviceProfile.taskbarIconSize) / 2 + verticalOffsetForPopupView + return (mActivityContext.deviceProfile.taskbarProfile.height - + mActivityContext.deviceProfile.taskbarProfile.iconSize) / 2 + verticalOffsetForPopupView } override fun onCreateCloseAnimation(anim: AnimatorSet?) { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java index 174a02b4ea..8bd685b3d6 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java @@ -163,9 +163,14 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa * @return Bounds (in TaskbarDragLayer coordinates) where an opened Folder can display. */ public Rect getFolderBoundingBox() { - Rect boundingBox = new Rect(0, 0, mTaskbarDragLayer.getWidth(), - mTaskbarDragLayer.getHeight() - mActivity.getDeviceProfile().taskbarHeight - - mActivity.getDeviceProfile().taskbarBottomMargin); + Rect boundingBox = new Rect( + 0, + 0, + mTaskbarDragLayer.getWidth(), + mTaskbarDragLayer.getHeight() + - mActivity.getDeviceProfile().getTaskbarProfile().getHeight() + - mActivity.getDeviceProfile().getTaskbarProfile().getBottomMargin() + ); boundingBox.inset(mFolderMargin, mFolderMargin); return boundingBox; } @@ -352,7 +357,7 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa deviceProfile.getDisplayInfo().currentSize.y : taskbarDimensions.y; } else { - return deviceProfile.taskbarHeight; + return deviceProfile.getTaskbarProfile().getHeight(); } } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltip.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltip.kt index f3ea655866..f8ac8cdd36 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltip.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltip.kt @@ -85,7 +85,7 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 // constraint to reduce the number of lines of text and hopefully free up some height. activityContext.dragLayer.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED) if ( - measuredHeight + activityContext.deviceProfile.taskbarHeight >= + measuredHeight + activityContext.deviceProfile.taskbarProfile.height >= activityContext.deviceProfile.deviceProperties.availableHeightPx ) { updateLayoutParams { width = MATCH_PARENT } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt index 990c575119..9a120f5611 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarEduTooltipController.kt @@ -245,7 +245,7 @@ open class TaskbarEduTooltipController(context: Context) : else R.dimen.taskbar_edu_features_tooltip_width_with_two_features ) - bottomMargin += activityContext.deviceProfile.taskbarHeight + bottomMargin += activityContext.deviceProfile.taskbarProfile.height } else { width = resources.getDimensionPixelSize( @@ -299,7 +299,7 @@ open class TaskbarEduTooltipController(context: Context) : handleEduAnimations(listOf(pinningAnim)) updateLayoutParams { if (activityContext.isTransientTaskbar) { - bottomMargin += activityContext.deviceProfile.taskbarHeight + bottomMargin += activityContext.deviceProfile.taskbarProfile.height } // Unlike other tooltips, we want to align with taskbar divider rather than center. gravity = Gravity.BOTTOM @@ -356,7 +356,7 @@ open class TaskbarEduTooltipController(context: Context) : showDisclosureText(eduSubtitle) updateLayoutParams { if (activityContext.isTransientTaskbar) { - bottomMargin += activityContext.deviceProfile.taskbarHeight + bottomMargin += activityContext.deviceProfile.taskbarProfile.height } // Unlike other tooltips, we want to align with the all apps button rather than // center. diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java index 6865bd6423..abbfc95255 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java @@ -804,8 +804,11 @@ public class TaskbarLauncherStateController { taskbarBgOffsetStart, taskbarBgOffsetEnd); ObjectAnimator taskbarIconsYTranslation = null; - float taskbarHeight = - mControllers.taskbarActivityContext.getDeviceProfile().taskbarHeight; + float taskbarHeight = mControllers + .taskbarActivityContext + .getDeviceProfile() + .getTaskbarProfile() + .getHeight(); if (showTaskbar) { taskbarIconsYTranslation = taskbarIconTranslationYForHome.animateToValue( taskbarHeight, 0); diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java index 2b774e9733..44832b52db 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java @@ -292,7 +292,10 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba // Move the icon to align with the center-top of the touch point Point iconShift = new Point(); iconShift.x = mIconLastTouchPos.x - sv.getIconCenter().x; - iconShift.y = mIconLastTouchPos.y - mContext.getDeviceProfile().taskbarIconSize; + iconShift.y = mIconLastTouchPos.y + - mContext.getDeviceProfile() + .getTaskbarProfile() + .getIconSize(); ((TaskbarDragController) ActivityContext.lookupContext( v.getContext()).getDragController()).startDragOnLongClick(sv, iconShift); diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java index 94d348b0b3..22ff3bedbb 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java @@ -322,8 +322,11 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba mStashedHeight = mActivity.getResources().getDimensionPixelSize( R.dimen.taskbar_stashed_size); } else { - mUnstashedHeight = mActivity.getDeviceProfile().taskbarHeight; - mStashedHeight = mActivity.getDeviceProfile().stashedTaskbarHeight; + mUnstashedHeight = mActivity.getDeviceProfile().getTaskbarProfile().getHeight(); + mStashedHeight = mActivity + .getDeviceProfile() + .getTaskbarProfile() + .getStashedTaskbarHeight(); } } @@ -512,7 +515,11 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba public int getTouchableHeight() { return mIsStashed ? mStashedHeight - : (mUnstashedHeight + mActivity.getDeviceProfile().taskbarBottomMargin); + : (mUnstashedHeight + + mActivity.getDeviceProfile() + .getTaskbarProfile() + .getBottomMargin() + ); } /** diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashViaTouchController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashViaTouchController.kt index 7793642eda..fd259223d2 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashViaTouchController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashViaTouchController.kt @@ -47,7 +47,8 @@ class TaskbarStashViaTouchController(val controllers: TaskbarControllers) : Touc private val maxVisualDisplacement = activity.resources.getDimensionPixelSize(R.dimen.transient_taskbar_bottom_margin).toFloat() /** How far the swipe could go, if user swiped from the very top of TaskbarView. */ - private val maxTouchDisplacement = maxVisualDisplacement + activity.deviceProfile.taskbarHeight + private val maxTouchDisplacement = + maxVisualDisplacement + activity.deviceProfile.taskbarProfile.height private val touchDisplacementToStash = activity.resources.getDimensionPixelSize(R.dimen.taskbar_to_nav_threshold).toFloat() diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java index d59002c5cf..48686ee40e 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java @@ -162,10 +162,11 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar onDeviceProfileChanged(mActivityContext.getDeviceProfile()); int actualMargin = resources.getDimensionPixelSize(R.dimen.taskbar_icon_spacing); - int actualIconSize = mActivityContext.getDeviceProfile().taskbarIconSize; + int actualIconSize = + mActivityContext.getDeviceProfile().getTaskbarProfile().getIconSize(); if (enableTaskbarPinning() && canTransitionToTransientTaskbar()) { DeviceProfile deviceProfile = mActivityContext.getTransientTaskbarDeviceProfile(); - actualIconSize = deviceProfile.taskbarIconSize; + actualIconSize = deviceProfile.getTaskbarProfile().getIconSize(); } int visualIconSize = (int) (actualIconSize * ICON_VISIBLE_AREA_FACTOR); @@ -178,7 +179,10 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar // We always layout taskbar as a transient taskbar when we have taskbar pinning feature on, // then we scale and translate the icons to match persistent taskbar designs, so we use // taskbar icon size from current device profile to calculate correct item padding. - mItemPadding = (mIconTouchSize - mActivityContext.getDeviceProfile().taskbarIconSize) / 2; + mItemPadding = (mIconTouchSize - mActivityContext + .getDeviceProfile() + .getTaskbarProfile() + .getIconSize()) / 2; mFolderLeaveBehindColor = Themes.getAttrColor(mActivityContext, android.R.attr.textColorTertiary); diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java index e42c11ad5a..f5e6f14da7 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java @@ -231,14 +231,14 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar mActivity = activity; mTransientTaskbarDp = mActivity.getTransientTaskbarDeviceProfile(); mPersistentTaskbarDp = mActivity.getPersistentTaskbarDeviceProfile(); - mTransientIconSize = mTransientTaskbarDp.taskbarIconSize; - mPersistentIconSize = mPersistentTaskbarDp.taskbarIconSize; + mTransientIconSize = mTransientTaskbarDp.getTaskbarProfile().getIconSize(); + mPersistentIconSize = mPersistentTaskbarDp.getTaskbarProfile().getIconSize(); mTaskbarView = taskbarView; mTaskbarIconAlpha = new MultiValueAlpha(mTaskbarView, NUM_ALPHA_CHANNELS); mTaskbarIconAlpha.setUpdateVisibility(true); mModelCallbacks = TaskbarModelCallbacksFactory.newInstance(mActivity) .create(mActivity, mTaskbarView); - mTaskbarBottomMargin = activity.getDeviceProfile().taskbarBottomMargin; + mTaskbarBottomMargin = activity.getDeviceProfile().getTaskbarProfile().getBottomMargin(); mStashedHandleHeight = activity.getResources() .getDimensionPixelSize(R.dimen.taskbar_stashed_handle_height); @@ -271,7 +271,7 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar mControllers.runAfterInit(mTaskbarView::updatePinningPopupEventHandlers); mTaskbarView.getLayoutParams().height = mActivity.isPhoneMode() ? mActivity.getResources().getDimensionPixelSize(R.dimen.taskbar_phone_size) - : mActivity.getDeviceProfile().taskbarHeight; + : mActivity.getDeviceProfile().getTaskbarProfile().getHeight(); mTaskbarIconScaleForStash.updateValue(1f); float pinningValue = @@ -687,17 +687,19 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar // finally placing the icon in the middle of new taskbar background height. if (mControllers.getSharedState().startTaskbarVariantIsTransient) { float transY = - mTransientTaskbarDp.taskbarBottomMargin + (mTransientTaskbarDp.taskbarHeight + mTransientTaskbarDp.getTaskbarProfile().getBottomMargin() + ( + mTransientTaskbarDp.getTaskbarProfile().getHeight() - mTaskbarView.getTransientTaskbarIconLayoutBounds().bottom) - - (mPersistentTaskbarDp.taskbarHeight - - mTransientTaskbarDp.taskbarIconSize) / 2f; + - (mPersistentTaskbarDp.getTaskbarProfile().getHeight() + - mTransientTaskbarDp.getTaskbarProfile().getIconSize()) / 2f; taskbarIconTranslationYForPinningValue = mapRange(scale, 0f, transY); } else { float transY = - -mTransientTaskbarDp.taskbarBottomMargin + (mPersistentTaskbarDp.taskbarHeight + -mTransientTaskbarDp.getTaskbarProfile().getBottomMargin() + ( + mPersistentTaskbarDp.getTaskbarProfile().getHeight() - mTaskbarView.getTransientTaskbarIconLayoutBounds().bottom) - - (mTransientTaskbarDp.taskbarHeight - - mTransientTaskbarDp.taskbarIconSize) / 2f; + - (mTransientTaskbarDp.getTaskbarProfile().getHeight() + - mTransientTaskbarDp.getTaskbarProfile().getIconSize()) / 2f; taskbarIconTranslationYForPinningValue = mapRange(scale, transY, 0f); } return taskbarIconTranslationYForPinningValue; @@ -982,12 +984,16 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar Rect hotseatPadding = launcherDp.getHotseatLayoutPadding(mActivity); boolean isTransientTaskbar = mActivity.isTransientTaskbar(); - float scaleUp = ((float) launcherDp.iconSizePx) / taskbarDp.taskbarIconSize; + float scaleUp = ((float) launcherDp.iconSizePx) + / taskbarDp.getTaskbarProfile().getIconSize(); int borderSpacing = launcherDp.hotseatBorderSpace; int hotseatCellSize = DeviceProfile.calculateCellWidth( - launcherDp.getDeviceProperties().getAvailableWidthPx() - hotseatPadding.left - hotseatPadding.right, + launcherDp.getDeviceProperties().getAvailableWidthPx() + - hotseatPadding.left + - hotseatPadding.right, borderSpacing, - launcherDp.numShownHotseatIcons); + launcherDp.numShownHotseatIcons + ); boolean isToHome = mControllers.uiController.isIconAlignedWithHotseat(); boolean isDeviceLocked = mControllers.taskbarStashController.isDeviceLocked(); @@ -1012,13 +1018,14 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar } } int collapsedHeight = mActivity.getDefaultTaskbarWindowSize(); - int expandedHeight = Math.max(collapsedHeight, taskbarDp.taskbarHeight + offsetY); + int expandedHeight = Math.max(collapsedHeight, + taskbarDp.getTaskbarProfile().getHeight() + offsetY); setter.addOnFrameListener(anim -> mActivity.setTaskbarWindowSize( anim.getAnimatedFraction() > 0 ? expandedHeight : collapsedHeight)); mTaskbarBottomMargin = isTransientTaskbar - ? mTransientTaskbarDp.taskbarBottomMargin - : mPersistentTaskbarDp.taskbarBottomMargin; + ? mTransientTaskbarDp.getTaskbarProfile().getBottomMargin() + : mPersistentTaskbarDp.getTaskbarProfile().getBottomMargin(); int firstRecentTaskIndex = -1; int hotseatNavBarTranslationX = 0; @@ -1078,8 +1085,9 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar INDEX_TASKBAR_PINNING_ANIM).getValue(); } float halfQsbIconWidthDiff = - (launcherDp.hotseatQsbWidth - taskbarDp.taskbarIconSize) / 2f; - float scale = ((float) taskbarDp.taskbarIconSize) + (launcherDp.hotseatQsbWidth - taskbarDp.getTaskbarProfile().getIconSize()) + / 2f; + float scale = ((float) taskbarDp.getTaskbarProfile().getIconSize()) / launcherDp.getHotseatProfile().getQsbVisualHeight(); setter.addFloat(child, SCALE_PROPERTY, scale, 1f, interpolator); diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java index 94e39d63bd..29c34a07bc 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java @@ -859,7 +859,7 @@ public class BubbleBarViewController { float mediumIconSize = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, APP_ICON_MEDIUM_DP, dm); float smallMediumThreshold = (smallIconSize + mediumIconSize) / 2f; - int taskbarIconSize = deviceProfile.taskbarIconSize; + int taskbarIconSize = deviceProfile.getTaskbarProfile().getIconSize(); return taskbarIconSize <= smallMediumThreshold ? res.getDimensionPixelSize(R.dimen.bubblebar_icon_size_small) : res.getDimensionPixelSize(R.dimen.bubblebar_icon_size); @@ -877,7 +877,7 @@ public class BubbleBarViewController { float largeIconSize = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, APP_ICON_LARGE_DP, dm); float mediumLargeThreshold = (mediumIconSize + largeIconSize) / 2f; - return deviceProfile.taskbarIconSize >= mediumLargeThreshold + return deviceProfile.getTaskbarProfile().getIconSize() >= mediumLargeThreshold ? res.getDimensionPixelSize(R.dimen.bubblebar_icon_spacing_large) : res.getDimensionPixelSize(R.dimen.bubblebar_icon_spacing); } @@ -954,9 +954,11 @@ public class BubbleBarViewController { int persistentSpacingSize = res .getDimensionPixelSize(R.dimen.bubblebar_icon_spacing_persistent_taskbar); int persistentBubbleBarSize = persistentBubbleSize + persistentSpacingSize * 2; - int persistentTaskbarHeight = activity.getPersistentTaskbarDeviceProfile().taskbarHeight; + int persistentTaskbarHeight = + activity.getPersistentTaskbarDeviceProfile().getTaskbarProfile().getHeight(); int persistentBubbleBarY = (persistentTaskbarHeight - persistentBubbleBarSize) / 2; - int transientBubbleBarY = activity.getTransientTaskbarDeviceProfile().taskbarBottomMargin; + int transientBubbleBarY = + activity.getTransientTaskbarDeviceProfile().getTaskbarProfile().getBottomMargin(); return transientBubbleBarY - persistentBubbleBarY; } diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashedHandleViewController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashedHandleViewController.java index 079f33ef5a..7e2b139f2b 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashedHandleViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashedHandleViewController.java @@ -104,7 +104,7 @@ public class BubbleStashedHandleViewController { // Use values directly from device profile to avoid referencing other bubble controllers // during init flow. int maxTy = Math.max(deviceProfile.hotseatBarBottomSpacePx, - deviceProfile.taskbarBottomMargin); + deviceProfile.getTaskbarProfile().getBottomMargin()); // Adjust handle view size to accommodate the handle morphing into the bubble bar mStashedHandleView.getLayoutParams().height = barSize + maxTy; diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/DeviceProfileDimensionsProviderAdapter.kt b/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/DeviceProfileDimensionsProviderAdapter.kt index 886b9f02c2..2408274c9f 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/DeviceProfileDimensionsProviderAdapter.kt +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/DeviceProfileDimensionsProviderAdapter.kt @@ -27,9 +27,9 @@ import com.android.launcher3.taskbar.bubbles.stashing.BubbleStashController.Task class DeviceProfileDimensionsProviderAdapter( private val taskbarActivityContext: TaskbarActivityContext ) : TaskbarHotseatDimensionsProvider { - override fun getTaskbarBottomSpace(): Int = taskbarDp().taskbarBottomMargin + override fun getTaskbarBottomSpace(): Int = taskbarDp().taskbarProfile.bottomMargin - override fun getTaskbarHeight(): Int = taskbarDp().taskbarHeight + override fun getTaskbarHeight(): Int = taskbarDp().taskbarProfile.height private fun taskbarDp(): DeviceProfile = taskbarActivityContext.deviceProfile } diff --git a/quickstep/src/com/android/launcher3/taskbar/growth/NudgeView.kt b/quickstep/src/com/android/launcher3/taskbar/growth/NudgeView.kt index 2290192ae7..5a832b1423 100644 --- a/quickstep/src/com/android/launcher3/taskbar/growth/NudgeView.kt +++ b/quickstep/src/com/android/launcher3/taskbar/growth/NudgeView.kt @@ -68,7 +68,7 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 // constraint to reduce the number of lines of text and hopefully free up some height. activityContext.dragLayer.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED) if ( - measuredHeight + activityContext.deviceProfile.taskbarHeight >= + measuredHeight + activityContext.deviceProfile.taskbarProfile.height >= activityContext.deviceProfile.deviceProperties.availableHeightPx ) { updateLayoutParams { width = LayoutParams.MATCH_PARENT } diff --git a/quickstep/src/com/android/quickstep/BaseContainerInterface.java b/quickstep/src/com/android/quickstep/BaseContainerInterface.java index 6e75b79429..95c1aaf3a1 100644 --- a/quickstep/src/com/android/quickstep/BaseContainerInterface.java +++ b/quickstep/src/com/android/quickstep/BaseContainerInterface.java @@ -367,7 +367,7 @@ public abstract class BaseContainerInterface extends FrameLayo } if (mDp.getDeviceProperties().isTablet() && enableGridOnlyOverview()) { - return mDp.stashedTaskbarHeight; + return mDp.getTaskbarProfile().getStashedTaskbarHeight(); } // Align to bottom of task Rect. diff --git a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/TaskbarStashControllerTest.kt b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/TaskbarStashControllerTest.kt index 22e0923fe2..77ac257dd7 100644 --- a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/TaskbarStashControllerTest.kt +++ b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/TaskbarStashControllerTest.kt @@ -325,7 +325,7 @@ class TaskbarStashControllerTest { } val expectedHeight = - activityContext.deviceProfile.run { taskbarHeight + taskbarBottomMargin } + activityContext.deviceProfile.taskbarProfile.run { height + bottomMargin } assertThat(stashController.touchableHeight).isEqualTo(expectedHeight) } @@ -333,7 +333,7 @@ class TaskbarStashControllerTest { @TaskbarMode(PINNED) fun testGetTouchableHeight_pinnedMode_taskbarHeight() { assertThat(stashController.touchableHeight) - .isEqualTo(activityContext.deviceProfile.taskbarHeight) + .isEqualTo(activityContext.deviceProfile.taskbarProfile.height) } @Test @@ -347,14 +347,14 @@ class TaskbarStashControllerTest { @TaskbarMode(THREE_BUTTONS) fun testGetContentHeightToReportToApps_threeButtonsMode_taskbarHeight() { assertThat(stashController.contentHeightToReportToApps) - .isEqualTo(activityContext.deviceProfile.taskbarHeight) + .isEqualTo(activityContext.deviceProfile.taskbarProfile.height) } @Test @TaskbarMode(PINNED) fun testGetContentHeightToReportToApps_pinnedMode_taskbarHeight() { assertThat(stashController.contentHeightToReportToApps) - .isEqualTo(activityContext.deviceProfile.taskbarHeight) + .isEqualTo(activityContext.deviceProfile.taskbarProfile.height) } @Test @@ -406,7 +406,7 @@ class TaskbarStashControllerTest { @TaskbarMode(PINNED) fun testGetTappableHeightToReportToApps_pinnedMode_taskbarHeight() { assertThat(stashController.tappableHeightToReportToApps) - .isEqualTo(activityContext.deviceProfile.taskbarHeight) + .isEqualTo(activityContext.deviceProfile.taskbarProfile.height) } @Test diff --git a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/rules/TaskbarModeRuleTest.kt b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/rules/TaskbarModeRuleTest.kt index 6b41475dd6..d4a3fa62e6 100644 --- a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/rules/TaskbarModeRuleTest.kt +++ b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/rules/TaskbarModeRuleTest.kt @@ -49,7 +49,7 @@ class TaskbarModeRuleTest { @TaskbarMode(TRANSIENT) fun testTaskbarMode_transient_overridesDeviceProfile() { val dp = InvariantDeviceProfile.INSTANCE.get(context).getDeviceProfile(context) - assertThat(dp.isTransientTaskbar).isTrue() + assertThat(dp.taskbarProfile.isTransientTaskbar).isTrue() assertThat(dp.deviceProperties.isGestureMode).isTrue() } @@ -65,7 +65,7 @@ class TaskbarModeRuleTest { @TaskbarMode(PINNED) fun testTaskbarMode_pinned_overridesDeviceProfile() { val dp = InvariantDeviceProfile.INSTANCE.get(context).getDeviceProfile(context) - assertThat(dp.isTransientTaskbar).isFalse() + assertThat(dp.taskbarProfile.isTransientTaskbar).isFalse() assertThat(dp.deviceProperties.isGestureMode).isTrue() } @@ -82,7 +82,7 @@ class TaskbarModeRuleTest { @TaskbarMode(THREE_BUTTONS) fun testTaskbarMode_threeButtons_overridesDeviceProfile() { val dp = InvariantDeviceProfile.INSTANCE.get(context).getDeviceProfile(context) - assertThat(dp.isTransientTaskbar).isFalse() + assertThat(dp.taskbarProfile.isTransientTaskbar).isFalse() assertThat(dp.deviceProperties.isGestureMode).isFalse() } } diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java index 0639695979..c56f50e193 100644 --- a/src/com/android/launcher3/BubbleTextView.java +++ b/src/com/android/launcher3/BubbleTextView.java @@ -287,7 +287,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, defaultIconSize = getResources().getDimensionPixelSize( R.dimen.search_row_small_icon_size); } else if (mDisplay == DISPLAY_TASKBAR) { - defaultIconSize = mDeviceProfile.taskbarIconSize; + defaultIconSize = mDeviceProfile.getTaskbarProfile().getIconSize(); } else { // widget_selection or shortcut_popup defaultIconSize = mDeviceProfile.iconSizePx; diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index d23372c907..84c6c73889 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -48,7 +48,6 @@ import android.view.Surface; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; -import androidx.core.content.res.ResourcesCompat; import com.android.launcher3.CellLayout.ContainerType; import com.android.launcher3.DevicePaddings.DevicePadding; @@ -58,6 +57,7 @@ import com.android.launcher3.deviceprofile.DeviceProperties; import com.android.launcher3.deviceprofile.DropTargetProfile; import com.android.launcher3.deviceprofile.HotseatProfile; import com.android.launcher3.deviceprofile.OverviewProfile; +import com.android.launcher3.deviceprofile.TaskbarProfile; import com.android.launcher3.graphics.ThemeManager; import com.android.launcher3.icons.DotRenderer; import com.android.launcher3.model.data.ItemInfo; @@ -254,17 +254,10 @@ public class DeviceProfile { public final DotRenderer mDotRendererAllApps; // Taskbar + private final TaskbarProfile mTaskbarProfile; public boolean isTaskbarPresent; // Whether Taskbar will inset the bottom of apps by taskbarSize. public boolean isTaskbarPresentInApps; - public final int taskbarHeight; - public final int stashedTaskbarHeight; - public final int taskbarBottomMargin; - public final int taskbarIconSize; - private final int mTransientTaskbarClaimedSpace; - // If true, used to layout taskbar in 3 button navigation mode. - public final boolean startAlignTaskbar; - public final boolean isTransientTaskbar; // DragController public int flingToDeleteThresholdVelocity; @@ -300,6 +293,7 @@ public class DeviceProfile { 0 ); hotseatProfile = new HotseatProfile(false, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + mTaskbarProfile = new TaskbarProfile(0, 0, 0, 0, 0, false, false); inv = null; mDisplayOptionSpec = null; mInfo = null; @@ -329,13 +323,6 @@ public class DeviceProfile { mViewScaleProvider = null; mDotRendererWorkSpace = null; mDotRendererAllApps = null; - taskbarHeight = 0; - stashedTaskbarHeight = 0; - taskbarBottomMargin = 0; - taskbarIconSize = 0; - mTransientTaskbarClaimedSpace = 0; - startAlignTaskbar = false; - isTransientTaskbar = false; } /** TODO: Once we fully migrate to staged split, remove "isMultiWindowMode" */ @@ -399,33 +386,15 @@ public class DeviceProfile { mTypeIndex = displayOptionSpec.typeIndex; - this.isTransientTaskbar = isTransientTaskbar; - int transientTaskbarIconSize = pxFromDp(inv.transientTaskbarIconSize[mTypeIndex], mMetrics); - int transientTaskbarBottomMargin = - res.getDimensionPixelSize(R.dimen.transient_taskbar_bottom_margin); - int transientTaskbarHeight = - Math.round((transientTaskbarIconSize * ICON_VISIBLE_AREA_FACTOR) - + (2 * res.getDimensionPixelSize(R.dimen.transient_taskbar_padding))); - mTransientTaskbarClaimedSpace = transientTaskbarHeight + 2 * transientTaskbarBottomMargin; - - if (!isTaskbarPresent) { - taskbarIconSize = taskbarHeight = stashedTaskbarHeight = taskbarBottomMargin = 0; - startAlignTaskbar = false; - } else if (isTransientTaskbar) { - taskbarIconSize = transientTaskbarIconSize; - taskbarHeight = transientTaskbarHeight; - stashedTaskbarHeight = - res.getDimensionPixelSize(R.dimen.transient_taskbar_stashed_height); - taskbarBottomMargin = transientTaskbarBottomMargin; - startAlignTaskbar = false; - } else { - taskbarIconSize = pxFromDp(ResourcesCompat.getFloat(res, R.dimen.taskbar_icon_size), - mMetrics); - taskbarHeight = res.getDimensionPixelSize(R.dimen.taskbar_size); - stashedTaskbarHeight = res.getDimensionPixelSize(R.dimen.taskbar_stashed_size); - taskbarBottomMargin = 0; - startAlignTaskbar = displayOptionSpec.startAlignTaskbar; - } + mTaskbarProfile = TaskbarProfile.Factory.createTaskbarProfile( + res, + isTransientTaskbar, + isTaskbarPresent, + mMetrics, + displayOptionSpec, + mTypeIndex, + inv + ); edgeMarginPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_edge_margin); workspaceContentScale = res.getFloat(R.dimen.workspace_content_scale); @@ -2026,7 +1995,7 @@ public class DeviceProfile { * Returns the number of pixels the taskbar is translated from the bottom of the screen. */ public int getTaskbarOffsetY() { - int taskbarIconBottomSpace = (taskbarHeight - iconSizePx) / 2; + int taskbarIconBottomSpace = (getTaskbarProfile().getHeight() - iconSizePx) / 2; int launcherIconBottomSpace = Math.min((hotseatCellHeightPx - iconSizePx) / 2, gridVisualizationPaddingY); return getHotseatBarBottomPadding() + launcherIconBottomSpace - taskbarIconBottomSpace; @@ -2034,7 +2003,9 @@ public class DeviceProfile { /** Returns the number of pixels required below OverviewActions. */ public int getOverviewActionsClaimedSpaceBelow() { - return isTaskbarPresent ? mTransientTaskbarClaimedSpace : mInsets.bottom; + return isTaskbarPresent + ? getTaskbarProfile().getTransientTaskbarClaimedSpace() + : mInsets.bottom; } /** Gets the space that the overview actions will take, including bottom margin. */ @@ -2071,7 +2042,7 @@ public class DeviceProfile { mInsets.top + mDeviceProperties.getAvailableHeightPx()); } else { // Folders should only appear below the drop target bar and above the hotseat - int hotseatTop = isTaskbarPresent ? taskbarHeight : hotseatBarSizePx; + int hotseatTop = isTaskbarPresent ? getTaskbarProfile().getHeight() : hotseatBarSizePx; return new Rect(mInsets.left + edgeMarginPx, mInsets.top + getDropTargetProfile().getBarSizePx() + edgeMarginPx, mInsets.left + mDeviceProperties.getAvailableWidthPx() - edgeMarginPx, @@ -2272,10 +2243,12 @@ public class DeviceProfile { writer.println(prefix + "\tisTaskbarPresent:" + isTaskbarPresent); writer.println(prefix + "\tisTaskbarPresentInApps:" + isTaskbarPresentInApps); - writer.println(prefix + pxToDpStr("taskbarHeight", taskbarHeight)); - writer.println(prefix + pxToDpStr("stashedTaskbarHeight", stashedTaskbarHeight)); - writer.println(prefix + pxToDpStr("taskbarBottomMargin", taskbarBottomMargin)); - writer.println(prefix + pxToDpStr("taskbarIconSize", taskbarIconSize)); + writer.println(prefix + pxToDpStr("taskbarHeight", getTaskbarProfile().getHeight())); + writer.println(prefix + pxToDpStr("stashedTaskbarHeight", + getTaskbarProfile().getStashedTaskbarHeight())); + writer.println(prefix + pxToDpStr("taskbarBottomMargin", + getTaskbarProfile().getBottomMargin())); + writer.println(prefix + pxToDpStr("taskbarIconSize", getTaskbarProfile().getIconSize())); writer.println(prefix + pxToDpStr("desiredWorkspaceHorizontalMarginPx", desiredWorkspaceHorizontalMarginPx)); @@ -2392,6 +2365,10 @@ public class DeviceProfile { } } + public TaskbarProfile getTaskbarProfile() { + return mTaskbarProfile; + } + public DropTargetProfile getDropTargetProfile() { return mDropTargetProfile; } diff --git a/src/com/android/launcher3/allapps/WorkUtilityView.java b/src/com/android/launcher3/allapps/WorkUtilityView.java index 9fcf3721a7..97f2e86dfa 100644 --- a/src/com/android/launcher3/allapps/WorkUtilityView.java +++ b/src/com/android/launcher3/allapps/WorkUtilityView.java @@ -166,7 +166,7 @@ public class WorkUtilityView extends LinearLayout implements Insettable, } if (!dp.getDeviceProperties().isGestureMode() && dp.isTaskbarPresent) { - bottomMargin += dp.taskbarHeight; + bottomMargin += dp.getTaskbarProfile().getHeight(); } lp.bottomMargin = bottomMargin; diff --git a/src/com/android/launcher3/deviceprofile/TaskbarProfile.kt b/src/com/android/launcher3/deviceprofile/TaskbarProfile.kt new file mode 100644 index 0000000000..301b79efde --- /dev/null +++ b/src/com/android/launcher3/deviceprofile/TaskbarProfile.kt @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2025 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.launcher3.deviceprofile + +import android.content.res.Resources +import android.util.DisplayMetrics +import androidx.core.content.res.ResourcesCompat +import com.android.launcher3.InvariantDeviceProfile +import com.android.launcher3.R +import com.android.launcher3.icons.IconNormalizer.ICON_VISIBLE_AREA_FACTOR +import com.android.launcher3.testing.shared.ResourceUtils.pxFromDp + +data class TaskbarProfile( + val height: Int, + val stashedTaskbarHeight: Int, + val bottomMargin: Int, + val iconSize: Int, + val transientTaskbarClaimedSpace: Int, + // If true, used to layout taskbar in 3 button navigation mode. + val isStartAlignTaskbar: Boolean, + val isTransientTaskbar: Boolean, +) { + companion object Factory { + fun createTaskbarProfile( + res: Resources, + isTransientTaskbar: Boolean, + isTaskbarPresent: Boolean, + metrics: DisplayMetrics, + displayOptionSpec: InvariantDeviceProfile.DisplayOptionSpec, + typeIndex: Int, + inv: InvariantDeviceProfile, + ): TaskbarProfile { + val transientTaskbarIconSize = + pxFromDp(inv.transientTaskbarIconSize.get(typeIndex), metrics) + val transientTaskbarBottomMargin: Int = + res.getDimensionPixelSize(R.dimen.transient_taskbar_bottom_margin) + val transientTaskbarHeight = + Math.round( + (transientTaskbarIconSize * ICON_VISIBLE_AREA_FACTOR) + + (2 * res.getDimensionPixelSize(R.dimen.transient_taskbar_padding)) + ) + val transientTaskbarClaimedSpace = + transientTaskbarHeight + 2 * transientTaskbarBottomMargin + + return when { + !isTaskbarPresent -> TaskbarProfile( + bottomMargin = 0, + stashedTaskbarHeight = 0, + height = 0, + iconSize = 0, + isStartAlignTaskbar = false, + transientTaskbarClaimedSpace = transientTaskbarClaimedSpace, + isTransientTaskbar = isTransientTaskbar, + ) + isTransientTaskbar -> TaskbarProfile( + iconSize = transientTaskbarIconSize, + height = transientTaskbarHeight, + stashedTaskbarHeight = + res.getDimensionPixelSize(R.dimen.transient_taskbar_stashed_height), + bottomMargin = transientTaskbarBottomMargin, + isStartAlignTaskbar = false, + transientTaskbarClaimedSpace = transientTaskbarClaimedSpace, + isTransientTaskbar = isTransientTaskbar, + ) + else -> TaskbarProfile( + iconSize = + pxFromDp(ResourcesCompat.getFloat(res, R.dimen.taskbar_icon_size), metrics), + height = res.getDimensionPixelSize(R.dimen.taskbar_size), + stashedTaskbarHeight = res.getDimensionPixelSize(R.dimen.taskbar_stashed_size), + bottomMargin = 0, + isStartAlignTaskbar = displayOptionSpec.startAlignTaskbar, + isTransientTaskbar = isTransientTaskbar, + transientTaskbarClaimedSpace = transientTaskbarClaimedSpace, + ) + } + + } + } +} diff --git a/src/com/android/launcher3/util/DimensionUtils.kt b/src/com/android/launcher3/util/DimensionUtils.kt index 9941b66618..76df206127 100644 --- a/src/com/android/launcher3/util/DimensionUtils.kt +++ b/src/com/android/launcher3/util/DimensionUtils.kt @@ -38,7 +38,7 @@ object DimensionUtils { // Taskbar for large screen if (!isPhoneMode) { p.x = ViewGroup.LayoutParams.MATCH_PARENT - p.y = deviceProfile.taskbarHeight + p.y = deviceProfile.taskbarProfile.height return p } diff --git a/src/com/android/launcher3/views/Snackbar.java b/src/com/android/launcher3/views/Snackbar.java index 54aa6e429f..9edc7b2772 100644 --- a/src/com/android/launcher3/views/Snackbar.java +++ b/src/com/android/launcher3/views/Snackbar.java @@ -118,7 +118,7 @@ public class Snackbar extends AbstractFloatingView { DeviceProfile deviceProfile = activity.getDeviceProfile(); params.setMargins(0, 0, 0, marginBottom + (deviceProfile.isTaskbarPresent - ? deviceProfile.taskbarHeight + deviceProfile.getTaskbarOffsetY() + ? deviceProfile.getTaskbarProfile().getHeight() + deviceProfile.getTaskbarOffsetY() : insets.bottom)); TextView labelView = snackbar.findViewById(R.id.label);