Search in sources :

Example 36 with Animatable

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;
        }
    }
}
Also used : Drawable(android.graphics.drawable.Drawable) Animatable(android.graphics.drawable.Animatable)

Example 37 with Animatable

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());
}
Also used : BaseControllerListener(com.facebook.drawee.controller.BaseControllerListener) ImageRequest(com.facebook.imagepipeline.request.ImageRequest) Animatable(android.graphics.drawable.Animatable) ImageInfo(com.facebook.imagepipeline.image.ImageInfo)

Example 38 with Animatable

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();
}
Also used : Transformation(android.view.animation.Transformation) LinearInterpolator(android.view.animation.LinearInterpolator) Animatable(android.graphics.drawable.Animatable) AlphaAnimation(android.view.animation.AlphaAnimation)

Example 39 with Animatable

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();
    }
}
Also used : Drawable(android.graphics.drawable.Drawable) Animatable(android.graphics.drawable.Animatable)

Example 40 with Animatable

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));
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) FadeDrawable(com.facebook.drawee.drawable.FadeDrawable) Drawable(android.graphics.drawable.Drawable) ScaleTypeDrawable(com.facebook.drawee.drawable.ScaleTypeDrawable) MatrixDrawable(com.facebook.drawee.drawable.MatrixDrawable) ForwardingDrawable(com.facebook.drawee.drawable.ForwardingDrawable) Animatable(android.graphics.drawable.Animatable)

Aggregations

Animatable (android.graphics.drawable.Animatable)67 Drawable (android.graphics.drawable.Drawable)34 AnimationDrawable (android.graphics.drawable.AnimationDrawable)17 BitmapDrawable (android.graphics.drawable.BitmapDrawable)17 ClipDrawable (android.graphics.drawable.ClipDrawable)17 LayerDrawable (android.graphics.drawable.LayerDrawable)17 AlphaAnimation (android.view.animation.AlphaAnimation)17 LinearInterpolator (android.view.animation.LinearInterpolator)17 Transformation (android.view.animation.Transformation)17 ShapeDrawable (android.graphics.drawable.ShapeDrawable)12 StateListDrawable (android.graphics.drawable.StateListDrawable)9 ImageInfo (com.facebook.imagepipeline.image.ImageInfo)8 BaseControllerListener (com.facebook.drawee.controller.BaseControllerListener)7 ImageRequest (com.facebook.imagepipeline.request.ImageRequest)6 DraweeController (com.facebook.drawee.interfaces.DraweeController)5 QualityInfo (com.facebook.imagepipeline.image.QualityInfo)4 Uri (android.net.Uri)3 Nullable (android.support.annotation.Nullable)3 ControllerListener (com.facebook.drawee.controller.ControllerListener)3 View (android.view.View)2