Search in sources :

Example 61 with AnimationListener

use of android.view.animation.Animation.AnimationListener in project Fairphone by Kwamecorp.

the class EditFavoritesActivity method startViewFadeOutFadeInAnimation.

/**
	 * Performs the animation when replacing one favorite
	 * 
	 * @param viewToFadeIn
	 *            view that will appear. When null it means that we are swapping
	 *            two favorites
	 * @param viewToFadeOut
	 *            view that will disappear.
	 * @param applicationInfo
	 *            app info that is used to swap two favorites
	 */
private void startViewFadeOutFadeInAnimation(final View viewToFadeIn, final View viewToFadeOut, final ApplicationInfo applicationInfo) {
    Animation fadeOutAnimation = AnimationUtils.loadAnimation(this, R.anim.fade_out_fast);
    fadeOutAnimation.setAnimationListener(new AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            viewToFadeOut.setVisibility(View.INVISIBLE);
            if (applicationInfo == null && viewToFadeIn != null) {
                if (viewToFadeIn.getVisibility() != View.VISIBLE) {
                    viewToFadeIn.setVisibility(View.VISIBLE);
                    Animation fadeInAnimation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fade_in_fast);
                    viewToFadeIn.startAnimation(fadeInAnimation);
                }
            } else if (applicationInfo != null) {
                // get the new icon
                updateFavoriteIcon(applicationInfo, (TextView) viewToFadeOut);
                viewToFadeOut.setVisibility(View.VISIBLE);
                Animation fadeInAnimation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fade_in_fast);
                viewToFadeOut.startAnimation(fadeInAnimation);
            }
        }
    });
    if (viewToFadeOut.getVisibility() == View.VISIBLE) {
        viewToFadeOut.startAnimation(fadeOutAnimation);
    }
}
Also used : Animation(android.view.animation.Animation) AnimationListener(android.view.animation.Animation.AnimationListener)

Example 62 with AnimationListener

use of android.view.animation.Animation.AnimationListener in project Fairphone by Kwamecorp.

the class EdgeSwipeAppMenuHelper method setBackgroundExitAnimation.

private void setBackgroundExitAnimation() {
    Animation backAnimation = AnimationUtils.loadAnimation(menuRoot.getContext(), R.anim.menu_background_fade_out);
    backAnimation.setAnimationListener(new AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            backVisible = false;
            menuBackground.setVisibility(View.INVISIBLE);
            menuRoot.setVisibility(View.INVISIBLE);
        }
    });
    menuBackground.startAnimation(backAnimation);
}
Also used : Animation(android.view.animation.Animation) AnimationListener(android.view.animation.Animation.AnimationListener)

Example 63 with AnimationListener

use of android.view.animation.Animation.AnimationListener in project Fairphone by Kwamecorp.

the class OOBEActivity method stopIntroVideo.

private void stopIntroVideo() {
    mVideo.stopPlayback();
    final RelativeLayout rl = (RelativeLayout) findViewById(R.id.oobeVideoViewGroup);
    Animation fadeOutAnimation = AnimationUtils.loadAnimation(OOBEActivity.this, R.anim.fade_out_slow);
    rl.startAnimation(fadeOutAnimation);
    fadeOutAnimation.setAnimationListener(new AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            rl.setVisibility(View.GONE);
            mVideo.setVisibility(View.GONE);
            mSkipVideoButton.setVisibility(View.GONE);
        }
    });
    startTutorialInitialAnimation();
}
Also used : RelativeLayout(android.widget.RelativeLayout) Animation(android.view.animation.Animation) AnimationListener(android.view.animation.Animation.AnimationListener)

Example 64 with AnimationListener

use of android.view.animation.Animation.AnimationListener in project Fairphone by Kwamecorp.

the class PeaceOfMindActivity method stopPeaceOfMindVideo.

private void stopPeaceOfMindVideo() {
    mVideo.removeCallbacks(null);
    if (mVideo.getVisibility() != View.VISIBLE) {
        mVideo.setVisibility(View.VISIBLE);
    }
    Animation fadeOut = AnimationUtils.loadAnimation(this, R.anim.fade_out_fast);
    mVideo.startAnimation(fadeOut);
    updateBackground(false);
    fadeOut.setAnimationListener(new AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            mVideo.setVisibility(View.INVISIBLE);
            mVideo.stopPlayback();
        }
    });
}
Also used : Animation(android.view.animation.Animation) AnimationListener(android.view.animation.Animation.AnimationListener)

Example 65 with AnimationListener

use of android.view.animation.Animation.AnimationListener in project Fairphone by Kwamecorp.

the class PeaceOfMindActivity method peaceOfMindEnded.

@Override
public synchronized void peaceOfMindEnded() {
    try {
        mSemaphore.tryAcquire(1, TimeUnit.SECONDS);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    Animation fadeIn = AnimationUtils.loadAnimation(this, R.anim.fade_in_fast);
    mSeekbarBackgroundOff.startAnimation(fadeIn);
    Animation fadeOut = AnimationUtils.loadAnimation(this, R.anim.fade_out_fast);
    mSeekbarBackgroundOn.startAnimation(fadeOut);
    fadeIn.setAnimationListener(new AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            mSeekbarBackgroundOff.setVisibility(View.VISIBLE);
            mSeekbarBackgroundOn.setVisibility(View.GONE);
            updateScreenTexts();
            stopPeaceOfMindVideo();
            mSemaphore.release();
        }
    });
    updateScreenTexts();
    mVerticalSeekBar.setThumb(getResources().getDrawable(R.drawable.seekbar_thumb_off));
    mVerticalSeekBar.setThumbOffset(0);
    mVerticalSeekBar.setInvertedProgress(0);
    updateTextForNewTime(0, 0);
    updateTimeTextLabel(0);
    mTotalTimeText.setVisibility(View.INVISIBLE);
}
Also used : Animation(android.view.animation.Animation) AnimationListener(android.view.animation.Animation.AnimationListener)

Aggregations

Animation (android.view.animation.Animation)80 AnimationListener (android.view.animation.Animation.AnimationListener)80 AlphaAnimation (android.view.animation.AlphaAnimation)25 TranslateAnimation (android.view.animation.TranslateAnimation)20 View (android.view.View)14 LinearInterpolator (android.view.animation.LinearInterpolator)12 RotateAnimation (android.view.animation.RotateAnimation)10 ScaleAnimation (android.view.animation.ScaleAnimation)10 ImageView (android.widget.ImageView)10 Rect (android.graphics.Rect)7 PopupWindow (android.widget.PopupWindow)6 Window (wei.mark.standout.ui.Window)6 ViewGroup (android.view.ViewGroup)5 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)5 SuppressLint (android.annotation.SuppressLint)4 Interpolator (android.view.animation.Interpolator)4 OvershootInterpolator (android.view.animation.OvershootInterpolator)4 TextView (android.widget.TextView)4 Notification (android.app.Notification)3 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)3