Loading res/values/config.xml +3 −1 Original line number Diff line number Diff line Loading @@ -79,7 +79,9 @@ <integer name="config_dropAnimMaxDuration">500</integer> <!-- The duration of the UserFolder opening and closing animation --> <integer name="config_folderAnimDuration">120</integer> <integer name="config_folderExpandDuration">120</integer> <integer name="config_materialFolderExpandDuration">200</integer> <integer name="config_materialFolderExpandStagger">60</integer> <!-- The distance at which the animation should take the max duration --> <integer name="config_dropAnimMaxDist">800</integer> Loading src/com/android/launcher3/Folder.java +96 −14 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.launcher3; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.animation.PropertyValuesHolder; import android.content.Context; Loading @@ -40,6 +41,7 @@ import android.view.MotionEvent; import android.view.View; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; import android.view.animation.AccelerateInterpolator; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; import android.widget.LinearLayout; Loading Loading @@ -72,6 +74,8 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList private static final int CLOSE_FOLDER_DELAY_MS = 150; private int mExpandDuration; private int mMaterialExpandDuration; private int mMaterialExpandStagger; protected CellLayout mContent; private ScrollView mScrollView; private final LayoutInflater mInflater; Loading Loading @@ -159,7 +163,9 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList mInputMethodManager = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); mExpandDuration = res.getInteger(R.integer.config_folderAnimDuration); mExpandDuration = res.getInteger(R.integer.config_folderExpandDuration); mMaterialExpandDuration = res.getInteger(R.integer.config_materialFolderExpandDuration); mMaterialExpandStagger = res.getInteger(R.integer.config_materialFolderExpandStagger); if (sDefaultFolderName == null) { sDefaultFolderName = res.getString(R.string.folder_name); Loading Loading @@ -450,18 +456,93 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList mState = STATE_SMALL; } public void animateOpen() { positionAndSizeAsIcon(); private void prepareReveal() { setScaleX(1f); setScaleY(1f); setAlpha(1f); mState = STATE_SMALL; } public void animateOpen() { if (!(getParent() instanceof DragLayer)) return; Animator openFolderAnim = null; final Runnable onCompleteRunnable; if (!Utilities.isLmp()) { positionAndSizeAsIcon(); centerAboutIcon(); PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 1); PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 1.0f); PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 1.0f); final ObjectAnimator oa = LauncherAnimUtils.ofPropertyValuesHolder(this, alpha, scaleX, scaleY); oa.setDuration(mExpandDuration); openFolderAnim = oa; oa.addListener(new AnimatorListenerAdapter() { setLayerType(LAYER_TYPE_HARDWARE, null); onCompleteRunnable = new Runnable() { @Override public void run() { setLayerType(LAYER_TYPE_NONE, null); } }; } else { prepareReveal(); centerAboutIcon(); int width = getPaddingLeft() + getPaddingRight() + mContent.getDesiredWidth(); int height = getFolderHeight(); float transX = - 0.075f * (width / 2 - getPivotX()); float transY = - 0.075f * (height / 2 - getPivotY()); setTranslationX(transX); setTranslationY(transY); PropertyValuesHolder tx = PropertyValuesHolder.ofFloat("translationX", transX, 0); PropertyValuesHolder ty = PropertyValuesHolder.ofFloat("translationY", transY, 0); int rx = (int) Math.max(Math.max(width - getPivotX(), 0), getPivotX()); int ry = (int) Math.max(Math.max(height - getPivotY(), 0), getPivotY()); float radius = (float) Math.sqrt(rx * rx + ry * ry); AnimatorSet anim = LauncherAnimUtils.createAnimatorSet(); Animator reveal = LauncherAnimUtils.createCircularReveal(this, (int) getPivotX(), (int) getPivotY(), 0, radius); reveal.setDuration(mMaterialExpandDuration); reveal.setInterpolator(new LogDecelerateInterpolator(100, 0)); mContent.setAlpha(0f); Animator iconsAlpha = LauncherAnimUtils.ofFloat(mContent, "alpha", 0f, 1f); iconsAlpha.setDuration(mMaterialExpandDuration); iconsAlpha.setStartDelay(mMaterialExpandStagger); iconsAlpha.setInterpolator(new AccelerateInterpolator(1.5f)); mFolderName.setAlpha(0f); Animator textAlpha = LauncherAnimUtils.ofFloat(mFolderName, "alpha", 0f, 1f); textAlpha.setDuration(mMaterialExpandDuration); textAlpha.setStartDelay(mMaterialExpandStagger); textAlpha.setInterpolator(new AccelerateInterpolator(1.5f)); Animator drift = LauncherAnimUtils.ofPropertyValuesHolder(this, tx, ty); drift.setDuration(mMaterialExpandDuration); drift.setStartDelay(mMaterialExpandStagger); drift.setInterpolator(new LogDecelerateInterpolator(60, 0)); anim.play(drift); anim.play(iconsAlpha); anim.play(textAlpha); anim.play(reveal); openFolderAnim = anim; mContent.setLayerType(LAYER_TYPE_HARDWARE, null); onCompleteRunnable = new Runnable() { @Override public void run() { mContent.setLayerType(LAYER_TYPE_NONE, null); } }; } openFolderAnim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { sendCustomAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED, Loading @@ -472,7 +553,10 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList @Override public void onAnimationEnd(Animator animation) { mState = STATE_OPEN; setLayerType(LAYER_TYPE_NONE, null); if (onCompleteRunnable != null) { onCompleteRunnable.run(); } // Only show cling if we are not in the middle of a drag - this would be quite jarring. if (!mDragController.isDragging()) { Loading @@ -486,9 +570,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList setFocusOnFirstChild(); } }); oa.setDuration(mExpandDuration); setLayerType(LAYER_TYPE_HARDWARE, null); oa.start(); openFolderAnim.start(); // Make sure the folder picks up the last drag move even if the finger doesn't move. if (mDragController.isDragging()) { Loading src/com/android/launcher3/Launcher.java +6 −4 Original line number Diff line number Diff line Loading @@ -2914,7 +2914,10 @@ public class Launcher extends Activity ObjectAnimator oa = LauncherAnimUtils.ofPropertyValuesHolder(mFolderIconImageView, alpha, scaleX, scaleY); oa.setDuration(getResources().getInteger(R.integer.config_folderAnimDuration)); if (Utilities.isLmp()) { oa.setInterpolator(new LogDecelerateInterpolator(100, 0)); } oa.setDuration(getResources().getInteger(R.integer.config_folderExpandDuration)); oa.start(); } Loading @@ -2931,7 +2934,7 @@ public class Launcher extends Activity copyFolderIconToImage(fi); ObjectAnimator oa = LauncherAnimUtils.ofPropertyValuesHolder(mFolderIconImageView, alpha, scaleX, scaleY); oa.setDuration(getResources().getInteger(R.integer.config_folderAnimDuration)); oa.setDuration(getResources().getInteger(R.integer.config_folderExpandDuration)); oa.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { Loading Loading @@ -3288,8 +3291,7 @@ public class Launcher extends Activity int allAppsButtonSize = LauncherAppState.getInstance(). getDynamicGrid().getDeviceProfile().allAppsButtonVisualSize; float startRadius = isWidgetTray ? 0 : allAppsButtonSize / 2; ValueAnimator reveal = (ValueAnimator) LauncherAnimUtils.createCircularReveal(revealView, width / 2, Animator reveal = LauncherAnimUtils.createCircularReveal(revealView, width / 2, height / 2, startRadius, revealRadius); reveal.setDuration(revealDuration); reveal.setInterpolator(new LogDecelerateInterpolator(100, 0)); Loading Loading
res/values/config.xml +3 −1 Original line number Diff line number Diff line Loading @@ -79,7 +79,9 @@ <integer name="config_dropAnimMaxDuration">500</integer> <!-- The duration of the UserFolder opening and closing animation --> <integer name="config_folderAnimDuration">120</integer> <integer name="config_folderExpandDuration">120</integer> <integer name="config_materialFolderExpandDuration">200</integer> <integer name="config_materialFolderExpandStagger">60</integer> <!-- The distance at which the animation should take the max duration --> <integer name="config_dropAnimMaxDist">800</integer> Loading
src/com/android/launcher3/Folder.java +96 −14 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.launcher3; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.animation.PropertyValuesHolder; import android.content.Context; Loading @@ -40,6 +41,7 @@ import android.view.MotionEvent; import android.view.View; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; import android.view.animation.AccelerateInterpolator; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; import android.widget.LinearLayout; Loading Loading @@ -72,6 +74,8 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList private static final int CLOSE_FOLDER_DELAY_MS = 150; private int mExpandDuration; private int mMaterialExpandDuration; private int mMaterialExpandStagger; protected CellLayout mContent; private ScrollView mScrollView; private final LayoutInflater mInflater; Loading Loading @@ -159,7 +163,9 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList mInputMethodManager = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); mExpandDuration = res.getInteger(R.integer.config_folderAnimDuration); mExpandDuration = res.getInteger(R.integer.config_folderExpandDuration); mMaterialExpandDuration = res.getInteger(R.integer.config_materialFolderExpandDuration); mMaterialExpandStagger = res.getInteger(R.integer.config_materialFolderExpandStagger); if (sDefaultFolderName == null) { sDefaultFolderName = res.getString(R.string.folder_name); Loading Loading @@ -450,18 +456,93 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList mState = STATE_SMALL; } public void animateOpen() { positionAndSizeAsIcon(); private void prepareReveal() { setScaleX(1f); setScaleY(1f); setAlpha(1f); mState = STATE_SMALL; } public void animateOpen() { if (!(getParent() instanceof DragLayer)) return; Animator openFolderAnim = null; final Runnable onCompleteRunnable; if (!Utilities.isLmp()) { positionAndSizeAsIcon(); centerAboutIcon(); PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 1); PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 1.0f); PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 1.0f); final ObjectAnimator oa = LauncherAnimUtils.ofPropertyValuesHolder(this, alpha, scaleX, scaleY); oa.setDuration(mExpandDuration); openFolderAnim = oa; oa.addListener(new AnimatorListenerAdapter() { setLayerType(LAYER_TYPE_HARDWARE, null); onCompleteRunnable = new Runnable() { @Override public void run() { setLayerType(LAYER_TYPE_NONE, null); } }; } else { prepareReveal(); centerAboutIcon(); int width = getPaddingLeft() + getPaddingRight() + mContent.getDesiredWidth(); int height = getFolderHeight(); float transX = - 0.075f * (width / 2 - getPivotX()); float transY = - 0.075f * (height / 2 - getPivotY()); setTranslationX(transX); setTranslationY(transY); PropertyValuesHolder tx = PropertyValuesHolder.ofFloat("translationX", transX, 0); PropertyValuesHolder ty = PropertyValuesHolder.ofFloat("translationY", transY, 0); int rx = (int) Math.max(Math.max(width - getPivotX(), 0), getPivotX()); int ry = (int) Math.max(Math.max(height - getPivotY(), 0), getPivotY()); float radius = (float) Math.sqrt(rx * rx + ry * ry); AnimatorSet anim = LauncherAnimUtils.createAnimatorSet(); Animator reveal = LauncherAnimUtils.createCircularReveal(this, (int) getPivotX(), (int) getPivotY(), 0, radius); reveal.setDuration(mMaterialExpandDuration); reveal.setInterpolator(new LogDecelerateInterpolator(100, 0)); mContent.setAlpha(0f); Animator iconsAlpha = LauncherAnimUtils.ofFloat(mContent, "alpha", 0f, 1f); iconsAlpha.setDuration(mMaterialExpandDuration); iconsAlpha.setStartDelay(mMaterialExpandStagger); iconsAlpha.setInterpolator(new AccelerateInterpolator(1.5f)); mFolderName.setAlpha(0f); Animator textAlpha = LauncherAnimUtils.ofFloat(mFolderName, "alpha", 0f, 1f); textAlpha.setDuration(mMaterialExpandDuration); textAlpha.setStartDelay(mMaterialExpandStagger); textAlpha.setInterpolator(new AccelerateInterpolator(1.5f)); Animator drift = LauncherAnimUtils.ofPropertyValuesHolder(this, tx, ty); drift.setDuration(mMaterialExpandDuration); drift.setStartDelay(mMaterialExpandStagger); drift.setInterpolator(new LogDecelerateInterpolator(60, 0)); anim.play(drift); anim.play(iconsAlpha); anim.play(textAlpha); anim.play(reveal); openFolderAnim = anim; mContent.setLayerType(LAYER_TYPE_HARDWARE, null); onCompleteRunnable = new Runnable() { @Override public void run() { mContent.setLayerType(LAYER_TYPE_NONE, null); } }; } openFolderAnim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { sendCustomAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED, Loading @@ -472,7 +553,10 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList @Override public void onAnimationEnd(Animator animation) { mState = STATE_OPEN; setLayerType(LAYER_TYPE_NONE, null); if (onCompleteRunnable != null) { onCompleteRunnable.run(); } // Only show cling if we are not in the middle of a drag - this would be quite jarring. if (!mDragController.isDragging()) { Loading @@ -486,9 +570,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList setFocusOnFirstChild(); } }); oa.setDuration(mExpandDuration); setLayerType(LAYER_TYPE_HARDWARE, null); oa.start(); openFolderAnim.start(); // Make sure the folder picks up the last drag move even if the finger doesn't move. if (mDragController.isDragging()) { Loading
src/com/android/launcher3/Launcher.java +6 −4 Original line number Diff line number Diff line Loading @@ -2914,7 +2914,10 @@ public class Launcher extends Activity ObjectAnimator oa = LauncherAnimUtils.ofPropertyValuesHolder(mFolderIconImageView, alpha, scaleX, scaleY); oa.setDuration(getResources().getInteger(R.integer.config_folderAnimDuration)); if (Utilities.isLmp()) { oa.setInterpolator(new LogDecelerateInterpolator(100, 0)); } oa.setDuration(getResources().getInteger(R.integer.config_folderExpandDuration)); oa.start(); } Loading @@ -2931,7 +2934,7 @@ public class Launcher extends Activity copyFolderIconToImage(fi); ObjectAnimator oa = LauncherAnimUtils.ofPropertyValuesHolder(mFolderIconImageView, alpha, scaleX, scaleY); oa.setDuration(getResources().getInteger(R.integer.config_folderAnimDuration)); oa.setDuration(getResources().getInteger(R.integer.config_folderExpandDuration)); oa.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { Loading Loading @@ -3288,8 +3291,7 @@ public class Launcher extends Activity int allAppsButtonSize = LauncherAppState.getInstance(). getDynamicGrid().getDeviceProfile().allAppsButtonVisualSize; float startRadius = isWidgetTray ? 0 : allAppsButtonSize / 2; ValueAnimator reveal = (ValueAnimator) LauncherAnimUtils.createCircularReveal(revealView, width / 2, Animator reveal = LauncherAnimUtils.createCircularReveal(revealView, width / 2, height / 2, startRadius, revealRadius); reveal.setDuration(revealDuration); reveal.setInterpolator(new LogDecelerateInterpolator(100, 0)); Loading