Example usage for android.widget ProgressBar startAnimation

List of usage examples for android.widget ProgressBar startAnimation

Introduction

In this page you can find the example usage for android.widget ProgressBar startAnimation.

Prototype

public void startAnimation(Animation animation) 

Source Link

Document

Start the specified animation now.

Usage

From source file:de.geeksfactory.opacclient.frontend.AccountEditActivity.java

public void setProgress(boolean show, boolean animate) {
    ProgressBar progress = (ProgressBar) findViewById(R.id.progressBar);
    View content = findViewById(R.id.svAccount);

    if (show) {/*  ww w .ja  va 2s.c om*/
        if (animate) {
            progress.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_in));
            content.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out));
        } else {
            progress.clearAnimation();
            content.clearAnimation();
        }
        progress.setVisibility(View.VISIBLE);
        content.setVisibility(View.GONE);
    } else {
        if (animate) {
            progress.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out));
            content.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_in));
        } else {
            progress.clearAnimation();
            content.clearAnimation();
        }
        progress.setVisibility(View.GONE);
        content.setVisibility(View.VISIBLE);
    }
}