From 3a4ba0bec3b2724534c8b587e2fead05cd3039bd Mon Sep 17 00:00:00 2001 From: Andras Kloczl Date: Mon, 29 Mar 2021 18:47:14 +0200 Subject: [PATCH] Fix two panel home folder opening display issue Change the rect calculation logic that is used to display an opening folder. If multiple panels are displayed then we calculate the union of the pages. Test: manual Bug: 181962118 Change-Id: I504f22890115ceebc16d60929149fe634bf820d0 --- src/com/android/launcher3/Launcher.java | 4 +--- src/com/android/launcher3/Workspace.java | 24 +++++++++++++++++------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 8785fbc2b9..5eba39927f 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -1781,9 +1781,7 @@ public class Launcher extends StatefulActivity implements Launche @Override public Rect getFolderBoundingBox() { // We need to bound the folder to the currently visible workspace area - Rect folderBoundingBox = new Rect(); - getWorkspace().getPageAreaRelativeToDragLayer(folderBoundingBox); - return folderBoundingBox; + return getWorkspace().getPageAreaRelativeToDragLayer(); } @Override diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index bd173481b7..48638f59f7 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -2000,16 +2000,26 @@ public class Workspace extends PagedView } /** - * Computes the area relative to dragLayer which is used to display a page. + * Computes and returns the area relative to dragLayer which is used to display a page. + * In case we have multiple pages displayed at the same time, we return the union of the areas. */ - public void getPageAreaRelativeToDragLayer(Rect outArea) { - CellLayout child = (CellLayout) getChildAt(getNextPage()); - if (child == null) { - return; + public Rect getPageAreaRelativeToDragLayer() { + Rect area = new Rect(); + int nextPage = getNextPage(); + int panelCount = getPanelCount(); + for (int page = nextPage; page < nextPage + panelCount; page++) { + CellLayout child = (CellLayout) getChildAt(page); + if (child == null) { + break; + } + + ShortcutAndWidgetContainer boundingLayout = child.getShortcutsAndWidgets(); + Rect tmpRect = new Rect(); + mLauncher.getDragLayer().getDescendantRectRelativeToSelf(boundingLayout, tmpRect); + area.union(tmpRect); } - ShortcutAndWidgetContainer boundingLayout = child.getShortcutsAndWidgets(); - mLauncher.getDragLayer().getDescendantRectRelativeToSelf(boundingLayout, outArea); + return area; } @Override