List of usage examples for android.graphics.drawable AnimationDrawable getDuration
public int getDuration(int i)
From source file:Main.java
/** * Gets the duration of the frames of animation in an AnimationDrawable, in milliseconds. * @param drawable//from w w w . j av a 2s . c o m * @return The duration of the frames in the AnimationDrawable, in milliseconds. */ public static long getAnimationDuration(AnimationDrawable drawable) { long duration = 0; for (int i = 0; i < drawable.getNumberOfFrames(); ++i) { duration += drawable.getDuration(i); } return duration; }
From source file:com.actionbarsherlock.internal.widget.IcsProgressBar.java
/** * Convert a AnimationDrawable for use as a barberpole animation. * Each frame of the animation is wrapped in a ClipDrawable and * given a tiling BitmapShader.//from w w w . ja v a 2s . c o m */ private Drawable tileifyIndeterminate(Drawable drawable) { if (drawable instanceof AnimationDrawable) { AnimationDrawable background = (AnimationDrawable) drawable; final int N = background.getNumberOfFrames(); AnimationDrawable newBg = new AnimationDrawable(); newBg.setOneShot(background.isOneShot()); for (int i = 0; i < N; i++) { Drawable frame = tileify(background.getFrame(i), true); frame.setLevel(10000); newBg.addFrame(frame, background.getDuration(i)); } newBg.setLevel(10000); drawable = newBg; } return drawable; }