Example usage for android.view.animation ScaleAnimation ScaleAnimation

List of usage examples for android.view.animation ScaleAnimation ScaleAnimation

Introduction

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

Prototype

public ScaleAnimation(float fromX, float toX, float fromY, float toY) 

Source Link

Document

Constructor to use when building a ScaleAnimation from code

Usage

From source file:Main.java

public static void btnScale(View view) {
    ScaleAnimation sa = new ScaleAnimation(0, 2, 0, 2);
    sa.setDuration(1000);
    view.startAnimation(sa);
}

From source file:Main.java

public static Animation getZoomOut() {
    Animation animation = new ScaleAnimation(0, 0, 0, 0);
    return animation;
}

From source file:Main.java

public static ScaleAnimation createScaleAnimation(float fromX, float toX, float fromY, float toY) {
    ScaleAnimation tsAnim = new ScaleAnimation(fromX, toX, fromY, toY);
    return tsAnim;
}

From source file:Main.java

public static ScaleAnimation getScaleAnimation(float fromx, float tox, float fromy, float toy, long time) {
    ScaleAnimation scaleAnimation = new ScaleAnimation(fromx, tox, fromy, toy);
    scaleAnimation.setDuration(time);//  w  w  w  . ja  va 2 s  . c  om
    return scaleAnimation;
}

From source file:Main.java

public static Animation getScaleAnimation(float fromX, float toX, float fromY, float toY, int millisSecond) {
    Animation animation = new ScaleAnimation(fromX, toX, fromY, toY);
    animation.setDuration(millisSecond);
    return animation;
}

From source file:Main.java

public static void startScaleAnim(View view, float fromX, float toX, float fromY, float toY, long duration) {
    Animation anim = new ScaleAnimation(fromX, toX, fromY, toY);
    anim.setDuration(duration);/*from  www  .j  a  va 2 s.  c  om*/
    anim.setFillAfter(true);
    view.startAnimation(anim);
}

From source file:Main.java

public static void setButtonEffect(View view) {
    AnimationSet animationSet = new AnimationSet(true);
    ScaleAnimation scaleAnimation = new ScaleAnimation(1.02f, 1.01f, 1.02f, 1.01f);
    scaleAnimation.setDuration(300);//from www  . java 2 s . c om
    animationSet.addAnimation(scaleAnimation);
    view.startAnimation(animationSet);
}

From source file:Main.java

protected static void show(final View view) {
    Animation fadeIn = new AlphaAnimation(0, 1);
    fadeIn.setStartOffset(500);//from  w ww . ja v a  2 s  . c  o m
    fadeIn.setDuration(500);

    Animation collapse = new ScaleAnimation(1, 1, 0, 1);
    collapse.setDuration(500);

    AnimationSet animation = new AnimationSet(false);
    animation.setInterpolator(new AccelerateInterpolator());
    animation.addAnimation(collapse);
    animation.addAnimation(fadeIn);

    animation.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {
            view.setVisibility(View.VISIBLE);
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            view.setVisibility(View.VISIBLE);
        }

        @Override
        public void onAnimationRepeat(Animation animation) {

        }
    });

    view.startAnimation(animation);
}

From source file:com.osama.cgpacalculator.MainActivity.java

@SuppressLint("InflateParams")
private void showAboutDialog() {
    final ScaleAnimation animation = new ScaleAnimation(0f, 1f, 0f, 1f);
    animation.setDuration(800);/*from   w w  w .  j  av  a  2  s  .c  o  m*/

    Dialog dialog = new Dialog(this);
    dialog.setContentView(R.layout.about_dialog);

    final FrameLayout frame = ((FrameLayout) dialog.findViewById(R.id.about_content_layout));
    frame.addView(getLayoutInflater().inflate(R.layout.intro_section_layout, null));

    dialog.findViewById(R.id.credit_dialog_button).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            frame.removeAllViews();
            isShowingLi = false;
            if (!isShowingCr) {
                frame.addView(getLayoutInflater().inflate(R.layout.credits_layout, null));
                isShowingCr = true;
                frame.setAnimation(animation);
            } else {
                frame.addView(getLayoutInflater().inflate(R.layout.intro_section_layout, null));
                isShowingCr = false;
                frame.setAnimation(animation);
            }
            frame.animate();
        }
    });

    dialog.findViewById(R.id.license_dialog_button).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            frame.removeAllViews();
            isShowingCr = false;
            if (!isShowingLi) {
                frame.addView(getLayoutInflater().inflate(R.layout.license_layout, null));
                isShowingLi = true;
                frame.setAnimation(animation);
            } else {
                frame.addView(getLayoutInflater().inflate(R.layout.intro_section_layout, null));
                isShowingLi = false;
                frame.setAnimation(animation);
            }
            frame.animate();
        }
    });

    dialog.show();
}

From source file:it.bellotti.android.materialdesignsample.ui.widget.ScrollAwareFABBehavior.java

private void animateFabOut(final FloatingActionButton button) {
    if (Build.VERSION.SDK_INT >= 14) {
        ViewCompat.animate(button).scaleX(0.0F).scaleY(0.0F).alpha(0.0F).setInterpolator(INTERPOLATOR)
                .withLayer().setListener(new ViewPropertyAnimatorListener() {
                    public void onAnimationStart(View view) {
                        ScrollAwareFABBehavior.this.mIsAnimatingOut = true;
                    }//from   ww  w  .  j a  va 2 s  . co  m

                    public void onAnimationCancel(View view) {
                        ScrollAwareFABBehavior.this.mIsAnimatingOut = false;
                    }

                    public void onAnimationEnd(View view) {
                        ScrollAwareFABBehavior.this.mIsAnimatingOut = false;
                        view.setVisibility(View.GONE);
                    }
                }).start();
    } else {
        Animation anim = new ScaleAnimation(1.0F, 1.0F, 0.0F, 0.0F);
        anim.setInterpolator(INTERPOLATOR);
        anim.setDuration(200L);
        anim.setAnimationListener(new Animation.AnimationListener() {
            public void onAnimationStart(Animation animation) {
                ScrollAwareFABBehavior.this.mIsAnimatingOut = true;
            }

            public void onAnimationEnd(Animation animation) {
                ScrollAwareFABBehavior.this.mIsAnimatingOut = false;
                button.setVisibility(View.GONE);
            }

            @Override
            public void onAnimationRepeat(final Animation animation) {
            }
        });
        button.startAnimation(anim);
    }
}