Ensure that we update the preview layout rule when not animating.

Bug: 28166173
Change-Id: Ibf0245f2dd667216ccabb23a1b279b1801d60cac
This commit is contained in:
Winson
2016-07-25 16:49:15 -07:00
parent 76acffce3d
commit 8f288aac99
3 changed files with 10 additions and 4 deletions
+1
View File
@@ -2584,6 +2584,7 @@ public class Workspace extends PagedView
fi.performCreateAnimation(destInfo, v, sourceInfo, dragView, folderLocation, scale,
postAnimationRunnable);
} else {
fi.prepareCreate(v);
fi.addItem(destInfo);
fi.addItem(sourceInfo);
}
@@ -262,14 +262,19 @@ public class FolderIcon extends FrameLayout implements FolderListener {
}
};
public Drawable prepareCreate(final View destView) {
Drawable animateDrawable = getTopDrawable((TextView) destView);
computePreviewDrawingParams(animateDrawable.getIntrinsicWidth(),
destView.getMeasuredWidth());
return animateDrawable;
}
public void performCreateAnimation(final ShortcutInfo destInfo, final View destView,
final ShortcutInfo srcInfo, final DragView srcView, Rect dstRect,
float scaleRelativeToDragLayer, Runnable postAnimationRunnable) {
// These correspond two the drawable and view that the icon was dropped _onto_
Drawable animateDrawable = getTopDrawable((TextView) destView);
computePreviewDrawingParams(animateDrawable.getIntrinsicWidth(),
destView.getMeasuredWidth());
Drawable animateDrawable = prepareCreate(destView);
mReferenceDrawable = animateDrawable;
@@ -197,7 +197,7 @@ public class FolderPagedView extends PagedView {
*/
public int allocateRankForNewItem(ShortcutInfo info) {
int rank = getItemCount();
ArrayList<View> views = new ArrayList<View>(mFolder.getItemsInReadingOrder());
ArrayList<View> views = new ArrayList<>(mFolder.getItemsInReadingOrder());
views.add(rank, null);
arrangeChildren(views, views.size(), false);
setCurrentPage(rank / mMaxItemsPerPage);