List of usage examples for android.support.v4.view ViewPropertyAnimatorListenerAdapter ViewPropertyAnimatorListenerAdapter
ViewPropertyAnimatorListenerAdapter
From source file:Main.java
public static void fadeView(View view, boolean show, boolean animate) { // Cancel any on-going animation ViewCompat.animate(view).cancel();/*from w ww . ja va2 s .co m*/ if (show) { view.setVisibility(View.VISIBLE); if (animate) { ViewCompat.setAlpha(view, 0f); ViewCompat.animate(view).alpha(1f).start(); } else { ViewCompat.setAlpha(view, 1f); } } else { if (view.getVisibility() == View.VISIBLE) { if (animate) { ViewCompat.animate(view).alpha(0f).setListener(new ViewPropertyAnimatorListenerAdapter() { @Override public void onAnimationEnd(View view) { ViewCompat.animate(view).setListener(null); view.setVisibility(View.INVISIBLE); } }).start(); } else { view.setVisibility(View.INVISIBLE); } } } }
From source file:com.github.rubensousa.stackview.animator.StackSlideAnimator.java
@Override public void animatePop(Object item, View view) { ViewCompat.animate(view)//from ww w.j a v a 2 s.co m .translationX(getMoveDirection() == MOVE_LEFT ? -view.getWidth() * 1.2f : getMoveDirection() == MOVE_RIGHT ? view.getWidth() * 1.2f : 0.0f) .translationY(getMoveDirection() == MOVE_UP ? -view.getHeight() : getMoveDirection() == MOVE_DOWN ? view.getHeight() : 0f) .translationZ(ViewCompat.getTranslationZ(view) * 2.5f).setInterpolator(new AccelerateInterpolator()) .setDuration(getAnimationDuration()).setListener(new ViewPropertyAnimatorListenerAdapter() { @Override public void onAnimationEnd(View view) { super.onAnimationEnd(view); ViewCompat.animate(view).setListener(null); getAnimationListener().onExitFinished(view); } }); }
From source file:com.github.rubensousa.stackview.animator.StackSlideFadeAnimator.java
@Override public void animatePop(Object item, final View view) { ViewCompat.animate(view).alpha(0.0f) .translationX(getMoveDirection() == MOVE_LEFT ? -view.getWidth() * 1.2f : getMoveDirection() == MOVE_RIGHT ? view.getWidth() * 1.2f : 0.0f) .translationY(getMoveDirection() == MOVE_UP ? -view.getHeight() : getMoveDirection() == MOVE_DOWN ? view.getHeight() : 0f) .translationZ(ViewCompat.getTranslationZ(view) * 2.5f).setInterpolator(new AccelerateInterpolator()) .setDuration(getAnimationDuration()).setListener(new ViewPropertyAnimatorListenerAdapter() { @Override//from w w w.j ava 2 s. c om public void onAnimationEnd(View view) { super.onAnimationEnd(view); ViewCompat.animate(view).setListener(null); getAnimationListener().onExitFinished(view); } }); }
From source file:com.github.rubensousa.stackview.animator.StackSlideShrinkAnimator.java
@Override public void animatePop(Object item, View view) { ViewCompat.animate(view).scaleY(0f).scaleX(0f) .translationY(getMoveDirection() == MOVE_UP ? -view.getHeight() : getMoveDirection() == MOVE_DOWN ? view.getHeight() : 0f) .translationX(getMoveDirection() == MOVE_LEFT ? -view.getWidth() * 1.2f : getMoveDirection() == MOVE_RIGHT ? view.getWidth() * 1.2f : 0.0f) .translationZ(ViewCompat.getTranslationZ(view) * 2.5f).setInterpolator(new AccelerateInterpolator()) .setDuration(getAnimationDuration()).setListener(new ViewPropertyAnimatorListenerAdapter() { @Override/* w ww. jav a 2 s. c o m*/ public void onAnimationEnd(View view) { super.onAnimationEnd(view); ViewCompat.animate(view).setListener(null); getAnimationListener().onExitFinished(view); } }); }
From source file:com.github.rubensousa.stackview.animator.StackFlipAnimator.java
@Override public void animatePop(Object item, View view) { if (getMoveDirection() == MOVE_LEFT || getMoveDirection() == MOVE_RIGHT) { ViewCompat.animate(view).scaleX(0.3f).setDuration(getAnimationDuration() / 10); ViewCompat.animate(view)/* w w w . j a v a 2s . c om*/ .translationX(getMoveDirection() == MOVE_LEFT ? -view.getWidth() : view.getWidth()) .translationZ(ViewCompat.getTranslationZ(view) * 2.5f) .rotationY(getMoveDirection() == MOVE_LEFT ? 180 : -180).setDuration(getAnimationDuration()) .setInterpolator(new AccelerateInterpolator()) .setListener(new ViewPropertyAnimatorListenerAdapter() { @Override public void onAnimationEnd(View view) { super.onAnimationEnd(view); ViewCompat.animate(view).setListener(null); getAnimationListener().onExitFinished(view); } }); } else { ViewCompat.animate(view).scaleX(0.3f).scaleY(0f).setDuration(getAnimationDuration() / 10); ViewCompat.animate(view) .translationY(getMoveDirection() == MOVE_UP ? -view.getHeight() : view.getHeight()) .translationZ(ViewCompat.getTranslationZ(view) * 2.5f) .rotationX(getMoveDirection() == MOVE_UP ? 180 : -180).setDuration(getAnimationDuration()) .setInterpolator(new AccelerateInterpolator()) .setListener(new ViewPropertyAnimatorListenerAdapter() { @Override public void onAnimationEnd(View view) { super.onAnimationEnd(view); ViewCompat.animate(view).setListener(null); getAnimationListener().onExitFinished(view); } }); } }
From source file:com.github.rubensousa.stackview.animator.StackFlipSlideAnimator.java
@Override public void animatePop(Object item, View view) { ViewCompat.animate(view).scaleX(0.3f).scaleY(0.3f).setDuration(getAnimationDuration() / 10); if (getMoveDirection() == MOVE_LEFT || getMoveDirection() == MOVE_RIGHT) { ViewCompat.animate(view)//w ww .j a v a 2 s .co m .translationX(getMoveDirection() == MOVE_LEFT ? -view.getWidth() : view.getWidth()) .translationZ(ViewCompat.getTranslationZ(view) * 2.5f) .rotationY(getMoveDirection() == MOVE_LEFT ? 250 : -250).setDuration(getAnimationDuration()) .setInterpolator(new AccelerateInterpolator()) .setListener(new ViewPropertyAnimatorListenerAdapter() { @Override public void onAnimationEnd(View view) { super.onAnimationEnd(view); ViewCompat.animate(view).setListener(null); getAnimationListener().onExitFinished(view); } }); } else { ViewCompat.animate(view) .translationY(getMoveDirection() == MOVE_UP ? -view.getHeight() : view.getHeight()) .translationZ(ViewCompat.getTranslationZ(view) * 2.5f) .rotationX(getMoveDirection() == MOVE_UP ? 250 : -250).setDuration(getAnimationDuration()) .setInterpolator(new AccelerateInterpolator()) .setListener(new ViewPropertyAnimatorListenerAdapter() { @Override public void onAnimationEnd(View view) { super.onAnimationEnd(view); ViewCompat.animate(view).setListener(null); getAnimationListener().onExitFinished(view); } }); } }
From source file:com.github.rubensousa.stackview.animator.StackDefaultAnimator.java
@Override public void animateChange(View view, final int stackPosition) { ViewCompat.animate(view)/* w w w. java 2 s .c o m*/ .scaleX(1 - stackPosition * getStackView().getScaleXFactor() < StackView.SCALE_X_MIN ? StackView.SCALE_X_MIN : 1 - stackPosition * getStackView().getScaleXFactor()) .translationX(stackPosition * getStackView().getHorizontalSpacing()) .translationZ((getStackView().getSize() - 1 - stackPosition) * getStackView().getElevationSpacing()) .setStartDelay(stackPosition * 50).setInterpolator(new AccelerateInterpolator()) .setDuration(getAnimationDuration()).setListener(new ViewPropertyAnimatorListenerAdapter() { @Override public void onAnimationEnd(View view) { super.onAnimationEnd(view); ViewCompat.animate(view).setListener(null); getAnimationListener().onChangeFinished(view, stackPosition); } }); ViewCompat.animate(view).translationY(stackPosition * getStackView().getVerticalSpacing()) .setInterpolator(new OvershootInterpolator(3f)).setDuration(getAnimationDuration()); }
From source file:com.freshdigitable.udonroad.TimelineAnimator.java
private void animateRemoveImpl(final ViewHolder holder) { // Log.d(TAG, "animateRemoveImpl: "); removeAnimations.add(holder);//from w ww.j ava2 s .c o m ViewCompat.animate(holder.itemView).translationYBy(-holder.itemView.getHeight()).alpha(0) .setDuration(getRemoveDuration()).setListener(new ViewPropertyAnimatorListenerAdapter() { @Override public void onAnimationStart(View view) { dispatchRemoveStarting(holder); } @Override public void onAnimationEnd(View view) { clearAllAnimationSettings(view); dispatchRemoveFinished(holder); removeAnimations.remove(holder); dispatchFinishedWhenDone(); } @Override public void onAnimationCancel(View view) { clearAllAnimationSettings(view); } }).start(); }
From source file:org.huxizhijian.hhcomicviewer.view.behavior.ScrollAwareFABBehavior.java
private void animateOut(FloatingActionButton child) { ////from www . j av a2s.c o m //?? ViewCompat.animate(child).translationX(child.getHeight()).setInterpolator(folistener) .setListener(new ViewPropertyAnimatorListenerAdapter() { @Override public void onAnimationStart(View view) { isAnimatingOut = true; super.onAnimationStart(view); } @Override public void onAnimationCancel(View view) { isAnimatingOut = false; super.onAnimationCancel(view); } @Override public void onAnimationEnd(View view) { view.setVisibility(View.GONE); isAnimatingOut = false; super.onAnimationEnd(view); } }).start(); }
From source file:com.github.rubensousa.stackview.animator.StackDefaultAnimator.java
@Override public void animatePop(Object item, View view) { ViewCompat.animate(view).translationX(-view.getWidth() * 1.4f).translationY(view.getHeight() * 0.1f) .translationZ(ViewCompat.getTranslationZ(view) * 2.5f).setDuration(getAnimationDuration()) .rotation(-25).setInterpolator(new AccelerateInterpolator()) .setListener(new ViewPropertyAnimatorListenerAdapter() { @Override//from ww w.ja v a 2 s .c o m public void onAnimationEnd(View view) { super.onAnimationEnd(view); ViewCompat.animate(view).setListener(null); getAnimationListener().onExitFinished(view); } }); }