summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/folder/ClippedFolderIconLayoutRule.java
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2016-02-24 19:19:06 -0800
committerAdam Cohen <adamcohen@google.com>2016-03-03 09:24:45 -0800
commitefca0279eb927faebffc38c8382818df67fcd159 (patch)
tree15ede9a36767c9d04a47e355edc5550b25dfb36c /src/com/android/launcher3/folder/ClippedFolderIconLayoutRule.java
parent992a5f566e7f1b1fc8bd766f1fd00bee7ea2a634 (diff)
downloadandroid_packages_apps_Trebuchet-efca0279eb927faebffc38c8382818df67fcd159.tar.gz
android_packages_apps_Trebuchet-efca0279eb927faebffc38c8382818df67fcd159.tar.bz2
android_packages_apps_Trebuchet-efca0279eb927faebffc38c8382818df67fcd159.zip
Switch all folder preview rendering to be programmatic (ie. no assets)
-> Refactored the preview background rendering to be much more self-contained. This cleans up a lot of code in the CellLayout, and keeps the logic in the right place. -> We switch to software rendering for performance and compatibility reasons. -> Removed all assets. -> FolderIcon accept animation includes animation of the clipped region. -> 1:1 hand-off of drawing of the FolderIcon background between the FolderIcon and the CellLayout. Unfortunately, CellLayout rendering is still required to work around clipping issues (due to use of software layer). We also need this to support folder creation feedback. Change-Id: Ib8f7fa6359dfedff8145f38dd50ba03849ca0d51
Diffstat (limited to 'src/com/android/launcher3/folder/ClippedFolderIconLayoutRule.java')
-rw-r--r--src/com/android/launcher3/folder/ClippedFolderIconLayoutRule.java16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/com/android/launcher3/folder/ClippedFolderIconLayoutRule.java b/src/com/android/launcher3/folder/ClippedFolderIconLayoutRule.java
index 48988d7f2..68b756b24 100644
--- a/src/com/android/launcher3/folder/ClippedFolderIconLayoutRule.java
+++ b/src/com/android/launcher3/folder/ClippedFolderIconLayoutRule.java
@@ -15,6 +15,7 @@ public class ClippedFolderIconLayoutRule implements FolderIcon.PreviewLayoutRule
final float MIN_SCALE = 0.48f;
final float MAX_SCALE = 0.58f;
final float MAX_RADIUS_DILATION = 0.15f;
+ final float ITEM_RADIUS_SCALE_FACTOR = 1.33f;
private float[] mTmpPoint = new float[2];
@@ -22,27 +23,19 @@ public class ClippedFolderIconLayoutRule implements FolderIcon.PreviewLayoutRule
private float mRadius;
private float mIconSize;
private boolean mIsRtl;
- private Path mClipPath = new Path();
@Override
public void init(int availableSpace, int intrinsicIconSize, boolean rtl) {
mAvailableSpace = availableSpace;
- mRadius = 0.66f * availableSpace;
+ mRadius = ITEM_RADIUS_SCALE_FACTOR * availableSpace / 2f;
mIconSize = intrinsicIconSize;
mIsRtl = rtl;
-
- // We make the clip radius just slightly smaller than the background drawable
- // TODO(adamcohen): this is hacky, needs cleanup (likely through programmatic drawing).
- int clipRadius = (int) mAvailableSpace / 2 - 1;
-
- mClipPath.addCircle(mAvailableSpace / 2, mAvailableSpace / 2, clipRadius, Path.Direction.CW);
}
@Override
public FolderIcon.PreviewItemDrawingParams computePreviewItemDrawingParams(int index,
int curNumItems, FolderIcon.PreviewItemDrawingParams params) {
-
float totalScale = scaleForNumItems(curNumItems);
float transX;
float transY;
@@ -55,7 +48,6 @@ public class ClippedFolderIconLayoutRule implements FolderIcon.PreviewLayoutRule
getPosition(index, curNumItems, mTmpPoint);
transX = mTmpPoint[0];
transY = mTmpPoint[1];
- totalScale = scaleForNumItems(curNumItems);
}
if (params == null) {
@@ -126,8 +118,8 @@ public class ClippedFolderIconLayoutRule implements FolderIcon.PreviewLayoutRule
}
@Override
- public Path getClipPath() {
- return mClipPath;
+ public boolean clipToBackground() {
+ return true;
}
}