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);
}
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;
}
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);
}
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;
}
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);
}
Aggregations