OSDN Git Service

Update custom content insets when Workspace insets are set
authorAdam Cohen <adamcohen@google.com>
Tue, 26 Nov 2013 23:45:38 +0000 (15:45 -0800)
committerAdam Cohen <adamcohen@google.com>
Tue, 26 Nov 2013 23:46:47 +0000 (15:46 -0800)
-> Not sure if custom content can be added before insets are set,
   so this is just a speculative fix.

Bug: 11875171
Change-Id: Ia8e07f51f527f464262b7ff99e4db245fe5a7906

src/com/android/launcher3/Workspace.java

index 02949e7..b8af9ad 100644 (file)
@@ -334,6 +334,14 @@ public class Workspace extends SmoothPagedView
     @Override
     public void setInsets(Rect insets) {
         mInsets.set(insets);
+
+        CellLayout customScreen = getScreenWithId(CUSTOM_CONTENT_SCREEN_ID);
+        if (customScreen != null) {
+            View customContent = customScreen.getShortcutsAndWidgets().getChildAt(0);
+            if (customContent instanceof Insettable) {
+                ((Insettable) customContent).setInsets(mInsets);
+            }
+        }
     }
 
     // estimate the size of a widget with spans hSpan, vSpan. return MAX_VALUE for each