Search in sources :

Example 1 with OrientedDrawable

use of com.facebook.drawee.drawable.OrientedDrawable in project boxing by Bilibili.

the class BoxingFrescoLoader method createDrawableFromFetchedResult.

private Drawable createDrawableFromFetchedResult(Context context, CloseableImage image) {
    if (image instanceof CloseableStaticBitmap) {
        CloseableStaticBitmap closeableStaticBitmap = (CloseableStaticBitmap) image;
        BitmapDrawable bitmapDrawable = createBitmapDrawable(context, closeableStaticBitmap.getUnderlyingBitmap());
        return (closeableStaticBitmap.getRotationAngle() != 0 && closeableStaticBitmap.getRotationAngle() != -1 ? new OrientedDrawable(bitmapDrawable, closeableStaticBitmap.getRotationAngle()) : bitmapDrawable);
    } else if (image instanceof CloseableAnimatedImage) {
        AnimatedDrawableFactory animatedDrawableFactory = Fresco.getImagePipelineFactory().getAnimatedFactory().getAnimatedDrawableFactory(context);
        if (animatedDrawableFactory != null) {
            AnimatedDrawable animatedDrawable = (AnimatedDrawable) animatedDrawableFactory.create(image);
            if (animatedDrawable != null) {
                return animatedDrawable;
            }
        }
    }
    throw new UnsupportedOperationException("Unrecognized image class: " + image);
}
Also used : OrientedDrawable(com.facebook.drawee.drawable.OrientedDrawable) CloseableAnimatedImage(com.facebook.imagepipeline.image.CloseableAnimatedImage) AnimatedDrawableFactory(com.facebook.imagepipeline.animated.factory.AnimatedDrawableFactory) CloseableStaticBitmap(com.facebook.imagepipeline.image.CloseableStaticBitmap) BitmapDrawable(android.graphics.drawable.BitmapDrawable) AnimatedDrawable(com.facebook.imagepipeline.animated.base.AnimatedDrawable)

Aggregations

BitmapDrawable (android.graphics.drawable.BitmapDrawable)1 OrientedDrawable (com.facebook.drawee.drawable.OrientedDrawable)1 AnimatedDrawable (com.facebook.imagepipeline.animated.base.AnimatedDrawable)1 AnimatedDrawableFactory (com.facebook.imagepipeline.animated.factory.AnimatedDrawableFactory)1 CloseableAnimatedImage (com.facebook.imagepipeline.image.CloseableAnimatedImage)1 CloseableStaticBitmap (com.facebook.imagepipeline.image.CloseableStaticBitmap)1