Search in sources :

Example 66 with Animatable

use of android.graphics.drawable.Animatable in project httpclient by pixmob.

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 67 with Animatable

use of android.graphics.drawable.Animatable in project SherlockAdapter by EvilBT.

the class FrescoUtil method setWrapAndResizeImage.

public static void setWrapAndResizeImage(@NonNull final SimpleDraweeView view, @NonNull final String path, final int viewWidth, @Nullable final Point size) {
    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);
                final int viewHeight = (int) (height * viewWidth / width);
                if (size != null) {
                    size.set(viewWidth, viewHeight);
                }
                setResizeImage(view, path, new ResizeOptions(viewWidth, viewHeight));
            }
        }
    };
    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) ResizeOptions(com.facebook.imagepipeline.common.ResizeOptions) ImageRequest(com.facebook.imagepipeline.request.ImageRequest) Animatable(android.graphics.drawable.Animatable) ImageInfo(com.facebook.imagepipeline.image.ImageInfo) Point(android.graphics.Point)

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