List of usage examples for android.view.animation Animation setAnimationListener
public void setAnimationListener(AnimationListener listener)
Binds an animation listener to this animation.
From source file:com.sim2dial.dialer.InCallActivity.java
public void resetControlsHidingCallBack() { if (mControlsHandler != null && mControls != null) { mControlsHandler.removeCallbacks(mControls); }/*from w w w . j a v a 2 s. c om*/ mControls = null; if (isVideoEnabled && mControlsHandler != null) { mControlsHandler.postDelayed(mControls = new Runnable() { public void run() { hideNumpad(); if (isAnimationDisabled) { // transfer.setVisibility(View.INVISIBLE); // addCall.setVisibility(View.INVISIBLE); mControlsLayout.setVisibility(View.GONE); callsList.setVisibility(View.GONE); switchCamera.setVisibility(View.INVISIBLE); numpad.setVisibility(View.GONE); // options.setBackgroundResource(R.drawable.options); } else { Animation animation = slideOutTopToBottom; animation.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { // video.setEnabled(false); // HACK: Used to // avoid controls from being hided if video is // switched while controls are hiding } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { // video.setEnabled(true); // HACK: Used to // avoid controls from being hided if video is // switched while controls are hiding // transfer.setVisibility(View.INVISIBLE); // addCall.setVisibility(View.INVISIBLE); mControlsLayout.setVisibility(View.GONE); callsList.setVisibility(View.GONE); switchCamera.setVisibility(View.INVISIBLE); numpad.setVisibility(View.GONE); // options.setBackgroundResource(R.drawable.options); animation.setAnimationListener(null); } }); mControlsLayout.startAnimation(animation); if (cameraNumber > 1) { switchCamera.startAnimation(slideOutBottomToTop); } } } }, SECONDS_BEFORE_HIDING_CONTROLS); } }
From source file:com.oginotihiro.snackbar.Snackbar.java
private void animateViewOut(final int event) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { ViewPropertyAnimatorCompat vpac = ViewCompat.animate(mView); if (mDirection == LEFT_RIGHT) { vpac.translationX(-mView.getWidth()); } else if (mDirection == TOP_BOTTOM) { vpac.translationY(-mView.getHeight()); } else if (mDirection == RIGHT_LEFT) { vpac.translationX(mView.getWidth()); } else if (mDirection == BOTTOM_TOP) { vpac.translationY(mView.getHeight()); }//from w w w . ja va2 s. co m vpac.setInterpolator(new FastOutSlowInInterpolator()).setDuration(mAnimDuration) .setListener(new ViewPropertyAnimatorListenerAdapter() { @Override public void onAnimationStart(View view) { mView.animateChildrenOut(0, mAnimFadeDuration); } @Override public void onAnimationEnd(View view) { onViewHidden(event); } }).start(); } else { Animation anim = null; if (mDirection == LEFT_RIGHT) { anim = AnimationUtils.loadAnimation(mView.getContext(), R.anim.oginotihiro_snackbar_left_out); } else if (mDirection == TOP_BOTTOM) { anim = AnimationUtils.loadAnimation(mView.getContext(), R.anim.oginotihiro_snackbar_top_out); } else if (mDirection == RIGHT_LEFT) { anim = AnimationUtils.loadAnimation(mView.getContext(), R.anim.oginotihiro_snackbar_right_out); } else if (mDirection == BOTTOM_TOP) { anim = AnimationUtils.loadAnimation(mView.getContext(), R.anim.oginotihiro_snackbar_bottom_out); } if (anim == null) return; anim.setInterpolator(new FastOutSlowInInterpolator()); anim.setDuration(ANIMATION_DURATION); anim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { onViewHidden(event); } @Override public void onAnimationRepeat(Animation animation) { } }); mView.startAnimation(anim); } }
From source file:com.oginotihiro.snackbar.Snackbar.java
private void animateViewIn() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { ViewPropertyAnimatorCompat vpac = ViewCompat.animate(mView); if (mDirection == LEFT_RIGHT) { ViewCompat.setTranslationX(mView, -mView.getWidth()); vpac.translationX(0f);//from w w w .j a v a 2s . c o m } else if (mDirection == TOP_BOTTOM) { ViewCompat.setTranslationY(mView, -mView.getHeight()); vpac.translationY(0f); } else if (mDirection == RIGHT_LEFT) { ViewCompat.setTranslationX(mView, mView.getWidth()); vpac.translationX(0f); } else if (mDirection == BOTTOM_TOP) { ViewCompat.setTranslationY(mView, mView.getHeight()); vpac.translationY(0f); } vpac.setInterpolator(new FastOutSlowInInterpolator()).setDuration(mAnimDuration) .setListener(new ViewPropertyAnimatorListenerAdapter() { @Override public void onAnimationStart(View view) { mView.animateChildrenIn(mAnimDuration - mAnimFadeDuration, mAnimFadeDuration); } @Override public void onAnimationEnd(View view) { if (mCallback != null) { mCallback.onShow(Snackbar.this); } SnackbarManager.getInstance().onShown(mManagerCallback); } }).start(); } else { Animation anim = null; if (mDirection == LEFT_RIGHT) { anim = AnimationUtils.loadAnimation(mView.getContext(), R.anim.oginotihiro_snackbar_left_in); } else if (mDirection == TOP_BOTTOM) { anim = AnimationUtils.loadAnimation(mView.getContext(), R.anim.oginotihiro_snackbar_top_in); } else if (mDirection == RIGHT_LEFT) { anim = AnimationUtils.loadAnimation(mView.getContext(), R.anim.oginotihiro_snackbar_right_in); } else if (mDirection == BOTTOM_TOP) { anim = AnimationUtils.loadAnimation(mView.getContext(), R.anim.oginotihiro_snackbar_bottom_in); } if (anim == null) return; anim.setInterpolator(new FastOutSlowInInterpolator()); anim.setDuration(mAnimDuration); anim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { if (mCallback != null) { mCallback.onShow(Snackbar.this); } SnackbarManager.getInstance().onShown(mManagerCallback); } @Override public void onAnimationRepeat(Animation animation) { } }); mView.setAnimation(anim); } }
From source file:org.linphone.InCallActivity.java
private void hideNumpad() { if (numpad == null || numpad.getVisibility() != View.VISIBLE) { return;//from ww w . ja va 2 s .co m } dialer.setBackgroundResource(R.drawable.dialer_alt); if (isAnimationDisabled) { numpad.setVisibility(View.GONE); } else { Animation animation = slideOutTopToBottom; animation.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { numpad.setVisibility(View.GONE); animation.setAnimationListener(null); } }); numpad.startAnimation(animation); } }
From source file:org.linphone.InCallActivity.java
private void showAnimatedLandscapeCallOptions() { Animation animation = slideInBottomToTop; animation.setAnimationListener(new AnimationListener() { @Override//from w ww. j ava 2s. c om public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { addCall.setAnimation(null); options.setBackgroundResource(R.drawable.options_alt); addCall.setVisibility(View.VISIBLE); if (isTransferAllowed) { animation.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { transfer.setVisibility(View.VISIBLE); } }); transfer.startAnimation(animation); } } }); addCall.startAnimation(animation); }
From source file:org.xingjitong.InCallActivity.java
private void hideOrDisplayNumpad() { if (numpad == null) { return;//from w w w .ja v a 2 s .c o m } if (numpad.getVisibility() == View.VISIBLE) { hideNumpad(); } else { dialer.setImageResource(R.drawable.dialer_alt_back); if (isAnimationDisabled) { numpad.setVisibility(View.VISIBLE); } else { Animation animation = slideInBottomToTop; animation.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { numpad.setVisibility(View.VISIBLE); animation.setAnimationListener(null); } }); numpad.startAnimation(animation); } } }
From source file:org.linphone.InCallActivity.java
private void hideOrDisplayNumpad() { if (numpad == null) { return;//from w w w .j a va 2 s . c o m } if (numpad.getVisibility() == View.VISIBLE) { hideNumpad(); } else { dialer.setBackgroundResource(R.drawable.dialer_alt_back); if (isAnimationDisabled) { numpad.setVisibility(View.VISIBLE); } else { Animation animation = slideInBottomToTop; animation.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { numpad.setVisibility(View.VISIBLE); animation.setAnimationListener(null); } }); numpad.startAnimation(animation); } } }
From source file:com.github.shareme.gwsmaterialuikit.library.material.app.ToolbarManager.java
private void animateOut() { ActionMenuView menuView = getMenuView(); int count = menuView == null ? 0 : menuView.getChildCount(); Animation slowestAnimation = null; mAnimations.clear();//from www . ja v a2 s. c o m mAnimations.ensureCapacity(count); for (int i = 0; i < count; i++) { View child = menuView.getChildAt(i); Animation anim = mAnimator.getOutAnimation(child, i); mAnimations.add(anim); if (anim != null) if (slowestAnimation == null || slowestAnimation.getStartOffset() + slowestAnimation.getDuration() < anim.getStartOffset() + anim.getDuration()) slowestAnimation = anim; } if (slowestAnimation == null) mOutAnimationEndListener.onAnimationEnd(null); else { slowestAnimation.setAnimationListener(mOutAnimationEndListener); for (int i = 0; i < count; i++) { Animation anim = mAnimations.get(i); if (anim != null) menuView.getChildAt(i).startAnimation(anim); } } mAnimations.clear(); }
From source file:com.sim2dial.dialer.InCallActivity.java
private void hideAnimatedLandscapeCallOptions() { Animation animation = slideOutTopToBottom; if (isTransferAllowed) { animation.setAnimationListener(new AnimationListener() { @Override//w w w .j a v a 2 s . c o m public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { transfer.setAnimation(null); transfer.setVisibility(View.INVISIBLE); animation = AnimationUtils.loadAnimation(InCallActivity.this, R.anim.slide_out_top_to_bottom); // Reload // animation // to // prevent // transfer // button // to // blink animation.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { // addCall.setVisibility(View.INVISIBLE); } }); addCall.startAnimation(animation); } }); transfer.startAnimation(animation); } else { animation.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { // addCall.setVisibility(View.INVISIBLE); } }); addCall.startAnimation(animation); } }
From source file:com.appolica.interactiveinfowindow.InfoWindowManager.java
private void internalHide(@NonNull final View container, @NonNull final InfoWindow toHideWindow, final boolean animated) { if (animated) { final Animation animation; if (hideAnimation == null) { final int containerWidth = container.getWidth(); final int containerHeight = container.getHeight(); final float pivotX = container.getX() + containerWidth / 2; final float pivotY = container.getY() + containerHeight; animation = new ScaleAnimation(1f, 0f, 1f, 0f, pivotX, pivotY); animation.setDuration(DURATION_WINDOW_ANIMATION); animation.setInterpolator(new DecelerateInterpolator()); } else {//from w w w. ja v a 2s. c o m animation = hideAnimation; } animation.setAnimationListener(new SimpleAnimationListener() { @Override public void onAnimationStart(Animation animation) { toHideWindow.setWindowState(InfoWindow.State.HIDING); propagateShowEvent(toHideWindow, InfoWindow.State.HIDING); } @Override public void onAnimationEnd(Animation animation) { removeWindow(toHideWindow, container); if (container.getId() != InfoWindowManager.this.currentContainer.getId()) { parent.removeView(container); } toHideWindow.setWindowState(InfoWindow.State.HIDDEN); propagateShowEvent(toHideWindow, InfoWindow.State.HIDDEN); } }); this.currentContainer.startAnimation(animation); } else { removeWindow(toHideWindow, container); propagateShowEvent(toHideWindow, InfoWindow.State.HIDDEN); } }