Example usage for android.view.animation Animation setRepeatCount

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

Introduction

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

Prototype

public void setRepeatCount(int repeatCount) 

Source Link

Document

Sets how many times the animation should be repeated.

Usage

From source file:fiskinfoo.no.sintef.fiskinfoo.CardViewFragment.java

public Animation getBlinkAnimation() {
    Animation animation = new AlphaAnimation(1, 0);
    animation.setDuration(600);// w  w  w . ja  va  2  s.com
    animation.setInterpolator(new LinearInterpolator());
    animation.setRepeatCount(1);
    animation.setRepeatMode(Animation.REVERSE);

    return animation;
}

From source file:com.github.mobile.gauges.ui.ItemListFragment.java

private void showRefreshAnimation(MenuItem item) {
    hideRefreshAnimation();//from w w  w  . j a  v  a  2 s  .c o  m

    refreshItem = item;

    ImageView refreshActionView = (ImageView) getActivity().getLayoutInflater().inflate(layout.action_view,
            null);
    refreshActionView.setImageResource(drawable.ic_action_refresh);
    refreshItem.setActionView(refreshActionView);
    Animation animation = AnimationUtils.loadAnimation(getActivity(), anim.refresh);
    animation.setRepeatMode(RESTART);
    animation.setRepeatCount(INFINITE);
    refreshActionView.startAnimation(animation);
}

From source file:it.gulch.linuxday.android.activities.MainActivity.java

private MenuItem enableRefreshAnimation(MenuItem refreshItem) {
    LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    ImageView iv = (ImageView) inflater.inflate(R.layout.refresh_action_view, null);

    Animation rotation = AnimationUtils.loadAnimation(this, R.anim.clockwise_refresh);
    rotation.setRepeatCount(Animation.INFINITE);
    iv.startAnimation(rotation);/*from  w  w  w.  j  ava 2 s.  c o  m*/

    return MenuItemCompat.setActionView(refreshItem, iv);
}

From source file:org.secuso.privacyfriendlypasswordgenerator.activities.MainActivity.java

public void hints(int position) {

    Animation anim = new AlphaAnimation(0.0f, 1.0f);

    if (metadatalist.size() == 0 || position == 0) {

        initialAlert.setVisibility(View.VISIBLE);
        anim.setDuration(1500);//from w w w. j  av  a 2 s  .c  om
        anim.setStartOffset(20);
        anim.setRepeatMode(Animation.REVERSE);
        anim.setRepeatCount(Animation.INFINITE);
        initialAlert.startAnimation(anim);

    } else {
        initialAlert.setVisibility(View.GONE);
        initialAlert.clearAnimation();
    }

}

From source file:com.khoahuy.phototag.HomeActivity.java

private void showReady2ScanBlinkText() {

    TextView myText = (TextView) findViewById(R.id.text_ready2scan);

    Animation anim = new AlphaAnimation(0.4f, 1.0f);
    anim.setDuration(200); //You can manage the time of the blink with this parameter
    anim.setStartOffset(800);//from w  w  w .  java  2s . c o  m
    anim.setRepeatMode(Animation.REVERSE);
    anim.setRepeatCount(Animation.INFINITE);
    myText.startAnimation(anim);

}

From source file:com.libreteam.driver.Driver_RideOffer.java

private void blinkCountDown() {
    //      MediaPlayer  mp = MediaPlayer.create(getActivity(), R.raw.alert);
    //      mp.start();
    Animation anim = new AlphaAnimation(0.0f, 1.0f);
    anim.setDuration(150);/*from  ww  w. ja v a2s.  com*/
    anim.setStartOffset(120);
    anim.setRepeatMode(Animation.REVERSE);
    anim.setRepeatCount(Animation.INFINITE);
    txtCountDown.startAnimation(anim);
}

From source file:org.bwgz.quotation.activity.QuotationActivity.java

private void startLoadAnimation() {
    if (menu != null) {
        LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        ImageView iv = (ImageView) inflater.inflate(R.layout.refresh_action_view, null);

        Animation rotation = AnimationUtils.loadAnimation(this, R.anim.clockwise_refresh);
        rotation.setRepeatCount(Animation.INFINITE);
        iv.startAnimation(rotation);//from   www  . ja  v a 2s  .  c  o  m

        MenuItem item = menu.findItem(R.id.actionbar_new);
        item.setActionView(iv);
        item.setEnabled(false);
    }
}

From source file:org.secuso.privacyfriendlydicegame.MainActivity.java

public void hints(int position) {

    TextView hint = (TextView) findViewById(R.id.initialTextView);
    TextView initialText = (TextView) findViewById(R.id.initialTextTextView);
    TextView hint2 = (TextView) findViewById(R.id.initialTextView2);
    ImageView background = (ImageView) findViewById(R.id.backgroundImageView);

    Animation anim = new AlphaAnimation(0.0f, 1.0f);

    if (position == 0) {
        hint.setVisibility(View.VISIBLE);
        hint2.setVisibility(View.VISIBLE);
        background.setVisibility(View.VISIBLE);
        initialText.setVisibility(View.VISIBLE);

        anim.setDuration(1000);//from   ww w  .  j  a v  a  2s .  com
        anim.setStartOffset(20);
        anim.setRepeatMode(Animation.REVERSE);
        anim.setRepeatCount(Animation.INFINITE);
        hint.startAnimation(anim);
        hint2.startAnimation(anim);

    } else {
        hint.clearAnimation();
        hint2.clearAnimation();
        hint.setVisibility(View.INVISIBLE);
        hint2.setVisibility(View.INVISIBLE);
        background.setVisibility(View.INVISIBLE);
        initialText.setVisibility(View.INVISIBLE);
    }

}

From source file:Steps.StepsFragment.java

/**
 * Determine if the sticker is new in order to set the top pulsing
 * "NEW" indicatior/*from   www .  ja  v a2  s. c  o  m*/
 * @param imageCategory
 * @param sticker
 */
private void determineCategoty(ImageView imageCategory, Sticker sticker) {
    //new Sticker
    if (sticker.getCount() == 0) {
        Resources resources = getActivity().getResources();
        int resourceId = resources.getIdentifier("neww", "drawable", getActivity().getPackageName());
        imageCategory.setImageBitmap(
                SampleImage.decodeSampledBitmapFromResource(getResources(), resourceId, 250, 250));
        //run the animation
        Animation pulse = AnimationUtils.loadAnimation(getActivity(), R.anim.pulse);
        pulse.setRepeatCount(Animation.INFINITE);
        imageCategory.startAnimation(pulse);
    }

}

From source file:de.grobox.liberario.DirectionsFragment.java

private void pressGpsButton() {
    List<String> providers = locationManager.getProviders(true);

    for (String provider : providers) {
        // Register the listener with the Location Manager to receive location updates
        locationManager.requestSingleUpdate(provider, this, null);

        Log.d(getClass().getSimpleName(), "Register provider for location updates: " + provider);
    }//  ww  w . j  av a  2 s  . co m

    // check if there is a non-passive provider available
    if (providers.size() == 0
            || (providers.size() == 1 && providers.get(0).equals(LocationManager.PASSIVE_PROVIDER))) {
        removeUpdates();
        Toast.makeText(getActivity(), getResources().getString(R.string.error_no_location_provider),
                Toast.LENGTH_LONG).show();

        return;
    }

    // show GPS button blinking
    final Animation animation = new AlphaAnimation(1, 0);
    animation.setDuration(500);
    animation.setInterpolator(new LinearInterpolator());
    animation.setRepeatCount(Animation.INFINITE);
    animation.setRepeatMode(Animation.REVERSE);
    mView.findViewById(R.id.fromStatusButton).setAnimation(animation);

    mGpsPressed = true;
    gps_loc = null;
}