Create widget resize frame after spring loaded workspace has exited.

Before, the resize frame was created as soon as a widget was dropped,
but this caused it to be in the wrong spot after the spring loaded
mode exited. Instead, we should wait until the workspace is back to
normal before creating the resize frame.

Bug: 24192073

Change-Id: I8d87febcc4ec7e3c44d50135184c3a837d7cd960
This commit is contained in:
Tony Wickham
2015-09-29 18:22:05 -07:00
parent a3b240d32b
commit e038562675
+8 -19
View File
@@ -1201,7 +1201,7 @@ public class Workspace extends PagedView
}
}
if (mDelayedResizeRunnable != null) {
if (mDelayedResizeRunnable != null && !mIsSwitchingState) {
mDelayedResizeRunnable.run();
mDelayedResizeRunnable = null;
}
@@ -2650,7 +2650,6 @@ public class Workspace extends PagedView
} else if (mDragInfo != null) {
final View cell = mDragInfo.cell;
Runnable resizeRunnable = null;
if (dropTargetLayout != null && !d.cancelled) {
// Move internally
boolean hasMovedLayouts = (getParentCellLayoutForView(cell) != dropTargetLayout);
@@ -2747,21 +2746,14 @@ public class Workspace extends PagedView
AppWidgetProviderInfo pInfo = hostView.getAppWidgetInfo();
if (pInfo != null && pInfo.resizeMode != AppWidgetProviderInfo.RESIZE_NONE
&& !d.accessibleDrag) {
final Runnable addResizeFrame = new Runnable() {
mDelayedResizeRunnable = new Runnable() {
public void run() {
DragLayer dragLayer = mLauncher.getDragLayer();
dragLayer.addResizeFrame(info, hostView, cellLayout);
}
};
resizeRunnable = (new Runnable() {
public void run() {
if (!isPageMoving()) {
addResizeFrame.run();
} else {
mDelayedResizeRunnable = addResizeFrame;
if (!isPageMoving() && !mIsSwitchingState) {
DragLayer dragLayer = mLauncher.getDragLayer();
dragLayer.addResizeFrame(info, hostView, cellLayout);
}
}
});
};
}
}
@@ -2778,7 +2770,6 @@ public class Workspace extends PagedView
}
final CellLayout parent = (CellLayout) cell.getParent().getParent();
final Runnable finalResizeRunnable = resizeRunnable;
// Prepare it to be animated into its new position
// This must be called after the view has been re-parented
final Runnable onCompleteRunnable = new Runnable() {
@@ -2786,9 +2777,6 @@ public class Workspace extends PagedView
public void run() {
mAnimatingViewIntoPlace = false;
updateChildrenLayersEnabled(false);
if (finalResizeRunnable != null) {
finalResizeRunnable.run();
}
}
};
mAnimatingViewIntoPlace = true;
@@ -3735,7 +3723,8 @@ public class Workspace extends PagedView
if (!isFlingToDelete) {
// Fling to delete already exits spring loaded mode after the animation finishes.
mLauncher.exitSpringLoadedDragModeDelayed(success,
Launcher.EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT, null);
Launcher.EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT, mDelayedResizeRunnable);
mDelayedResizeRunnable = null;
}
}