Example usage for android.widget ViewSwitcher setAnimation

List of usage examples for android.widget ViewSwitcher setAnimation

Introduction

In this page you can find the example usage for android.widget ViewSwitcher setAnimation.

Prototype

public void setAnimation(Animation animation) 

Source Link

Document

Sets the next animation to play for this view.

Usage

From source file:com.friedran.appengine.dashboard.gui.DashboardLoadFragment.java

private void updateChartImage(View chartView, Bitmap image, boolean animate) {
    ImageView chartImageView = (ImageView) chartView.findViewById(R.id.load_chart_image);

    if (image != null) {
        chartImageView.setImageBitmap(image);
    } else {/*w ww  .  java2  s .  co  m*/
        chartImageView.setImageResource(android.R.color.transparent);
        Toast.makeText(mActivity,
                "Failed downloading charts, please make sure you have Internet connectivity and try refreshing",
                2000).show();
    }

    ViewSwitcher viewSwitcher = (ViewSwitcher) chartView.findViewById(R.id.load_chart_switcher);
    if (viewSwitcher.getDisplayedChild() != 1) {
        if (animate) {
            viewSwitcher.setAnimation(AnimationUtils.loadAnimation(mActivity, R.anim.fadein));
        } else
            viewSwitcher.setAnimation(null);
        viewSwitcher.showNext();
    }

    // Mark the refresh UI as complete once anyone of the charts has been loaded.
    mPullToRefreshAttacher.setRefreshComplete();
}