From 8f54d597bfaec7322322c60ef415d2fe0c6e9e7d Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Fri, 7 Oct 2022 14:46:25 -0700 Subject: [PATCH] Round split layout values instead of using int cast * Silly us, we forgot that int casting always floors. Math.round() does a mathematical round. Fixes: 248575056 Test: Wallpaper no longer bleeds through on split animation. Change-Id: I068c030ce6b86fc12faee7778c0d87a0d5aea487 --- .../android/launcher3/touch/LandscapePagedViewHandler.java | 6 +++--- .../android/launcher3/touch/PortraitPagedViewHandler.java | 6 +++--- .../android/launcher3/touch/SeascapePagedViewHandler.java | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java index 9afca4f380..ceebc2e168 100644 --- a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java +++ b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java @@ -504,9 +504,9 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler { DeviceProfile dp, boolean isRtl) { int spaceAboveSnapshot = dp.overviewTaskThumbnailTopMarginPx; int totalThumbnailHeight = parentHeight - spaceAboveSnapshot; - int dividerBar = splitBoundsConfig.appsStackedVertically - ? (int) (splitBoundsConfig.dividerHeightPercent * parentHeight) - : (int) (splitBoundsConfig.dividerWidthPercent * parentWidth); + int dividerBar = Math.round(totalThumbnailHeight * (splitBoundsConfig.appsStackedVertically + ? splitBoundsConfig.dividerHeightPercent + : splitBoundsConfig.dividerWidthPercent)); int primarySnapshotHeight; int primarySnapshotWidth; int secondarySnapshotHeight; diff --git a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java index 3c386e4129..a9ae7dc4bd 100644 --- a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java +++ b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java @@ -630,9 +630,9 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { DeviceProfile dp, boolean isRtl) { int spaceAboveSnapshot = dp.overviewTaskThumbnailTopMarginPx; int totalThumbnailHeight = parentHeight - spaceAboveSnapshot; - int dividerBar = splitBoundsConfig.appsStackedVertically - ? (int) (splitBoundsConfig.dividerHeightPercent * parentHeight) - : (int) (splitBoundsConfig.dividerWidthPercent * parentWidth); + int dividerBar = Math.round(splitBoundsConfig.appsStackedVertically + ? splitBoundsConfig.dividerHeightPercent * totalThumbnailHeight + : splitBoundsConfig.dividerWidthPercent * totalThumbnailHeight); int primarySnapshotHeight; int primarySnapshotWidth; int secondarySnapshotHeight; diff --git a/src/com/android/launcher3/touch/SeascapePagedViewHandler.java b/src/com/android/launcher3/touch/SeascapePagedViewHandler.java index bbdd958c45..a616a8b6eb 100644 --- a/src/com/android/launcher3/touch/SeascapePagedViewHandler.java +++ b/src/com/android/launcher3/touch/SeascapePagedViewHandler.java @@ -283,9 +283,9 @@ public class SeascapePagedViewHandler extends LandscapePagedViewHandler { // (portrait bottom) and secondary is on the right (portrait top) int spaceAboveSnapshot = dp.overviewTaskThumbnailTopMarginPx; int totalThumbnailHeight = parentHeight - spaceAboveSnapshot; - int dividerBar = splitBoundsConfig.appsStackedVertically - ? (int) (splitBoundsConfig.dividerHeightPercent * parentHeight) - : (int) (splitBoundsConfig.dividerWidthPercent * parentWidth); + int dividerBar = Math.round(totalThumbnailHeight * (splitBoundsConfig.appsStackedVertically + ? splitBoundsConfig.dividerHeightPercent + : splitBoundsConfig.dividerWidthPercent)); int primarySnapshotHeight; int primarySnapshotWidth; int secondarySnapshotHeight;