OSDN Git Service

Fix issue with adding widget with config activity to empty screen (issue 11381059)
authorAdam Cohen <adamcohen@google.com>
Thu, 31 Oct 2013 22:03:35 +0000 (15:03 -0700)
committerAdam Cohen <adamcohen@google.com>
Thu, 31 Oct 2013 22:04:59 +0000 (15:04 -0700)
Change-Id: Ic7eecb30422e7a6cf35ebe8470d9eba8752d406e

src/com/android/launcher3/CellLayout.java
src/com/android/launcher3/Launcher.java
src/com/android/launcher3/Workspace.java

index bf1e9c9..df16d41 100644 (file)
@@ -76,6 +76,7 @@ public class CellLayout extends ViewGroup {
     private int mHeightGap;
     private int mMaxGap;
     private boolean mScrollingTransformsDirty = false;
+    private boolean mDropPending = false;
 
     private final Rect mRect = new Rect();
     private final CellInfo mCellInfo = new CellInfo();
@@ -332,6 +333,14 @@ public class CellLayout extends ViewGroup {
         mShortcutsAndWidgets.setInvertIfRtl(invert);
     }
 
+    public void setDropPending(boolean pending) {
+        mDropPending = pending;
+    }
+
+    public boolean isDropPending() {
+        return mDropPending;
+    }
+
     private void invalidateBubbleTextView(BubbleTextView icon) {
         final int padding = icon.getPressedOrFocusedBackgroundPadding();
         invalidate(icon.getLeft() + getPaddingLeft() - padding,
index f721571..3290d8e 100644 (file)
@@ -754,10 +754,14 @@ public class Launcher extends Activity
                 };
             } else {
                 result = resultCode;
+                final CellLayout dropLayout =
+                        (CellLayout) mWorkspace.getScreenWithId(mPendingAddInfo.screenId);
+                dropLayout.setDropPending(true);
                 onComplete = new Runnable() {
                     @Override
                     public void run() {
                         completeTwoStageWidgetDrop(result, appWidgetId);
+                        dropLayout.setDropPending(false);
                     }
                 };
             }
index 8e29b40..5bd0bc6 100644 (file)
@@ -671,7 +671,8 @@ public class Workspace extends SmoothPagedView
         CellLayout finalScreen = mWorkspaceScreens.get(finalScreenId);
 
         // If the final screen is empty, convert it to the extra empty screen
-        if (finalScreen.getShortcutsAndWidgets().getChildCount() == 0) {
+        if (finalScreen.getShortcutsAndWidgets().getChildCount() == 0 &&
+                !finalScreen.isDropPending()) {
             mWorkspaceScreens.remove(finalScreenId);
             mScreenOrder.remove(finalScreenId);