Merge "Update all home screen widgets size upon workspace inset change" into sc-v2-dev

This commit is contained in:
TreeHugger Robot authored and Android (Google) Code Review committed 2021-11-04 17:39:06 +00:00
commit 4c96d446a5
1 file changed
+20
+20
View File
@@ -329,6 +329,7 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
}
updateWorkspaceScreensPadding();
updateWorkspaceWidgetsSizes();
}
private void updateWorkspaceScreensPadding() {
@@ -360,6 +361,25 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
}
}
private void updateWorkspaceWidgetsSizes() {
int numberOfScreens = mScreenOrder.size();
for (int i = 0; i < numberOfScreens; i++) {
ShortcutAndWidgetContainer shortcutAndWidgetContainer =
mWorkspaceScreens.get(mScreenOrder.get(i)).getShortcutsAndWidgets();
int shortcutsAndWidgetCount = shortcutAndWidgetContainer.getChildCount();
for (int j = 0; j < shortcutsAndWidgetCount; j++) {
View view = shortcutAndWidgetContainer.getChildAt(j);
if (view instanceof LauncherAppWidgetHostView
&& view.getTag() instanceof LauncherAppWidgetInfo) {
LauncherAppWidgetInfo launcherAppWidgetInfo =
(LauncherAppWidgetInfo) view.getTag();
WidgetSizes.updateWidgetSizeRanges((LauncherAppWidgetHostView) view,
mLauncher, launcherAppWidgetInfo.spanX, launcherAppWidgetInfo.spanY);
}
}
}
}
/**
* Estimates the size of an item using spans: hSpan, vSpan.
*