Example usage for android.view.animation ScaleAnimation setDuration

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

Introduction

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

Prototype

public void setDuration(long durationMillis) 

Source Link

Document

How long this animation should last.

Usage

From source file:zjut.soft.finalwork.fragment.RightFragment.java

public void plannerScaleAction() {
    ScaleAnimation scaleanim1 = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
    scaleanim1.setDuration(1500);
    scaleanim1.setFillAfter(true);//from   www  .j  av  a  2  s. c  om
    scaleanim1.setRepeatCount(Animation.INFINITE);
    scaleanim1.setRepeatMode(Animation.REVERSE);
    scaleanim1.setInterpolator(new AccelerateDecelerateInterpolator());

    plannerIV.setAnimation(scaleanim1);
    scaleanim1.startNow();
}

From source file:com.example.android.google.wearable.watchviewstub.MainActivity.java

/**
 * Animates the layout when clicked. The animation used depends on whether the
 * device is round or rectangular./*from  w  w  w .j  a  v  a2 s  .  c om*/
 */
public void onLayoutClicked(View view) {
    if (mRectBackground != null) {
        ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, 0.7f, 1.0f, 0.7f, Animation.RELATIVE_TO_SELF,
                0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
        scaleAnimation.setDuration(300);
        scaleAnimation.setRepeatCount(1);
        scaleAnimation.setRepeatMode(Animation.REVERSE);
        mRectBackground.startAnimation(scaleAnimation);
    }
    if (mRoundBackground != null) {
        mRoundBackground.animate().rotationBy(360).setDuration(300).start();
    }
}

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

private void gpaAnimation(View view) {
    ScaleAnimation animation = new ScaleAnimation(0f, 1f, 1f, 1f);
    animation.setDuration(500);
    view.setAnimation(animation);//from  w w  w . j a va2s .  c  om
    view.animate();
}

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

    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/*  w  ww .  j  a v  a2  s . c  o  m*/
        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:quickbeer.android.next.views.ProgressIndicatorBar.java

private void animateToProgress(float progress) {
    Log.v(TAG, "animateToProgress(" + progress + ")");

    float newScale = (getWidth() * progress / progressBarWidth) + 1;

    ScaleAnimation animation = new ScaleAnimation(1, newScale, progressBar.getHeight(),
            progressBar.getHeight());//from   ww  w  .  j a  v a 2s.  co m
    animation.setDuration(ANIMATION_PROGRESS_DURATION);
    animation.setFillAfter(true);

    progressBar.setVisibility(VISIBLE);
    progressBar.clearAnimation();
    progressBar.startAnimation(animation);
}

From source file:quickbeer.android.next.views.ProgressIndicatorBar.java

private void animateToEnd() {
    Log.v(TAG, "animateToEnd()");

    if (progressBar.getAnimation() == null) {
        // Non-active progress bar doesn't need end animation
        return;/*from   w w  w.  j  a  va 2 s. c  o  m*/
    }

    ScaleAnimation animation = new ScaleAnimation(1, (getWidth() / progressBarWidth) + 1,
            progressBar.getHeight(), progressBar.getHeight());
    animation.setDuration(ANIMATION_END_SCALE_DURATION);
    animation.setFillAfter(true);
    animation.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            animateToHidden();
        }
    });

    progressBar.setVisibility(VISIBLE);
    progressBar.clearAnimation();
    progressBar.startAnimation(animation);
}

From source file:quickbeer.android.views.ProgressIndicatorBar.java

private void animateToProgress(float progress) {
    Timber.v("animateToProgress(%s)", progress);
    checkNotNull(progressBar);/*from  w w w.j av a 2 s . c  om*/

    float newScale = (getWidth() * progress / progressBarWidth) + 1;

    Timber.v("animate scale %s -> %s", barScale, newScale);

    ScaleAnimation animation = new ScaleAnimation(barScale, newScale, progressBar.getHeight(),
            progressBar.getHeight());
    animation.setDuration(ANIMATION_PROGRESS_DURATION);
    animation.setFillAfter(true);
    animation.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            barScale = newScale;
            applyNextStatus();
        }
    });

    progressBar.setVisibility(VISIBLE);
    progressBar.clearAnimation();
    progressBar.startAnimation(animation);
}

From source file:quickbeer.android.views.ProgressIndicatorBar.java

private void animateToEnd() {
    Timber.v("animateToEnd()");
    checkNotNull(progressBar);/*from  w w w.ja  va2  s . c  o  m*/

    if (progressBar.getAnimation() == null) {
        // Non-active progress bar doesn't need end animation
        return;
    }

    ScaleAnimation animation = new ScaleAnimation(barScale, (getWidth() / (float) progressBarWidth) + 1,
            progressBar.getHeight(), progressBar.getHeight());
    animation.setDuration(ANIMATION_END_SCALE_DURATION);
    animation.setFillAfter(true);
    animation.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            barScale = 1.0f;
            animateToHidden();
        }
    });

    progressBar.setVisibility(VISIBLE);
    progressBar.clearAnimation();
    progressBar.startAnimation(animation);
}

From source file:com.mindorks.framework.mvp.ui.main.MainActivity.java

@Override
public void reloadQuestionnaire(List<Question> questionList) {
    refreshQuestionnaire(questionList);//from   w ww  .  j ava2s .  c  o m
    ScaleAnimation animation = new ScaleAnimation(1.15f, 1, 1.15f, 1, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);

    mCardsContainerView.setAnimation(animation);
    animation.setDuration(100);
    animation.start();
}

From source file:com.carver.paul.truesight.Ui.MainActivity.java

/**
 * Makes the camera pulse infinitely (will be stopped when loading completes)
 */// w  ww. j  a  va2  s. co  m
//TODO-nextversion: Make camera do something other than pulse - it implies you should press
// it!
private void pulseCameraImage() {
    //Code using the old Animation class, rather than the new ViewPropertyAnimator
    //Infinite repeat is easier to implement this way

    View cameraImage = findViewById(R.id.image_pulsing_camera);
    cameraImage.setVisibility(View.VISIBLE);
    cameraImage.setAlpha(1f);

    ScaleAnimation pulse = new ScaleAnimation(1f, 0.8f, 1f, 0.8f, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
    pulse.setDuration(250);
    pulse.setRepeatCount(Animation.INFINITE);
    pulse.setRepeatMode(Animation.REVERSE);
    cameraImage.startAnimation(pulse);

    View processingText = findViewById(R.id.text_processing_image);
    processingText.setAlpha(1f);
    processingText.setVisibility(View.VISIBLE);
}