merge in jb-release history after reset to jb-dev
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index 03d2a72..eea0dbb 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -648,6 +648,7 @@
}
private void preloadWidget(final PendingAddWidgetInfo info) {
+ Log.d(TAG, "6557954 Preload widget: " + info.info);
final AppWidgetProviderInfo pInfo = info.info;
if (pInfo.configure != null) {
return;
@@ -656,6 +657,7 @@
mBindWidgetRunnable = new Runnable() {
@Override
public void run() {
+ Log.d(TAG, " 6557954 Preload, bind widget: " + info.info);
mWidgetLoadingId = mLauncher.getAppWidgetHost().allocateAppWidgetId();
if (AppWidgetManager.getInstance(mLauncher)
.bindAppWidgetIdIfAllowed(mWidgetLoadingId, info.componentName)) {
@@ -671,6 +673,7 @@
AppWidgetHostView hostView = mLauncher.
getAppWidgetHost().createView(getContext(), mWidgetLoadingId, pInfo);
info.boundWidget = hostView;
+ Log.d(TAG, " 6557954 Preload, inflate widget: " + info.info);
mWidgetCleanupState = WIDGET_INFLATED;
hostView.setVisibility(INVISIBLE);
int[] unScaledSize = mLauncher.getWorkspace().estimateItemSize(info.spanX,
@@ -695,13 +698,20 @@
// the widget. This will need to be cleaned up if it turns out no long press occurs.
if (mCreateWidgetInfo != null) {
// Just in case the cleanup process wasn't properly executed. This shouldn't happen.
+ Log.d(TAG, "**** 6557954 Previous shortpress not cleaned up, cleaning up now: " + mCreateWidgetInfo.info);
cleanupWidgetPreloading(false);
}
mCreateWidgetInfo = new PendingAddWidgetInfo((PendingAddWidgetInfo) v.getTag());
+ Log.d(TAG, "6557954 Short press triggered for view: " + v + ", widget info: " + mCreateWidgetInfo.info);
preloadWidget(mCreateWidgetInfo);
}
private void cleanupWidgetPreloading(boolean widgetWasAdded) {
+ Log.d(TAG, "6557954 Cleaning up widget, was added: " + widgetWasAdded);
+ if (mCreateWidgetInfo != null) {
+ Log.d(TAG, " 6557954 Cleaning up widget, widget info: " + mCreateWidgetInfo.info);
+ }
+
if (!widgetWasAdded) {
// If the widget was not added, we may need to do further cleanup.
PendingAddWidgetInfo info = mCreateWidgetInfo;
@@ -709,13 +719,16 @@
// First step was to allocate a widget id, revert that.
if ((mWidgetCleanupState == WIDGET_BOUND || mWidgetCleanupState == WIDGET_INFLATED) &&
mWidgetLoadingId != -1) {
+ Log.d(TAG, " 6557954 Cleaning up widget, delete widget id");
mLauncher.getAppWidgetHost().deleteAppWidgetId(mWidgetLoadingId);
}
if (mWidgetCleanupState == WIDGET_BOUND) {
// We never actually inflated the widget, so remove the callback to do so.
+ Log.d(TAG, " 6557954 Cleaning up widget, remove callbacks");
removeCallbacks(mInflateWidgetRunnable);
} else if (mWidgetCleanupState == WIDGET_INFLATED) {
// The widget was inflated and added to the DragLayer -- remove it.
+ Log.d(TAG, " 6557954 Cleaning up widget, remove inflated widget from draglayer");
AppWidgetHostView widget = info.boundWidget;
mLauncher.getDragLayer().removeView(widget);
}
@@ -728,7 +741,9 @@
@Override
public void cleanUpShortPress(View v) {
+ Log.d(TAG, "6557954 Cleanup shortpress");
if (!mDraggingWidget) {
+ Log.d(TAG, " 6557954 Cleanup shortpress, cleanup cleanup preloading");
cleanupWidgetPreloading(false);
}
}
@@ -739,9 +754,15 @@
ImageView image = (ImageView) v.findViewById(R.id.widget_preview);
PendingAddItemInfo createItemInfo = (PendingAddItemInfo) v.getTag();
+ if (createItemInfo instanceof PendingAddWidgetInfo) {
+ PendingAddWidgetInfo createWidgetInfo = mCreateWidgetInfo;
+ Log.d(TAG, "6557954 Begin dragging widget, view: " + v + ", widget info: " + createWidgetInfo.info);
+ }
+
// If the ImageView doesn't have a drawable yet, the widget preview hasn't been loaded and
// we abort the drag.
if (image.getDrawable() == null) {
+ Log.d(TAG, " 6557954 Begin dragging widget, abort, no drawable set");
mDraggingWidget = false;
return false;
}
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index d01de9c..9dc1fe4 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -817,6 +817,7 @@
mPendingAddInfo.spanX = savedState.getInt(RUNTIME_STATE_PENDING_ADD_SPAN_X);
mPendingAddInfo.spanY = savedState.getInt(RUNTIME_STATE_PENDING_ADD_SPAN_Y);
mPendingAddWidgetInfo = savedState.getParcelable(RUNTIME_STATE_PENDING_ADD_WIDGET_INFO);
+ mWaitingForResult = true;
mRestoring = true;
}
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index f562cbc..ba51889 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -2839,7 +2839,6 @@
if (willAddToFolder && mDragMode == DRAG_MODE_NONE) {
mDragOverFolderIcon = ((FolderIcon) dragOverView);
- mAddToExistingFolderOnDrop = true;
mDragOverFolderIcon.onDragEnter(info);
if (targetLayout != null) {
targetLayout.clearDragOutlines();
@@ -3139,7 +3138,7 @@
private void getFinalPositionForDropAnimation(int[] loc, float[] scaleXY,
DragView dragView, CellLayout layout, ItemInfo info, int[] targetCell,
- boolean external) {
+ boolean external, boolean scale) {
// Now we animate the dragView, (ie. the widget or shortcut preview) into its final
// location and size on the home screen.
int spanX = info.spanX;
@@ -3153,8 +3152,16 @@
float cellLayoutScale =
mLauncher.getDragLayer().getDescendantCoordRelativeToSelf(layout, loc);
resetTransitionTransform(layout);
- float dragViewScaleX = (1.0f * r.width()) / dragView.getMeasuredWidth();
- float dragViewScaleY = (1.0f * r.height()) / dragView.getMeasuredHeight();
+
+ float dragViewScaleX;
+ float dragViewScaleY;
+ if (scale) {
+ dragViewScaleX = (1.0f * r.width()) / dragView.getMeasuredWidth();
+ dragViewScaleY = (1.0f * r.height()) / dragView.getMeasuredHeight();
+ } else {
+ dragViewScaleX = 1f;
+ dragViewScaleY = 1f;
+ }
// The animation will scale the dragView about its center, so we need to center about
// the final location.
@@ -3173,14 +3180,16 @@
int[] finalPos = new int[2];
float scaleXY[] = new float[2];
+ boolean scalePreview = !(info instanceof PendingAddShortcutInfo);
getFinalPositionForDropAnimation(finalPos, scaleXY, dragView, cellLayout, info, mTargetCell,
- external);
+ external, scalePreview);
Resources res = mLauncher.getResources();
int duration = res.getInteger(R.integer.config_dropAnimMaxDuration) - 200;
// In the case where we've prebound the widget, we remove it from the DragLayer
if (finalView instanceof AppWidgetHostView && external) {
+ Log.d(TAG, "6557954 Animate widget drop, final view is appWidgetHostView");
mLauncher.getDragLayer().removeView(finalView);
}
if ((animationType == ANIMATE_INTO_POSITION_AND_RESIZE || external) && finalView != null) {