use of android.graphics.drawable.AnimationDrawable in project HoloEverywhere by Prototik.
the class ProgressBar method tileifyIndeterminate.
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;
}
use of android.graphics.drawable.AnimationDrawable in project LuaViewSDK by alibaba.
the class UDImageView method startAnimationImages.
/**
* 开始帧动画(目前只支持本地动画)
*
* @param images
* @param duration
* @return
*/
public UDImageView startAnimationImages(String[] images, int duration, boolean repeat) {
final T view = getView();
if (view != null) {
Drawable[] frames = null;
if (images != null && images.length > 0) {
if (getLuaResourceFinder() != null) {
frames = new Drawable[images.length];
for (int i = 0; i < images.length; i++) {
frames[i] = getLuaResourceFinder().findDrawable(images[i]);
}
}
if (frames != null && frames.length > 0) {
mFrameAnimation = new AnimationDrawable();
try {
for (Drawable frame : frames) {
mFrameAnimation.addFrame(frame, duration);
}
} catch (Throwable e) {
e.printStackTrace();
LogUtil.e("[LuaView-Error] UDImageView.startAnimationImages failed!");
}
mFrameAnimation.setOneShot(!repeat);
LuaViewUtil.setBackground(view, mFrameAnimation);
mFrameAnimation.setVisible(true, true);
mFrameAnimation.start();
}
}
}
return this;
}
use of android.graphics.drawable.AnimationDrawable in project Android-skin-support by ximsfei.
the class SkinCompatProgressBarHelper method tileifyIndeterminate.
/**
* Convert a AnimationDrawable for use as a barberpole animation.
* Each frame of the animation is wrapped in a ClipDrawable and
* given a tiling BitmapShader.
*/
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;
}
use of android.graphics.drawable.AnimationDrawable in project RecyclerRefreshLayout by dinuscxj.
the class RefreshViewEg method refreshing.
@Override
public void refreshing() {
clearAnimation();
AnimationDrawable drawable = (AnimationDrawable) getResources().getDrawable(R.drawable.spinner);
this.setImageDrawable(drawable);
drawable.start();
}
use of android.graphics.drawable.AnimationDrawable in project RecyclerRefreshLayout by dinuscxj.
the class DefaultTipsHelper method showLoading.
@Override
public void showLoading(boolean firstPage) {
hideEmpty();
hideError();
if (firstPage) {
View tipsView = TipsUtils.showTips(mRecyclerView, TipsType.LOADING);
AnimationDrawable drawable = (AnimationDrawable) ((ImageView) tipsView).getDrawable();
drawable.start();
return;
}
// maybe you like this mode
// mRefreshLayout.post(new Runnable() {
// @Override
// public void run() {
// mRefreshLayout.setRefreshing(true);
// }
// });
}
Aggregations