use of android.graphics.drawable.AnimationDrawable in project TextDrawable by amulyakhare.
the class DrawableProvider method getRectWithAnimation.
public Drawable getRectWithAnimation() {
TextDrawable.IBuilder builder = TextDrawable.builder().rect();
AnimationDrawable animationDrawable = new AnimationDrawable();
for (int i = 10; i > 0; i--) {
TextDrawable frame = builder.build(String.valueOf(i), mGenerator.getRandomColor());
animationDrawable.addFrame(frame, 1200);
}
animationDrawable.setOneShot(false);
animationDrawable.start();
return animationDrawable;
}
use of android.graphics.drawable.AnimationDrawable in project ignition by mttkay.
the class RemoteImageView method buildProgressSpinnerView.
protected View buildProgressSpinnerView(Context context) {
ProgressBar loadingSpinner = new ProgressBar(context);
loadingSpinner.setIndeterminate(true);
if (this.progressDrawable == null) {
this.progressDrawable = loadingSpinner.getIndeterminateDrawable();
} else {
loadingSpinner.setIndeterminateDrawable(progressDrawable);
if (progressDrawable instanceof AnimationDrawable) {
((AnimationDrawable) progressDrawable).start();
}
}
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(progressDrawable.getIntrinsicWidth(), progressDrawable.getIntrinsicHeight(), Gravity.CENTER);
loadingSpinner.setLayoutParams(lp);
return loadingSpinner;
}
use of android.graphics.drawable.AnimationDrawable in project httpclient by pixmob.
the class IcsProgressBar 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 HoloEverywhere by Prototik.
the class ProgressBar method updateDrawableBounds.
private void updateDrawableBounds(int w, int h) {
int right = w - getPaddingRight() - getPaddingLeft();
int bottom = h - getPaddingBottom() - getPaddingTop();
int top = 0;
int left = 0;
if (mIndeterminateDrawable != null) {
if (mOnlyIndeterminate && !(mIndeterminateDrawable instanceof AnimationDrawable)) {
final int intrinsicWidth = mIndeterminateDrawable.getIntrinsicWidth();
final int intrinsicHeight = mIndeterminateDrawable.getIntrinsicHeight();
final float intrinsicAspect = (float) intrinsicWidth / intrinsicHeight;
final float boundAspect = (float) w / h;
if (intrinsicAspect != boundAspect) {
if (boundAspect > intrinsicAspect) {
final int width = (int) (h * intrinsicAspect);
left = (w - width) / 2;
right = left + width;
} else {
final int height = (int) (w * (1 / intrinsicAspect));
top = (h - height) / 2;
bottom = top + height;
}
}
}
mIndeterminateDrawable.setBounds(left, top, right, bottom);
}
if (mProgressDrawable != null) {
mProgressDrawable.setBounds(0, 0, right, bottom);
}
}
use of android.graphics.drawable.AnimationDrawable in project u2020 by JakeWharton.
the class TrendingView method onFinishInflate.
@Override
protected void onFinishInflate() {
super.onFinishInflate();
ButterKnife.bind(this);
AnimationDrawable ellipsis = (AnimationDrawable) ContextCompat.getDrawable(getContext(), R.drawable.dancing_ellipsis);
loadingMessageView.setCompoundDrawablesWithIntrinsicBounds(null, null, ellipsis, null);
ellipsis.start();
toolbarView.setNavigationIcon(R.drawable.menu_icon);
toolbarView.setNavigationOnClickListener(v -> drawerLayout.openDrawer(GravityCompat.START));
timespanView.setAdapter(timespanAdapter);
timespanView.setSelection(TrendingTimespan.WEEK.ordinal());
swipeRefreshView.setColorSchemeResources(R.color.accent);
swipeRefreshView.setOnRefreshListener(this);
trendingAdapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
@Override
public void onChanged() {
animatorView.setDisplayedChildId(//
trendingAdapter.getItemCount() == 0 ? //
R.id.trending_empty : R.id.trending_swipe_refresh);
swipeRefreshView.setRefreshing(false);
}
});
trendingView.setLayoutManager(new LinearLayoutManager(getContext()));
trendingView.addItemDecoration(new DividerItemDecoration(getContext(), VERTICAL_LIST, dividerPaddingStart, isRtl()));
trendingView.setAdapter(trendingAdapter);
}
Aggregations