Fixing drag and drop framerate regression in workspace
-> Animating the alpha on workspace during drop was slowing things down. Instead we modify the alpha on the individual CellLayoutChildren objects which have hardware layers, so modulating their alpha is cheap. Change-Id: Id31e47cd05d593d2fef0ab28e15a9d4e11ed1aa1
This commit is contained in:
1 parent
d41fbf5680
commit
f0777b9d7a
1 file changed
+20
-10
@@ -369,10 +369,14 @@ public class Workspace extends SmoothPagedView
|
||||
mLauncher.lockScreenOrientationOnLargeUI();
|
||||
|
||||
// Fade out the workspace slightly to highlight the currently dragging item
|
||||
animate().alpha(mDragFadeOutAlpha)
|
||||
.setInterpolator(new AccelerateInterpolator(1.5f))
|
||||
.setDuration(mDragFadeOutDuration)
|
||||
.start();
|
||||
int count = getChildCount();
|
||||
for (int i = 0; i < count; i++) {
|
||||
CellLayout cl = (CellLayout) getPageAt(i);
|
||||
cl.getChildrenLayout().animate().alpha(mDragFadeOutAlpha)
|
||||
.setInterpolator(new AccelerateInterpolator(1.5f))
|
||||
.setDuration(mDragFadeOutDuration)
|
||||
.start();
|
||||
}
|
||||
}
|
||||
|
||||
public void onDragEnd() {
|
||||
@@ -381,10 +385,14 @@ public class Workspace extends SmoothPagedView
|
||||
mLauncher.unlockScreenOrientationOnLargeUI();
|
||||
|
||||
// Fade the workspace back in after we have completed dragging
|
||||
animate().alpha(1f)
|
||||
.setInterpolator(new DecelerateInterpolator(1.5f))
|
||||
.setDuration(mDragFadeOutDuration)
|
||||
.start();
|
||||
int count = getChildCount();
|
||||
for (int i = 0; i < count; i++) {
|
||||
CellLayout cl = (CellLayout) getPageAt(i);
|
||||
cl.getChildrenLayout().animate().alpha(1f)
|
||||
.setInterpolator(new DecelerateInterpolator(1.5f))
|
||||
.setDuration(mDragFadeOutDuration)
|
||||
.start();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2026,7 +2034,8 @@ public class Workspace extends SmoothPagedView
|
||||
minSpanY = ((PendingAddWidgetInfo) d.dragInfo).minSpanY;
|
||||
}
|
||||
mTargetCell = findNearestArea((int) mDragViewVisualCenter[0],
|
||||
(int) mDragViewVisualCenter[1], minSpanX, minSpanY, mDragTargetLayout, mTargetCell);
|
||||
(int) mDragViewVisualCenter[1], minSpanX, minSpanY, mDragTargetLayout,
|
||||
mTargetCell);
|
||||
if (willCreateUserFolder((ItemInfo) d.dragInfo, mDragTargetLayout, mTargetCell, true)) {
|
||||
return true;
|
||||
}
|
||||
@@ -2507,7 +2516,8 @@ public class Workspace extends SmoothPagedView
|
||||
final PendingAddWidgetInfo createInfo =
|
||||
new PendingAddWidgetInfo(widgetInfo, mimeType, data);
|
||||
mLauncher.addAppWidgetFromDrop(createInfo,
|
||||
LauncherSettings.Favorites.CONTAINER_DESKTOP, mCurrentPage, null, null, pos);
|
||||
LauncherSettings.Favorites.CONTAINER_DESKTOP, mCurrentPage,
|
||||
null, null, pos);
|
||||
} else {
|
||||
// Show the widget picker dialog if there is more than one widget
|
||||
// that can handle this data type
|
||||
|
||||
Reference in new issue
Block a user