Example usage for android.view.animation AnimationUtils loadAnimation

List of usage examples for android.view.animation AnimationUtils loadAnimation

Introduction

In this page you can find the example usage for android.view.animation AnimationUtils loadAnimation.

Prototype

public static Animation loadAnimation(Context context, @AnimRes int id) throws NotFoundException 

Source Link

Document

Loads an Animation object from a resource

Usage

From source file:Main.java

public static void startAnimation(Context context, View view, int animID) {
    animation = AnimationUtils.loadAnimation(context, animID);
    view.startAnimation(animation);//from   w w  w .ja va  2  s  .co  m
}

From source file:com.isabverma.letscode.intro.util.AnimUtils.java

public static void applyShakeAnimation(Context context, View view) {
    Animation shake;/*w w  w.j  a v a2  s .  c  om*/
    shake = AnimationUtils.loadAnimation(context, R.anim.shake);
    view.startAnimation(shake);
}

From source file:com.heinrichreimersoftware.materialintro.util.AnimUtils.java

public static void applyShakeAnimation(Context context, View view) {
    Animation shake;/*from  w ww.j  a v  a  2 s .com*/
    shake = AnimationUtils.loadAnimation(context, R.anim.mi_shake);
    view.startAnimation(shake);
}

From source file:com.dm.wallpaper.board.utils.Animator.java

public static void startSlideDownAnimation(@NonNull View view, int visibility) {
    Context context = ContextHelper.getBaseContext(view);
    Animation animation = AnimationUtils.loadAnimation(context, R.anim.slide_down_from_top);
    view.startAnimation(animation);/*from w  w w  . j a  v  a  2s .  c  o  m*/
    view.setVisibility(visibility);
}

From source file:com.dm.material.dashboard.candybar.utils.Animator.java

public static void startSlideDownAnimation(@NonNull View view) {
    Context context = ContextHelper.getBaseContext(view);

    Animation slideDown = AnimationUtils.loadAnimation(context, R.anim.slide_down_from_top);
    view.startAnimation(slideDown);// w w w  .j a va 2  s . c o m
    view.setVisibility(View.VISIBLE);
}

From source file:Main.java

public static Object getResource(Context context, Field field, int value) {
    Resources resources = context.getResources();
    Class type = field.getType();

    if (type.isAssignableFrom(Boolean.TYPE) || type.isAssignableFrom(Boolean.class))
        return resources.getBoolean(value);
    else if (type.isAssignableFrom(Integer.TYPE) || type.isAssignableFrom(Integer.class)) {
        return resources.getInteger(value);
    } else if (type.isAssignableFrom(ColorStateList.class))
        return resources.getColorStateList(value);
    else if (type.isAssignableFrom(XmlResourceParser.class))
        return resources.getXml(value);
    else if (type.isAssignableFrom(Float.TYPE) || type.isAssignableFrom(Float.class))
        return resources.getDimension(value);
    else if (type.isAssignableFrom(Drawable.class))
        return resources.getDrawable(value);
    else if (type.isAssignableFrom(Animation.class))
        return AnimationUtils.loadAnimation(context, value);
    else if (type.isAssignableFrom(Movie.class))
        return resources.getMovie(value);
    else if (type.isAssignableFrom(String.class))
        return resources.getString(value);
    else if (type.isArray()) {
        if (type.getName().equals("[I")) {
            return resources.getIntArray(value);
        } else if (type.isAssignableFrom(String[].class)) {
            return resources.getStringArray(value);
        }/*w  ww  .  j a va2 s  .  c o  m*/
    }

    return null;
}

From source file:com.byoutline.kickmaterial.utils.LUtils.java

public static Animation loadAnimationWithLInterpolator(Context context, @AnimRes int animId,
        android.view.animation.Interpolator interpolator) {
    Animation animation = AnimationUtils.loadAnimation(context, animId);
    animation.setInterpolator(interpolator);
    return animation;
}

From source file:com.bluros.music.utils.FabAnimationUtils.java

public static void scaleIn(final View fab, long duration, final ScaleCallback callback) {
    fab.setVisibility(View.VISIBLE);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        ViewCompat.animate(fab).scaleX(1.0F).scaleY(1.0F).alpha(1.0F).setDuration(duration)
                .setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR).withLayer()
                .setListener(new ViewPropertyAnimatorListener() {
                    public void onAnimationStart(View view) {
                        if (callback != null)
                            callback.onAnimationStart();
                    }//from  ww w  . j  av  a2s.c  om

                    public void onAnimationCancel(View view) {
                    }

                    public void onAnimationEnd(View view) {
                        view.setVisibility(View.VISIBLE);
                        if (callback != null)
                            callback.onAnimationEnd();
                    }
                }).start();
    } else {
        Animation anim = AnimationUtils.loadAnimation(fab.getContext(), R.anim.design_fab_out);
        anim.setDuration(duration);
        anim.setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR);
        anim.setAnimationListener(new Animation.AnimationListener() {
            public void onAnimationStart(Animation animation) {
                if (callback != null)
                    callback.onAnimationStart();
            }

            public void onAnimationEnd(Animation animation) {
                fab.setVisibility(View.VISIBLE);
                if (callback != null)
                    callback.onAnimationEnd();
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
                //
            }
        });
        fab.startAnimation(anim);
    }
}

From source file:com.poussiere_violette.poussieremagique.MainActivity2.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main2);
    animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fade_in);
    grandConteneur = (View) findViewById(R.id.main_content);
    vPager = (ViewPager) findViewById(R.id.container);
    vPager.startAnimation(animation);//from   www. j a v  a 2  s  . c  o  m

    ran = new Random();
    destinNumber = ran.nextInt(4 - 1 + 1) + 1;
    mAdapter = new MyFragmentAdapter(getSupportFragmentManager());

    vPager.setAdapter(mAdapter);

}

From source file:com.cnm.cnmrc.popup.PopupBase.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View layout = (View) inflater.inflate(R.layout.popup, container, false);

    animation = AnimationUtils.loadAnimation(context, R.anim.gtv_progressbar);
    mProgressBar = (ImageView) layout.findViewById(R.id.popup_progressbar);
    mProgressBar.setVisibility(View.INVISIBLE);

    mTitle = (TextView) layout.findViewById(R.id.popup_title);

    mLine1 = (TextView) layout.findViewById(R.id.popup_line_1);
    mLine2 = (TextView) layout.findViewById(R.id.popup_line_2);

    mYes = (Button) layout.findViewById(R.id.popup_yes);
    mYes.setText(getString(R.string.popup_yes));
    mYes.setOnClickListener(this);

    mNo = (Button) layout.findViewById(R.id.popup_no);
    mNo.setText(getString(R.string.popup_no));
    mNo.setOnClickListener(this);

    return layout;
}