Example usage for android.view View setAnimation

List of usage examples for android.view View setAnimation

Introduction

In this page you can find the example usage for android.view View setAnimation.

Prototype

public void setAnimation(Animation animation) 

Source Link

Document

Sets the next animation to play for this view.

Usage

From source file:Main.java

public static void stopAnimation(View view) {
    view.setAnimation(null);
}

From source file:Main.java

public static void startInAnimation(View view, Animation inAnim) {
    view.setAnimation(inAnim);
    view.setVisibility(View.VISIBLE);
}

From source file:Main.java

public static void animEff(Context context, View animView, int animId) {
    Animation shakeAnimation = AnimationUtils.loadAnimation(context, animId);
    animView.setAnimation(shakeAnimation);
}

From source file:Main.java

/**
 * hideRefreshAnimation/*www.java  2 s .co m*/
 * stop the refresh animation
 * @param v
 */
public static void hideRefreshAnimation(View v) {
    if (animation != null) {
        animation.cancel();
        v.clearAnimation();
        v.setAnimation(null);
        //v.setImageResource(R.drawable.refresh);
    }
}

From source file:Main.java

/**
 * Fades in the view/*from w  w  w.  j  ava  2 s . com*/
 * @param view
 */
public static void fadeIn(final View view, int duration) {
    final Animation in = new AlphaAnimation(0.0f, 1.0f);
    in.setDuration(duration);
    view.setAnimation(in);
}

From source file:Main.java

public static void clearViewAnim(View view) {
    if (view == null) {
        return;//  w  w  w . java2 s .  c o m
    }
    Animation anim = view.getAnimation();
    if (anim != null) {
        anim.cancel();
        view.setAnimation(null);
    }
    anim = null;
}

From source file:com.hybris.mobile.app.commerce.utils.UIUtils.java

/**
 * Animate the layout to expand/*from  w ww.j a va2 s  . co  m*/
 */
public static void expandLayout(Context context, View view) {
    Animation animation = AnimationUtils.loadAnimation(context, R.anim.expand);
    view.setAnimation(animation);
    view.animate();
    animation.start();
}

From source file:com.hybris.mobile.app.commerce.utils.UIUtils.java

/**
 * Animate the layout to collapse// ww  w .j a va 2  s .c  o m
 */
public static void collapseLayout(Context context, View view) {
    Animation animation = AnimationUtils.loadAnimation(context, R.anim.collapse);
    view.setAnimation(animation);
    view.animate();
    animation.start();
}

From source file:Main.java

public static void toBigAnim2(View view) {
    ScaleAnimation animation = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.0f);
    animation.setDuration(1000);//from w ww  .ja  v a  2s.  c  om
    animation.setFillAfter(false);
    view.setAnimation(animation);
    animation.start();
}

From source file:Main.java

public static void startTranslationAnimation(View view) {
    TranslateAnimation translateAnimation = new TranslateAnimation(-50f, 50f, 0, 0);
    translateAnimation.setDuration(1000);
    translateAnimation.setRepeatCount(Animation.INFINITE);
    translateAnimation.setRepeatMode(Animation.REVERSE);
    view.setAnimation(translateAnimation);
    translateAnimation.start();/*from w  w  w . j av a 2 s.c om*/
}