Example usage for android.view.animation ScaleAnimation setRepeatCount

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

Introduction

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

Prototype

public void setRepeatCount(int repeatCount) 

Source Link

Document

Sets how many times the animation should be repeated.

Usage

From source file:Main.java

public static ScaleAnimation getScaleAnimation(float ScaleFromX, float ScaleToX, float ScaleFromY,
        float ScaleToY, float pivotX, float pivotY, int intDuration, int intRepeatCount,
        boolean boolFillAfter) {
    ScaleAnimation mAnmation = new ScaleAnimation(ScaleFromX, ScaleToX, ScaleFromY, ScaleToY,
            Animation.RELATIVE_TO_SELF, pivotX, Animation.RELATIVE_TO_SELF, pivotY);
    mAnmation.setDuration(intDuration);/*from  ww w. jav a2s .  c o m*/
    mAnmation.setFillAfter(boolFillAfter);
    if (intRepeatCount != 1) {
        mAnmation.setRepeatMode(Animation.RESTART);
        mAnmation.setRepeatCount(intRepeatCount);
    }
    // translateAnimation.setInterpolator(AnimationUtils.loadInterpolator(mContext,
    // com.webclient.R.anim.bounce_interpolator));
    return mAnmation;
}

From source file:Main.java

public static void setScaleAnimation(View view, float ScaleFromX, float ScaleToX, float ScaleFromY,
        float ScaleToY, float pivotX, float pivotY, int intDuration, int intRepeatCount,
        boolean boolFillAfter) {
    ScaleAnimation mAnmation = new ScaleAnimation(ScaleFromX, ScaleToX, ScaleFromY, ScaleToY,
            Animation.RELATIVE_TO_SELF, pivotX, Animation.RELATIVE_TO_SELF, pivotY);
    mAnmation.setDuration(intDuration);/*  w ww .  j av a2  s .com*/
    mAnmation.setFillAfter(boolFillAfter);
    if (intRepeatCount != 1) {
        mAnmation.setRepeatMode(Animation.RESTART);
        mAnmation.setRepeatCount(intRepeatCount);
    }
    // translateAnimation.setInterpolator(AnimationUtils.loadInterpolator(mContext,
    // com.webclient.R.anim.bounce_interpolator));
    view.startAnimation(mAnmation);
}

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  av  a2s. c o  m*/
 */
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: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);//from w  w w .  ja v a  2s  . c  o m
    scaleanim1.setFillAfter(true);
    scaleanim1.setRepeatCount(Animation.INFINITE);
    scaleanim1.setRepeatMode(Animation.REVERSE);
    scaleanim1.setInterpolator(new AccelerateDecelerateInterpolator());

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

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

/**
 * Makes the camera pulse infinitely (will be stopped when loading completes)
 *///from  w w w .  ja  v  a  2  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);
}