Adding spring effect for folder icons when dragging similar to adaptive icons

Bug: 63889144
Change-Id: Idd1fd13c6343bf3e0a3a0e5ff0be730d41996575
diff --git a/src/com/android/launcher3/folder/PreviewBackground.java b/src/com/android/launcher3/folder/PreviewBackground.java
index 61490ee..eba5d98 100644
--- a/src/com/android/launcher3/folder/PreviewBackground.java
+++ b/src/com/android/launcher3/folder/PreviewBackground.java
@@ -195,19 +195,28 @@
         invalidate();
     }
 
+    public int getBgColor() {
+        int alpha = (int) Math.min(MAX_BG_OPACITY, BG_OPACITY * mColorMultiplier);
+        return ColorUtils.setAlphaComponent(mBgColor, alpha);
+    }
+
     public void drawBackground(Canvas canvas) {
         mPaint.setStyle(Paint.Style.FILL);
-        int alpha = (int) Math.min(MAX_BG_OPACITY, BG_OPACITY * mColorMultiplier);
-        mPaint.setColor(ColorUtils.setAlphaComponent(mBgColor, alpha));
+        mPaint.setColor(getBgColor());
 
         drawCircle(canvas, 0 /* deltaRadius */);
 
-        // Draw shadow.
+        drawShadow(canvas);
+    }
+
+    public void drawShadow(Canvas canvas) {
         if (mShadowShader == null) {
             return;
         }
+
         float radius = getScaledRadius();
         float shadowRadius = radius + mStrokeWidth;
+        mPaint.setStyle(Paint.Style.FILL);
         mPaint.setColor(Color.BLACK);
         int offsetX = getOffsetX();
         int offsetY = getOffsetY();
@@ -219,7 +228,7 @@
 
         } else {
             saveCount = canvas.save(Canvas.CLIP_SAVE_FLAG);
-            clipCanvasSoftware(canvas, Region.Op.DIFFERENCE);
+            canvas.clipPath(getClipPath(), Region.Op.DIFFERENCE);
         }
 
         mShaderMatrix.setScale(shadowRadius, shadowRadius);
@@ -295,12 +304,11 @@
                 radius - deltaRadius, mPaint);
     }
 
-    // It is the callers responsibility to save and restore the canvas layers.
-    void clipCanvasSoftware(Canvas canvas, Region.Op op) {
+    public Path getClipPath() {
         mPath.reset();
         float r = getScaledRadius();
         mPath.addCircle(r + getOffsetX(), r + getOffsetY(), r, Path.Direction.CW);
-        canvas.clipPath(mPath, op);
+        return mPath;
     }
 
     // It is the callers responsibility to save and restore the canvas layers.