use of android.graphics.drawable.Animatable in project Mvp-Rxjava-Retrofit-dagger2 by pengMaster.
the class AVLoadingIndicatorView method drawTrack.
void drawTrack(Canvas canvas) {
final Drawable d = mIndicator;
if (d != null) {
// Translate canvas so a indeterminate circular progress bar with padding
// rotates properly in its animation
final int saveCount = canvas.save();
canvas.translate(getPaddingLeft(), getPaddingTop());
d.draw(canvas);
canvas.restoreToCount(saveCount);
if (mShouldStartAnimationDrawable && d instanceof Animatable) {
((Animatable) d).start();
mShouldStartAnimationDrawable = false;
}
}
}
use of android.graphics.drawable.Animatable in project SherlockAdapter by EvilBT.
the class FrescoUtil method setWrapImage.
public static void setWrapImage(@NonNull final SimpleDraweeView view, @NonNull final String path) {
Preconditions.checkNotNull(view);
Preconditions.checkNotNull(path);
ControllerListener<ImageInfo> controllerListener = new BaseControllerListener<ImageInfo>() {
@Override
public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
if (imageInfo == null) {
return;
}
final float width = imageInfo.getWidth();
final float height = imageInfo.getHeight();
if (width * height != 0.0f) {
view.setAspectRatio(width / height);
}
}
};
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(path)).build();
view.setController(Fresco.newDraweeControllerBuilder().setImageRequest(request).setOldController(view.getController()).setControllerListener(controllerListener).build());
}
use of android.graphics.drawable.Animatable in project SmartAndroidSource by jaychou2012.
the class IcsProgressBar method startAnimation.
/**
* <p>
* Start the indeterminate progress animation.
* </p>
*/
void startAnimation() {
if (getVisibility() != VISIBLE) {
return;
}
if (mIndeterminateDrawable instanceof Animatable) {
mShouldStartAnimationDrawable = true;
mAnimation = null;
} else {
if (mInterpolator == null) {
mInterpolator = new LinearInterpolator();
}
mTransformation = new Transformation();
mAnimation = new AlphaAnimation(0.0f, 1.0f);
mAnimation.setRepeatMode(mBehavior);
mAnimation.setRepeatCount(Animation.INFINITE);
mAnimation.setDuration(mDuration);
mAnimation.setInterpolator(mInterpolator);
mAnimation.setStartTime(Animation.START_ON_FIRST_FRAME);
}
postInvalidate();
}
use of android.graphics.drawable.Animatable in project android-oss by kickstarter.
the class ThanksActivity method animateBackground.
private void animateBackground() {
woohooBackgroundImageView.animate().setDuration(Long.parseLong(getString(R.string.woohoo_duration))).alpha(1);
final Drawable drawable = woohooBackgroundImageView.getDrawable();
if (drawable instanceof Animatable) {
((Animatable) drawable).start();
}
}
use of android.graphics.drawable.Animatable in project fresco by facebook.
the class GenericDraweeHierarchy method setProgress.
private void setProgress(float progress) {
Drawable progressBarDrawable = mFadeDrawable.getDrawable(PROGRESS_BAR_IMAGE_INDEX);
if (progressBarDrawable == null) {
return;
}
// display progressbar when not fully loaded, hide otherwise
if (progress >= 0.999f) {
if (progressBarDrawable instanceof Animatable) {
((Animatable) progressBarDrawable).stop();
}
fadeOutLayer(PROGRESS_BAR_IMAGE_INDEX);
} else {
if (progressBarDrawable instanceof Animatable) {
((Animatable) progressBarDrawable).start();
}
fadeInLayer(PROGRESS_BAR_IMAGE_INDEX);
}
// set drawable level, scaled to [0, 10000] per drawable specification
progressBarDrawable.setLevel(Math.round(progress * 10000));
}
Aggregations