Search in sources :

Example 31 with Animation

use of android.view.animation.Animation in project androidquery by androidquery.

the class AbstractAQuery method animate.

/**
	 * Starts an animation on the view.
	 * 
	 * <br>
	 * contributed by: marcosbeirigo
	 * 
	 * @param animId Id of the desired animation.
	 * @param listener The listener to recieve notifications from the animation on its events.
	 * @return self
	 * 
	 * 
	 */
public T animate(int animId, AnimationListener listener) {
    Animation anim = AnimationUtils.loadAnimation(getContext(), animId);
    anim.setAnimationListener(listener);
    return animate(anim);
}
Also used : Animation(android.view.animation.Animation)

Example 32 with Animation

use of android.view.animation.Animation in project platform_frameworks_base by android.

the class PhoneWindowManager method createForceHideEnterAnimation.

@Override
public Animation createForceHideEnterAnimation(boolean onWallpaper, boolean goingToNotificationShade) {
    if (goingToNotificationShade) {
        return AnimationUtils.loadAnimation(mContext, R.anim.lock_screen_behind_enter_fade_in);
    }
    AnimationSet set = (AnimationSet) AnimationUtils.loadAnimation(mContext, onWallpaper ? R.anim.lock_screen_behind_enter_wallpaper : R.anim.lock_screen_behind_enter);
    // TODO: Use XML interpolators when we have log interpolators available in XML.
    final List<Animation> animations = set.getAnimations();
    for (int i = animations.size() - 1; i >= 0; --i) {
        animations.get(i).setInterpolator(mLogDecelerateInterpolator);
    }
    return set;
}
Also used : Animation(android.view.animation.Animation) AnimationSet(android.view.animation.AnimationSet)

Example 33 with Animation

use of android.view.animation.Animation in project platform_frameworks_base by android.

the class MarqueeActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final LinearLayout linearLayout = new LinearLayout(this);
    linearLayout.setOrientation(LinearLayout.VERTICAL);
    final TextView text1 = new TextView(this);
    text1.setText("This is a marquee inside a TextView");
    text1.setSingleLine(true);
    text1.setHorizontalFadingEdgeEnabled(true);
    text1.setEllipsize(TextUtils.TruncateAt.MARQUEE);
    linearLayout.addView(text1, new LinearLayout.LayoutParams(100, LinearLayout.LayoutParams.WRAP_CONTENT));
    final TextView text2 = new TextView(this);
    text2.setText("This is a marquee inside a TextView");
    text2.setSingleLine(true);
    text2.setHorizontalFadingEdgeEnabled(true);
    text2.setEllipsize(TextUtils.TruncateAt.MARQUEE);
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(100, LinearLayout.LayoutParams.WRAP_CONTENT);
    linearLayout.addView(text2, params);
    setContentView(linearLayout);
    getWindow().getDecorView().postDelayed(new Runnable() {

        @Override
        public void run() {
            text2.setVisibility(View.INVISIBLE);
            Animation animation = AnimationUtils.loadAnimation(text2.getContext(), R.anim.slide_off_left);
            animation.setFillEnabled(true);
            animation.setFillAfter(true);
            text2.startAnimation(animation);
        }
    }, 1000);
}
Also used : Animation(android.view.animation.Animation) TextView(android.widget.TextView) LinearLayout(android.widget.LinearLayout)

Example 34 with Animation

use of android.view.animation.Animation in project ListenerMusicPlayer by hefuyicoder.

the class PanelSlideListener method animateToFullscreen.

private void animateToFullscreen() {
    //album art fullscreen
    albumImageDrawable = albumImage.getDrawable();
    setBlurredAlbumArt();
    //animate title and artist
    Animation contentAnimation = new Animation() {

        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            content.setTranslationY(contentNormalEndTranslationY - (contentNormalEndTranslationY - contentFullEndTranslationY) * interpolatedTime);
            artist.setTranslationY(artistNormalEndTranslationY - (artistNormalEndTranslationY - artistFullEndTranslationY) * interpolatedTime);
        }
    };
    contentAnimation.setDuration(150);
    artist.startAnimation(contentAnimation);
    //animate lyric
    Animation lyricAnimation = new Animation() {

        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            CoordinatorLayout.LayoutParams lyricLayout = (CoordinatorLayout.LayoutParams) lyricView.getLayoutParams();
            lyricLayout.height = (int) (lyricLineHeight + (lyricFullHeight - lyricLineHeight) * interpolatedTime);
            lyricView.setLayoutParams(lyricLayout);
            lyricView.setTranslationY(lyricLineEndTranslationY - (lyricLineEndTranslationY - lyricFullTranslationY) * interpolatedTime);
        }
    };
    lyricAnimation.setAnimationListener(new Animation.AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            lyricView.setHighLightTextColor(ATEUtil.getThemeAccentColor(mContext));
            lyricView.setPlayable(true);
            lyricView.setTouchable(true);
            lyricView.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    animateToNormal();
                }
            });
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }
    });
    lyricAnimation.setDuration(150);
    lyricView.startAnimation(lyricAnimation);
    mStatus = Status.FULLSCREEN;
}
Also used : CoordinatorLayout(android.support.design.widget.CoordinatorLayout) Transformation(android.view.animation.Transformation) Animation(android.view.animation.Animation) ForegroundImageView(io.hefuyi.listener.widget.ForegroundImageView) View(android.view.View) LyricView(io.hefuyi.listener.widget.LyricView) TextView(android.widget.TextView) MaterialIconView(net.steamcrafted.materialiconlib.MaterialIconView) PlayPauseView(io.hefuyi.listener.widget.PlayPauseView)

Example 35 with Animation

use of android.view.animation.Animation in project material-components-android by material-components.

the class FloatingActionButtonGingerbread method hide.

@Override
void hide(@Nullable final InternalVisibilityChangedListener listener, final boolean fromUser) {
    if (isOrWillBeHidden()) {
        // We either are or will soon be hidden, skip the call
        return;
    }
    mAnimState = ANIM_STATE_HIDING;
    Animation anim = android.view.animation.AnimationUtils.loadAnimation(mView.getContext(), R.anim.design_fab_out);
    anim.setInterpolator(AnimationUtils.FAST_OUT_LINEAR_IN_INTERPOLATOR);
    anim.setDuration(SHOW_HIDE_ANIM_DURATION);
    anim.setAnimationListener(new AnimationUtils.AnimationListenerAdapter() {

        @Override
        public void onAnimationEnd(Animation animation) {
            mAnimState = ANIM_STATE_NONE;
            mView.internalSetVisibility(fromUser ? View.GONE : View.INVISIBLE, fromUser);
            if (listener != null) {
                listener.onHidden();
            }
        }
    });
    mView.startAnimation(anim);
}
Also used : Animation(android.view.animation.Animation) AnimationListenerAdapter(android.support.design.widget.AnimationUtils.AnimationListenerAdapter)

Aggregations

Animation (android.view.animation.Animation)620 AlphaAnimation (android.view.animation.AlphaAnimation)164 TranslateAnimation (android.view.animation.TranslateAnimation)125 ScaleAnimation (android.view.animation.ScaleAnimation)99 AnimationListener (android.view.animation.Animation.AnimationListener)80 AnimationSet (android.view.animation.AnimationSet)71 View (android.view.View)68 Transformation (android.view.animation.Transformation)62 RotateAnimation (android.view.animation.RotateAnimation)43 Point (android.graphics.Point)35 WindowAnimation_activityCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_activityCloseEnterAnimation)35 WindowAnimation_activityCloseExitAnimation (com.android.internal.R.styleable.WindowAnimation_activityCloseExitAnimation)35 WindowAnimation_activityOpenEnterAnimation (com.android.internal.R.styleable.WindowAnimation_activityOpenEnterAnimation)35 WindowAnimation_activityOpenExitAnimation (com.android.internal.R.styleable.WindowAnimation_activityOpenExitAnimation)35 WindowAnimation_taskCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskCloseEnterAnimation)35 WindowAnimation_taskCloseExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskCloseExitAnimation)35 WindowAnimation_taskOpenEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskOpenEnterAnimation)35 WindowAnimation_taskOpenExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskOpenExitAnimation)35 WindowAnimation_taskToBackEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskToBackEnterAnimation)35 WindowAnimation_taskToBackExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskToBackExitAnimation)35