Fix a couple polish bugs with new folder previews

-> Don't reuse the same background object for the folder create preview
   since this can cause interruptions in the animations for previous
   creation previews.
-> When drawing the background to preview creation, don't draw the stroke
   above the icon since the icon is not yet contained by the folder.

Change-Id: Ib666dc2453df465b342c02f3bd109b553a769dcc
This commit is contained in:
Adam Cohen committed 2016-04-01 11:50:31 -07:00
1 parent 7efe651226
commit f172b747c2
3 files changed
+37 -16

No files matched your search

+11 -3
View File
@@ -219,7 +219,7 @@ public class Workspace extends PagedView
public static final int REORDER_TIMEOUT = 350;
private final Alarm mFolderCreationAlarm = new Alarm();
private final Alarm mReorderAlarm = new Alarm();
private FolderIcon.PreviewBackground mFolderCreateBg = new FolderIcon.PreviewBackground();
private FolderIcon.PreviewBackground mFolderCreateBg;
private FolderIcon mDragOverFolderIcon = null;
private boolean mCreateUserFolderOnDrop = false;
private boolean mAddToExistingFolderOnDrop = false;
@@ -2878,7 +2878,9 @@ public class Workspace extends PagedView
}
private void cleanupFolderCreation() {
mFolderCreateBg.animateToRest();
if (mFolderCreateBg != null) {
mFolderCreateBg.animateToRest();
}
mFolderCreationAlarm.setOnAlarmListener(null);
mFolderCreationAlarm.cancelAlarm();
}
@@ -3182,6 +3184,8 @@ public class Workspace extends PagedView
int cellX;
int cellY;
FolderIcon.PreviewBackground bg = new FolderIcon.PreviewBackground();
public FolderCreationAlarmListener(CellLayout layout, int cellX, int cellY) {
this.layout = layout;
this.cellX = cellX;
@@ -3190,11 +3194,15 @@ public class Workspace extends PagedView
DeviceProfile grid = mLauncher.getDeviceProfile();
BubbleTextView cell = (BubbleTextView) layout.getChildAt(cellX, cellY);
mFolderCreateBg.setup(getResources().getDisplayMetrics(), grid, null,
bg.setup(getResources().getDisplayMetrics(), grid, null,
cell.getMeasuredWidth(), cell.getPaddingTop());
// The full preview background should appear behind the icon
bg.isClipping = false;
}
public void onAlarm(Alarm alarm) {
mFolderCreateBg = bg;
mFolderCreateBg.animateToAccept(layout, cellX, cellY);
layout.clearDragOutlines();
setDragMode(DRAG_MODE_CREATE_FOLDER);