Fix folder morphing animation
- Also splits interpolator between open / closing anim to setup future folder motion work - Also fixed bug if no shape selected in picker Bug: 393979768 Bug: 387543793 Test: Manual verify animation and picker bug Flag: com.android.launcher3.enable_launcher_icon_shapes Change-Id: Ieb7355b9128cd1ded46af6787f5c14baf9be6774
This commit is contained in:
1 parent
11c035cb2f
commit
5c7ef0b01e
4 files changed
+39
-34
No files matched your search
@@ -35,6 +35,7 @@ import android.graphics.drawable.GradientDrawable;
|
||||
import android.util.Property;
|
||||
import android.view.View;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import com.android.launcher3.BubbleTextView;
|
||||
import com.android.launcher3.CellLayout;
|
||||
@@ -79,9 +80,10 @@ public class FolderAnimationManager {
|
||||
private final int mDuration;
|
||||
private final int mDelay;
|
||||
|
||||
private final TimeInterpolator mFolderInterpolator;
|
||||
private final TimeInterpolator mLargeFolderPreviewItemOpenInterpolator;
|
||||
private final TimeInterpolator mLargeFolderPreviewItemCloseInterpolator;
|
||||
private final Interpolator mFolderOpenInterpolator;
|
||||
private final Interpolator mFolderCloseInterpolator;
|
||||
private final Interpolator mLargeFolderPreviewItemOpenInterpolator;
|
||||
private final Interpolator mLargeFolderPreviewItemCloseInterpolator;
|
||||
|
||||
private final PreviewItemDrawingParams mTmpParams = new PreviewItemDrawingParams(0, 0, 0);
|
||||
private final FolderGridOrganizer mPreviewVerifier;
|
||||
@@ -108,7 +110,9 @@ public class FolderAnimationManager {
|
||||
mDuration = res.getInteger(R.integer.config_materialFolderExpandDuration);
|
||||
mDelay = res.getInteger(R.integer.config_folderDelay);
|
||||
|
||||
mFolderInterpolator = AnimationUtils.loadInterpolator(mContext,
|
||||
mFolderOpenInterpolator = AnimationUtils.loadInterpolator(mContext,
|
||||
R.interpolator.standard_interpolator);
|
||||
mFolderCloseInterpolator = AnimationUtils.loadInterpolator(mContext,
|
||||
R.interpolator.standard_interpolator);
|
||||
mLargeFolderPreviewItemOpenInterpolator = AnimationUtils.loadInterpolator(mContext,
|
||||
R.interpolator.large_folder_preview_item_open_interpolator);
|
||||
@@ -252,6 +256,7 @@ public class FolderAnimationManager {
|
||||
(int) (left + (startRect.right / initialScale)) + extraRadius,
|
||||
(int) (startRect.bottom / initialScale) + extraRadius);
|
||||
Rect contentEnd = new Rect(left, 0, left + lp.width, lp.height);
|
||||
// animated contents of folder with the folder background
|
||||
play(a, shapeDelegate.createRevealAnimator(
|
||||
mFolder.getContent(), contentStart, contentEnd, finalRadius, !mIsOpening));
|
||||
|
||||
@@ -332,7 +337,11 @@ public class FolderAnimationManager {
|
||||
// We set the interpolator on all current child animators here, because the preview item
|
||||
// animators may use a different interpolator.
|
||||
for (Animator animator : a.getChildAnimations()) {
|
||||
animator.setInterpolator(mFolderInterpolator);
|
||||
animator.setInterpolator(
|
||||
mIsOpening
|
||||
? mFolderOpenInterpolator
|
||||
: mFolderCloseInterpolator
|
||||
);
|
||||
}
|
||||
|
||||
int radiusDiff = scaledRadius - mPreviewBackground.getRadius();
|
||||
@@ -467,7 +476,7 @@ public class FolderAnimationManager {
|
||||
return mFolder.getItemCount() > MAX_NUM_ITEMS_IN_PREVIEW;
|
||||
}
|
||||
|
||||
private TimeInterpolator getPreviewItemInterpolator() {
|
||||
private Interpolator getPreviewItemInterpolator() {
|
||||
if (isLargeFolder()) {
|
||||
// With larger folders, we want the preview items to reach their final positions faster
|
||||
// (when opening) and later (when closing) so that they appear aligned with the rest of
|
||||
@@ -476,7 +485,7 @@ public class FolderAnimationManager {
|
||||
? mLargeFolderPreviewItemOpenInterpolator
|
||||
: mLargeFolderPreviewItemCloseInterpolator;
|
||||
}
|
||||
return mFolderInterpolator;
|
||||
return mIsOpening ? mFolderOpenInterpolator : mFolderCloseInterpolator;
|
||||
}
|
||||
|
||||
private Animator getAnimator(View view, Property property, float v1, float v2) {
|
||||
|
||||
Reference in new issue
Block a user