List of usage examples for android.animation PropertyValuesHolder ofFloat
public static PropertyValuesHolder ofFloat(Property<?, Float> property, float... values)
From source file:la.marsave.fullscreentest.MainActivity.java
/** * This method animates the image fragment into the foreground by both * scaling and rotating the fragment's view, while also removing the * previously added translucent dark hover view. Upon the completion of * this animation, the image fragment regains focus since this method is * called from the onBackStackChanged method. */// w ww . j a v a 2 s. c o m public void slideForward() { View movingFragmentView = mInfiniteViewPager; PropertyValuesHolder rotateX = PropertyValuesHolder.ofFloat("rotationX", 40f); PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 1.0f); PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 1.0f); ObjectAnimator movingFragmentAnimator = ObjectAnimator.ofPropertyValuesHolder(movingFragmentView, rotateX, scaleX, scaleY); ObjectAnimator darkHoverViewAnimator = ObjectAnimator.ofFloat(mDarkHoverView, "alpha", 0.5f, 0.0f); ObjectAnimator movingFragmentRotator = ObjectAnimator.ofFloat(movingFragmentView, "rotationX", 0); movingFragmentRotator.setStartDelay(getResources().getInteger(R.integer.half_slide_up_down_duration)); AnimatorSet s = new AnimatorSet(); s.playTogether(movingFragmentAnimator, movingFragmentRotator, darkHoverViewAnimator); s.setStartDelay(getResources().getInteger(R.integer.slide_up_down_duration)); s.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mIsAnimating = false; } }); s.start(); }
From source file:com.grepsound.activities.MainActivity.java
/** * This method animates the image fragment into the background by both * scaling and rotating the fragment's view, as well as adding a * translucent dark hover view to inform the user that it is inactive. */// w w w . j av a2 s . c o m public void slideBack(Animator.AnimatorListener listener) { // Make sure Toolbar is visible mToolbar.setTranslationY(0); View movingFragmentView = mMainFrag.getView(); PropertyValuesHolder rotateX = PropertyValuesHolder.ofFloat("rotationX", 40f); PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 0.8f); PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 0.8f); ObjectAnimator movingFragmentAnimator = ObjectAnimator.ofPropertyValuesHolder(movingFragmentView, rotateX, scaleX, scaleY); ObjectAnimator darkHoverViewAnimator = ObjectAnimator.ofFloat(mDarkHoverView, "alpha", 0.0f, 0.5f); ObjectAnimator movingFragmentRotator = ObjectAnimator.ofFloat(movingFragmentView, "rotationX", 0); movingFragmentRotator.setStartDelay(getResources().getInteger(R.integer.half_slide_up_down_duration)); AnimatorSet s = new AnimatorSet(); s.playTogether(movingFragmentAnimator, darkHoverViewAnimator, movingFragmentRotator); s.addListener(listener); s.start(); }
From source file:com.sinyuk.jianyimaterial.widgets.FloatingToolbar.java
private void showDefaultImpl() { int rootWidth = mRoot.getWidth(); setScaleX(0f);//ww w .j a v a 2s .c om float endFabX; if (mFabOriginalX > rootWidth / 2f) { endFabX = rootWidth / 2f + (mFabOriginalX - rootWidth / 2f) / 4f; } else { endFabX = rootWidth / 2f - (mFabOriginalX - rootWidth / 2f) / 4f; } if (mFab != null) { PropertyValuesHolder xProperty = PropertyValuesHolder.ofFloat(X, endFabX); PropertyValuesHolder yProperty = PropertyValuesHolder.ofFloat(Y, mFabOriginalY * 1.05f); PropertyValuesHolder scaleXProperty = PropertyValuesHolder.ofFloat(SCALE_X, 0); PropertyValuesHolder scaleYProperty = PropertyValuesHolder.ofFloat(SCALE_Y, 0); ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(mFab, xProperty, yProperty, scaleXProperty, scaleYProperty); animator.setDuration(FAB_MORPH_DURATION); animator.setInterpolator(new AccelerateInterpolator()); animator.start(); } ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(this, "scaleX", 1f); objectAnimator.setDuration(CIRCULAR_REVEAL_DURATION); objectAnimator.setStartDelay(CIRCULAR_REVEAL_DELAY); objectAnimator.setInterpolator(new AccelerateDecelerateInterpolator()); objectAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { super.onAnimationStart(animation); setVisibility(View.VISIBLE); mFab.setVisibility(View.INVISIBLE); } @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); mMorphing = false; } }); objectAnimator.start(); }
From source file:com.grepsound.activities.MainActivity.java
/** * This method animates the image fragment into the foreground by both * scaling and rotating the fragment's view, while also removing the * previously added translucent dark hover view. Upon the completion of * this animation, the image fragment regains focus since this method is * called from the onBackStackChanged method. *//* ww w .j a v a 2s . com*/ public void slideForward(Animator.AnimatorListener listener) { View movingFragmentView = mMainFrag.getView(); PropertyValuesHolder rotateX = PropertyValuesHolder.ofFloat("rotationX", 40f); PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 1.0f); PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 1.0f); ObjectAnimator movingFragmentAnimator = ObjectAnimator.ofPropertyValuesHolder(movingFragmentView, rotateX, scaleX, scaleY); ObjectAnimator darkHoverViewAnimator = ObjectAnimator.ofFloat(mDarkHoverView, "alpha", 0.5f, 0.0f); ObjectAnimator movingFragmentRotator = ObjectAnimator.ofFloat(movingFragmentView, "rotationX", 0); movingFragmentRotator.setStartDelay(getResources().getInteger(R.integer.half_slide_up_down_duration)); AnimatorSet s = new AnimatorSet(); s.playTogether(movingFragmentAnimator, movingFragmentRotator, darkHoverViewAnimator); s.setStartDelay(getResources().getInteger(R.integer.slide_up_down_duration)); s.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mIsAnimating = false; } }); s.start(); }
From source file:cc.flydev.launcher.Folder.java
public void animateOpen() { positionAndSizeAsIcon();/* w w w.ja v a 2 s .c o m*/ if (!(getParent() instanceof DragLayer)) return; 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.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { sendCustomAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED, String.format(getContext().getString(R.string.folder_opened), mContent.getCountX(), mContent.getCountY())); mState = STATE_ANIMATING; } @Override public void onAnimationEnd(Animator animation) { mState = STATE_OPEN; setLayerType(LAYER_TYPE_NONE, null); Cling cling = mLauncher.showFirstRunFoldersCling(); if (cling != null) { cling.bringScrimToFront(); bringToFront(); cling.bringToFront(); } setFocusOnFirstChild(); } }); oa.setDuration(mExpandDuration); setLayerType(LAYER_TYPE_HARDWARE, null); oa.start(); }
From source file:com.example.launcher3.Folder.java
public void animateOpen() { positionAndSizeAsIcon();/* w ww. j a va 2 s . c om*/ if (!(getParent() instanceof DragLayer)) return; 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.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { sendCustomAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED, String.format(getContext().getString(R.string.folder_opened), mContent.getCountX(), mContent.getCountY())); mState = STATE_ANIMATING; } @Override public void onAnimationEnd(Animator animation) { mState = STATE_OPEN; setLayerType(LAYER_TYPE_NONE, null); /* * Cling cling = mLauncher.showFirstRunFoldersCling(); if (cling * != null) { cling.bringScrimToFront(); bringToFront(); * cling.bringToFront(); } */ setFocusOnFirstChild(); } }); oa.setDuration(mExpandDuration); setLayerType(LAYER_TYPE_HARDWARE, null); oa.start(); }
From source file:com.auratech.launcher.Folder.java
public void animateOpen() { positionAndSizeAsIcon();// w w w .j a v a2 s . c o m if (!(getParent() instanceof DragLayer)) return; 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.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { sendCustomAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED, String.format(getContext().getString(R.string.folder_opened), mContent.getCountX(), mContent.getCountY())); mState = STATE_ANIMATING; } @Override public void onAnimationEnd(Animator animation) { mState = STATE_OPEN; setLayerType(LAYER_TYPE_NONE, null); // Only show cling if we are not in the middle of a drag - this would be quite jarring. if (!mDragController.isDragging()) { Cling cling = mLauncher.getLauncherClings().showFoldersCling(); if (cling != null) { cling.bringScrimToFront(); bringToFront(); cling.bringToFront(); } } setFocusOnFirstChild(); } }); oa.setDuration(mExpandDuration); setLayerType(LAYER_TYPE_HARDWARE, null); oa.start(); // Make sure the folder picks up the last drag move even if the finger doesn't move. if (mDragController.isDragging()) { mDragController.forceTouchMove(); } }
From source file:cc.flydev.launcher.Folder.java
public void animateClosed() { if (!(getParent() instanceof DragLayer)) return;/*from w w w. j av a2 s . c om*/ PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 0); PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 0.9f); PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 0.9f); final ObjectAnimator oa = LauncherAnimUtils.ofPropertyValuesHolder(this, alpha, scaleX, scaleY); oa.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { onCloseComplete(); setLayerType(LAYER_TYPE_NONE, null); mState = STATE_SMALL; } @Override public void onAnimationStart(Animator animation) { sendCustomAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED, getContext().getString(R.string.folder_closed)); mState = STATE_ANIMATING; } }); oa.setDuration(mExpandDuration); setLayerType(LAYER_TYPE_HARDWARE, null); oa.start(); }
From source file:com.android.launcher3.Folder.java
public void animateOpen() { if (!(getParent() instanceof DragLayer)) return;/*from w w w.j a v a2 s . c o m*/ Animator openFolderAnim = null; final Runnable onCompleteRunnable; if (!Utilities.isLmpOrAbove()) { 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; 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, String.format(getContext().getString(R.string.folder_opened), mContent.getCountX(), mContent.getCountY())); mState = STATE_ANIMATING; } @Override public void onAnimationEnd(Animator animation) { mState = STATE_OPEN; if (onCompleteRunnable != null) { onCompleteRunnable.run(); } setFocusOnFirstChild(); } }); openFolderAnim.start(); // Make sure the folder picks up the last drag move even if the finger doesn't move. if (mDragController.isDragging()) { mDragController.forceTouchMove(); } }
From source file:com.fairphone.fplauncher3.Folder.java
public void animateOpen() { if (!(getParent() instanceof DragLayer)) { return;/*ww w . j a v a 2s . c o m*/ } Animator openFolderAnim; final Runnable onCompleteRunnable; if (!Utilities.isLmpOrAbove()) { positionAndSizeAsIcon(); centerAboutIcon(); PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 1f); 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; 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()); final float endTransX = 0; final float endTransY = 0; setTranslationX(transX); setTranslationY(transY); PropertyValuesHolder tx = PropertyValuesHolder.ofFloat("translationX", transX, endTransX); PropertyValuesHolder ty = PropertyValuesHolder.ofFloat("translationY", transY, endTransY); 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)); View[] alphaViewSet = new View[] { mContent, mFolderName }; for (View view : alphaViewSet) { Animator alphaAnimator = setupAlphaAnimator(view, 0f, 1f, mMaterialExpandDuration, mMaterialExpandStagger); anim.play(alphaAnimator); } /* 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)); drift.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { // in low power mode the animation doesn't play, so set the end value here Folder.this.setTranslationX(endTransX); Folder.this.setTranslationY(endTransY); } }); 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, String.format(getContext().getString(R.string.folder_opened), mContent.getCountX(), mContent.getCountY())); mState = STATE_ANIMATING; } @Override public void onAnimationEnd(Animator animation) { mState = STATE_OPEN; if (onCompleteRunnable != null) { onCompleteRunnable.run(); } setFocusOnFirstChild(); } }); openFolderAnim.start(); // Make sure the folder picks up the last drag move even if the finger doesn't move. if (mDragController.isDragging()) { mDragController.forceTouchMove(); } }