From e95664077c36b7239e746345ef48af1f12898596 Mon Sep 17 00:00:00 2001 From: Thales Lima Date: Wed, 30 Aug 2023 16:35:12 +0100 Subject: [PATCH] Use transient taskbar check in split screen The space that should be removed in split screen should check if there is a taskbar or not. Adding the transient taskbar property to DeviceProfile solves that without having to pass context around. Fix: 289769344 Test: manual Flag: N/A Change-Id: Id0c51c4ec9481d3c206eef52d44094ec7a8c98cf --- src/com/android/launcher3/DeviceProfile.java | 4 +++- .../android/launcher3/touch/PortraitPagedViewHandler.java | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index a48c9288d3..be43e6ca4f 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -294,6 +294,7 @@ public class DeviceProfile { public final int taskbarIconSize; // If true, used to layout taskbar in 3 button navigation mode. public final boolean startAlignTaskbar; + public final boolean isTransientTaskbar; // DragController public int flingToDeleteThresholdVelocity; @@ -361,7 +362,8 @@ public class DeviceProfile { } } - if (DisplayController.isTransientTaskbar(context)) { + isTransientTaskbar = DisplayController.isTransientTaskbar(context); + if (isTransientTaskbar) { float invTransientIconSizeDp = inv.transientTaskbarIconSize[mTypeIndex]; taskbarIconSize = pxFromDp(invTransientIconSizeDp, mMetrics); taskbarHeight = Math.round((taskbarIconSize * ICON_VISIBLE_AREA_FACTOR) diff --git a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java index 6a972eb0dd..dc4621e0c1 100644 --- a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java +++ b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java @@ -582,7 +582,8 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { ? splitInfo.dividerHeightPercent : splitInfo.dividerWidthPercent; - float scale = (float) outRect.height() / dp.availableHeightPx; + int taskbarHeight = dp.isTransientTaskbar ? 0 : dp.taskbarHeight; + float scale = (float) outRect.height() / (dp.availableHeightPx - taskbarHeight); float topTaskHeight = dp.availableHeightPx * topLeftTaskPercent; float scaledTopTaskHeight = topTaskHeight * scale; float dividerHeight = dp.availableHeightPx * dividerBarPercent; @@ -639,7 +640,8 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { // Reset unused translations primarySnapshot.setTranslationY(0); } else { - float scale = (float) totalThumbnailHeight / dp.availableHeightPx; + int taskbarHeight = dp.isTransientTaskbar ? 0 : dp.taskbarHeight; + float scale = (float) totalThumbnailHeight / (dp.availableHeightPx - taskbarHeight); float topTaskHeight = dp.availableHeightPx * taskPercent; float finalDividerHeight = Math.round(totalThumbnailHeight * dividerScale); float scaledTopTaskHeight = topTaskHeight * scale;