From b26664800ec22859c60a52668afc410db1654c89 Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Wed, 12 Oct 2022 13:12:01 -0700 Subject: [PATCH] Fix casts to Math.round() in real landscape Fixes: 248575056 Test: Wallpaper no longer bleeds through on split animation in real landscape. Change-Id: Ia59efda737de94a4b64f9d0a1f84cd116539107b --- .../touch/PortraitPagedViewHandler.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java index a9ae7dc4bd..67a09913b4 100644 --- a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java +++ b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java @@ -611,15 +611,17 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { if (desiredStagePosition == SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT) { if (isLandscape) { - outRect.right = outRect.left + (int) (outRect.width() * topLeftTaskPercent); + outRect.right = outRect.left + Math.round(outRect.width() * topLeftTaskPercent); } else { - outRect.bottom = outRect.top + (int) (outRect.height() * topLeftTaskPercent); + outRect.bottom = outRect.top + Math.round(outRect.height() * topLeftTaskPercent); } } else { if (isLandscape) { - outRect.left += (int) (outRect.width() * (topLeftTaskPercent + dividerBarPercent)); + outRect.left += Math.round(outRect.width() + * (topLeftTaskPercent + dividerBarPercent)); } else { - outRect.top += (int) (outRect.height() * (topLeftTaskPercent + dividerBarPercent)); + outRect.top += Math.round(outRect.height() + * (topLeftTaskPercent + dividerBarPercent)); } } } @@ -632,7 +634,7 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { int totalThumbnailHeight = parentHeight - spaceAboveSnapshot; int dividerBar = Math.round(splitBoundsConfig.appsStackedVertically ? splitBoundsConfig.dividerHeightPercent * totalThumbnailHeight - : splitBoundsConfig.dividerWidthPercent * totalThumbnailHeight); + : splitBoundsConfig.dividerWidthPercent * parentWidth); int primarySnapshotHeight; int primarySnapshotWidth; int secondarySnapshotHeight; @@ -641,7 +643,7 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { splitBoundsConfig.topTaskPercent : splitBoundsConfig.leftTaskPercent; if (dp.isLandscape) { primarySnapshotHeight = totalThumbnailHeight; - primarySnapshotWidth = (int) (parentWidth * taskPercent); + primarySnapshotWidth = Math.round(parentWidth * taskPercent); secondarySnapshotHeight = totalThumbnailHeight; secondarySnapshotWidth = parentWidth - primarySnapshotWidth - dividerBar; @@ -656,7 +658,7 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { secondarySnapshot.setTranslationY(spaceAboveSnapshot); } else { primarySnapshotWidth = parentWidth; - primarySnapshotHeight = (int) (totalThumbnailHeight * taskPercent); + primarySnapshotHeight = Math.round(totalThumbnailHeight * taskPercent); secondarySnapshotWidth = parentWidth; secondarySnapshotHeight = totalThumbnailHeight - primarySnapshotHeight - dividerBar;