Loading src/com/android/launcher3/CellLayout.java +10 −5 Original line number Diff line number Diff line Loading @@ -510,6 +510,9 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler { canvas.save(); canvas.translate(mTempLocation[0], mTempLocation[1]); bg.drawBackground(canvas, mFolderBgPaint); if (!bg.isClipping) { bg.drawBackgroundStroke(canvas, mFolderBgPaint); } canvas.restore(); } Loading @@ -529,6 +532,7 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler { for (int i = 0; i < mFolderBackgrounds.size(); i++) { FolderIcon.PreviewBackground bg = mFolderBackgrounds.get(i); if (bg.isClipping) { cellToPoint(bg.delegateCellX, bg.delegateCellY, mTempLocation); canvas.save(); canvas.translate(mTempLocation[0], mTempLocation[1]); Loading @@ -536,6 +540,7 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler { canvas.restore(); } } } public void addFolderBackground(FolderIcon.PreviewBackground bg) { mFolderBackgrounds.add(bg); Loading src/com/android/launcher3/Workspace.java +11 −3 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -2878,7 +2878,9 @@ public class Workspace extends PagedView } private void cleanupFolderCreation() { if (mFolderCreateBg != null) { mFolderCreateBg.animateToRest(); } mFolderCreationAlarm.setOnAlarmListener(null); mFolderCreationAlarm.cancelAlarm(); } Loading Loading @@ -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; Loading @@ -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); Loading src/com/android/launcher3/folder/FolderIcon.java +16 −8 Original line number Diff line number Diff line Loading @@ -492,12 +492,16 @@ public class FolderIcon extends FrameLayout implements FolderListener { canvas.restore(); } /** * This object represents a FolderIcon preview background. It stores drawing / measurement * information, handles drawing, and animation (accept state <--> rest state). */ public static class PreviewBackground { private float mScale = 1f; private float mColorMultiplier = 1f; private Path mClipPath = new Path(); private int mStrokeWidth; private View mInvalidateDeligate; private View mInvalidateDelegate; public int previewSize; private int basePreviewOffsetX; Loading @@ -507,6 +511,10 @@ public class FolderIcon extends FrameLayout implements FolderListener { public int delegateCellX; public int delegateCellY; // When the PreviewBackground is drawn under an icon (for creating a folder) the border // should not occlude the icon public boolean isClipping = true; // Drawing / animation configurations private static final float ACCEPT_SCALE_FACTOR = 1.25f; private static final float ACCEPT_COLOR_MULTIPLIER = 1.5f; Loading @@ -519,9 +527,9 @@ public class FolderIcon extends FrameLayout implements FolderListener { ValueAnimator mScaleAnimator; public void setup(DisplayMetrics dm, DeviceProfile grid, View invalidateDeligate, public void setup(DisplayMetrics dm, DeviceProfile grid, View invalidateDelegate, int availableSpace, int topPadding) { mInvalidateDeligate = invalidateDeligate; mInvalidateDelegate = invalidateDelegate; final int previewSize = grid.folderIconSizePx; final int previewPadding = grid.folderIconPreviewPadding; Loading Loading @@ -557,8 +565,8 @@ public class FolderIcon extends FrameLayout implements FolderListener { mClipPath.reset(); mClipPath.addCircle(radius, radius, radius, Path.Direction.CW); if (mInvalidateDeligate != null) { mInvalidateDeligate.invalidate(); if (mInvalidateDelegate != null) { mInvalidateDelegate.invalidate(); } if (mDrawingDelegate != null) { Loading @@ -566,8 +574,8 @@ public class FolderIcon extends FrameLayout implements FolderListener { } } void setInvalidateDeligate(View invalidateDeligate) { mInvalidateDeligate = invalidateDeligate; void setInvalidateDelegate(View invalidateDelegate) { mInvalidateDelegate = invalidateDelegate; invalidate(); } Loading Loading @@ -742,7 +750,7 @@ public class FolderIcon extends FrameLayout implements FolderListener { public void setFolderBackground(PreviewBackground bg) { mBackground = bg; mBackground.setInvalidateDeligate(this); mBackground.setInvalidateDelegate(this); } @Override Loading Loading
src/com/android/launcher3/CellLayout.java +10 −5 Original line number Diff line number Diff line Loading @@ -510,6 +510,9 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler { canvas.save(); canvas.translate(mTempLocation[0], mTempLocation[1]); bg.drawBackground(canvas, mFolderBgPaint); if (!bg.isClipping) { bg.drawBackgroundStroke(canvas, mFolderBgPaint); } canvas.restore(); } Loading @@ -529,6 +532,7 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler { for (int i = 0; i < mFolderBackgrounds.size(); i++) { FolderIcon.PreviewBackground bg = mFolderBackgrounds.get(i); if (bg.isClipping) { cellToPoint(bg.delegateCellX, bg.delegateCellY, mTempLocation); canvas.save(); canvas.translate(mTempLocation[0], mTempLocation[1]); Loading @@ -536,6 +540,7 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler { canvas.restore(); } } } public void addFolderBackground(FolderIcon.PreviewBackground bg) { mFolderBackgrounds.add(bg); Loading
src/com/android/launcher3/Workspace.java +11 −3 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -2878,7 +2878,9 @@ public class Workspace extends PagedView } private void cleanupFolderCreation() { if (mFolderCreateBg != null) { mFolderCreateBg.animateToRest(); } mFolderCreationAlarm.setOnAlarmListener(null); mFolderCreationAlarm.cancelAlarm(); } Loading Loading @@ -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; Loading @@ -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); Loading
src/com/android/launcher3/folder/FolderIcon.java +16 −8 Original line number Diff line number Diff line Loading @@ -492,12 +492,16 @@ public class FolderIcon extends FrameLayout implements FolderListener { canvas.restore(); } /** * This object represents a FolderIcon preview background. It stores drawing / measurement * information, handles drawing, and animation (accept state <--> rest state). */ public static class PreviewBackground { private float mScale = 1f; private float mColorMultiplier = 1f; private Path mClipPath = new Path(); private int mStrokeWidth; private View mInvalidateDeligate; private View mInvalidateDelegate; public int previewSize; private int basePreviewOffsetX; Loading @@ -507,6 +511,10 @@ public class FolderIcon extends FrameLayout implements FolderListener { public int delegateCellX; public int delegateCellY; // When the PreviewBackground is drawn under an icon (for creating a folder) the border // should not occlude the icon public boolean isClipping = true; // Drawing / animation configurations private static final float ACCEPT_SCALE_FACTOR = 1.25f; private static final float ACCEPT_COLOR_MULTIPLIER = 1.5f; Loading @@ -519,9 +527,9 @@ public class FolderIcon extends FrameLayout implements FolderListener { ValueAnimator mScaleAnimator; public void setup(DisplayMetrics dm, DeviceProfile grid, View invalidateDeligate, public void setup(DisplayMetrics dm, DeviceProfile grid, View invalidateDelegate, int availableSpace, int topPadding) { mInvalidateDeligate = invalidateDeligate; mInvalidateDelegate = invalidateDelegate; final int previewSize = grid.folderIconSizePx; final int previewPadding = grid.folderIconPreviewPadding; Loading Loading @@ -557,8 +565,8 @@ public class FolderIcon extends FrameLayout implements FolderListener { mClipPath.reset(); mClipPath.addCircle(radius, radius, radius, Path.Direction.CW); if (mInvalidateDeligate != null) { mInvalidateDeligate.invalidate(); if (mInvalidateDelegate != null) { mInvalidateDelegate.invalidate(); } if (mDrawingDelegate != null) { Loading @@ -566,8 +574,8 @@ public class FolderIcon extends FrameLayout implements FolderListener { } } void setInvalidateDeligate(View invalidateDeligate) { mInvalidateDeligate = invalidateDeligate; void setInvalidateDelegate(View invalidateDelegate) { mInvalidateDelegate = invalidateDelegate; invalidate(); } Loading Loading @@ -742,7 +750,7 @@ public class FolderIcon extends FrameLayout implements FolderListener { public void setFolderBackground(PreviewBackground bg) { mBackground = bg; mBackground.setInvalidateDeligate(this); mBackground.setInvalidateDelegate(this); } @Override Loading