private void hide(final View view) { ViewPropertyAnimator animator = view.animate() .translationY(view.getHeight()) .setInterpolator(INTERPOLATOR) .setDuration(200); animator.setListener( new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animator) {} @Override public void onAnimationEnd(Animator animator) { view.setVisibility(View.GONE); } @Override public void onAnimationCancel(Animator animator) { show(view); } @Override public void onAnimationRepeat(Animator animator) {} }); animator.start(); }
@Override public void hideOverlay(final boolean closeShortcutWindow) { ViewPropertyAnimator animator = mOverlay .animate() .setDuration(AppConstant.Anim.ANIM_DURATION_NORMAL) .translationX(mInitialOverlayTranslationX) .setInterpolator(new AccelerateInterpolator()); animator.setListener( new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) {} @Override public void onAnimationEnd(Animator animation) { mGestureOverLay.setVisibility(GONE); EventBus.getDefault().post(new EventToKnob(EventToKnob.END_STATE_RIGHT)); if (closeShortcutWindow) { startCloseAnim(); } } @Override public void onAnimationCancel(Animator animation) {} @Override public void onAnimationRepeat(Animator animation) {} }); animator.start(); }
@Override public void onBackPressed() { for (int i = 0; i < rowContainer.getChildCount(); i++) { View rowView = rowContainer.getChildAt(i); ViewPropertyAnimator propertyAnimator = rowView.animate().setStartDelay(i * SCALE_DELAY).scaleX(0).scaleY(0); propertyAnimator.setListener( new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animator) {} @Override public void onAnimationEnd(Animator animator) { finishAfterTransition(); } @Override public void onAnimationCancel(Animator animator) {} @Override public void onAnimationRepeat(Animator animator) {} }); } }
public FirstFrameAnimatorHelper(ViewPropertyAnimator vpa, View target) { mTarget = target; vpa.setListener(this); }