From f5d90b9ec2498ac9bfb90fe03b2932c300dff200 Mon Sep 17 00:00:00 2001 From: Jerry Chang Date: Wed, 30 Mar 2022 11:20:28 +0000 Subject: [PATCH] Fix wrong split percentage after split layout been pushed up The task thumbnails of splitting task might not start with (0, 0), like the case when IME panel pushing up split layout. Updated to consider different start position while calculating split percentage. Fix: 218704243 Test: enter split in portrait, toggle on IME panel, observed task thumbnails been placed properly after swiped up to overview. Change-Id: I5b0d9710b56e9d77b86369c7fff4bc3ca75d9c7e --- .../launcher3/util/SplitConfigurationOptions.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/com/android/launcher3/util/SplitConfigurationOptions.java b/src/com/android/launcher3/util/SplitConfigurationOptions.java index b40493ac25..6a336cce28 100644 --- a/src/com/android/launcher3/util/SplitConfigurationOptions.java +++ b/src/com/android/launcher3/util/SplitConfigurationOptions.java @@ -154,10 +154,12 @@ public final class SplitConfigurationOptions { } } - leftTaskPercent = this.leftTopBounds.width() / (float) rightBottomBounds.right; - topTaskPercent = this.leftTopBounds.height() / (float) rightBottomBounds.bottom; - dividerWidthPercent = visualDividerBounds.width() / (float) rightBottomBounds.right; - dividerHeightPercent = visualDividerBounds.height() / (float) rightBottomBounds.bottom; + float totalWidth = rightBottomBounds.right - leftTopBounds.left; + float totalHeight = rightBottomBounds.bottom - leftTopBounds.top; + leftTaskPercent = leftTopBounds.width() / totalWidth; + topTaskPercent = leftTopBounds.height() / totalHeight; + dividerWidthPercent = visualDividerBounds.width() / totalWidth; + dividerHeightPercent = visualDividerBounds.height() / totalHeight; } }