summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/folder
diff options
context:
space:
mode:
authorJon Miranda <jonmiranda@google.com>2017-07-14 12:42:22 -0700
committerJon Miranda <jonmiranda@google.com>2017-07-14 13:18:25 -0700
commitecf451457b151f19884233dfe5461675c34fc725 (patch)
treebfe4a7383c50fedf263fb57931936a5e62ef5b47 /src/com/android/launcher3/folder
parent28032006970703240f4abd34429608abd2358645 (diff)
downloadandroid_packages_apps_Trebuchet-ecf451457b151f19884233dfe5461675c34fc725.tar.gz
android_packages_apps_Trebuchet-ecf451457b151f19884233dfe5461675c34fc725.tar.bz2
android_packages_apps_Trebuchet-ecf451457b151f19884233dfe5461675c34fc725.zip
Polish Folder open animation during drag and drop.
We now use the current FolderIcon background radius as the clipping size for the Folder, which results in a smoother hand-off between the two. Before this change, the Folder would center itself against the FolderIcon during the hand-off. This resulted in the preview items being fully-visible in the FolderIcon, to being clipped in the Folder. Bug: 63709477 Change-Id: I1da187485f28dde92d171729b011ada47a506f85
Diffstat (limited to 'src/com/android/launcher3/folder')
-rw-r--r--src/com/android/launcher3/folder/FolderAnimationManager.java21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/com/android/launcher3/folder/FolderAnimationManager.java b/src/com/android/launcher3/folder/FolderAnimationManager.java
index 26a2c8913..69705d594 100644
--- a/src/com/android/launcher3/folder/FolderAnimationManager.java
+++ b/src/com/android/launcher3/folder/FolderAnimationManager.java
@@ -125,7 +125,8 @@ public class FolderAnimationManager {
final Rect folderIconPos = new Rect();
float scaleRelativeToDragLayer = mLauncher.getDragLayer()
.getDescendantRectRelativeToSelf(mFolderIcon, folderIconPos);
- float initialSize = (mPreviewBackground.getRadius() * 2) * scaleRelativeToDragLayer;
+ int scaledRadius = mPreviewBackground.getScaledRadius();
+ float initialSize = (scaledRadius * 2) * scaleRelativeToDragLayer;
// Match size/scale of icons in the preview
float previewScale = rule.scaleForItem(0, itemsInPreview.size());
@@ -152,13 +153,9 @@ public class FolderAnimationManager {
final int paddingOffsetY = (int) ((mFolder.getPaddingTop() + mContent.getPaddingTop())
* initialScale);
- // Background can have a scaled radius in drag and drop mode.
- int radiusDiff = mPreviewBackground.getScaledRadius()- mPreviewBackground.getRadius();
-
int initialX = folderIconPos.left + mPreviewBackground.getOffsetX() - paddingOffsetX
- - previewItemOffsetX + radiusDiff;
- int initialY = folderIconPos.top + mPreviewBackground.getOffsetY() - paddingOffsetY
- + radiusDiff;
+ - previewItemOffsetX;
+ int initialY = folderIconPos.top + mPreviewBackground.getOffsetY() - paddingOffsetY;
final float xDistance = initialX - lp.x;
final float yDistance = initialY - lp.y;
@@ -232,7 +229,11 @@ public class FolderAnimationManager {
animator.setInterpolator(mFolderInterpolator);
}
- addPreviewItemAnimators(a, initialScale / scaleRelativeToDragLayer, previewItemOffsetX);
+ int radiusDiff = scaledRadius - mPreviewBackground.getRadius();
+ addPreviewItemAnimators(a, initialScale / scaleRelativeToDragLayer,
+ // Background can have a scaled radius in drag and drop mode, so we need to add the
+ // difference to keep the preview items centered.
+ previewItemOffsetX + radiusDiff, radiusDiff);
return a;
}
@@ -240,7 +241,7 @@ public class FolderAnimationManager {
* Animate the items on the current page.
*/
private void addPreviewItemAnimators(AnimatorSet animatorSet, final float folderScale,
- int previewItemOffsetX) {
+ int previewItemOffsetX, int previewItemOffsetY) {
FolderIcon.PreviewLayoutRule rule = mFolderIcon.getLayoutRule();
boolean isOnFirstPage = mFolder.mContent.getCurrentPage() == 0;
final List<BubbleTextView> itemsInPreview = isOnFirstPage
@@ -281,7 +282,7 @@ public class FolderAnimationManager {
final int previewPosX =
(int) ((mTmpParams.transX - iconOffsetX + previewItemOffsetX) / folderScale);
- final int previewPosY = (int) (mTmpParams.transY / folderScale);
+ final int previewPosY = (int) ((mTmpParams.transY + previewItemOffsetY) / folderScale);
final float xDistance = previewPosX - btvLp.x;
final float yDistance = previewPosY - btvLp.y;