Search in sources :

Example 1 with DraweeController

use of com.facebook.drawee.interfaces.DraweeController in project remusic by aa112901.

the class RoundView method setAlbum.

public void setAlbum(String albumPath) {
    if (albumPath == null) {
        albumView.setImageURI(Uri.parse("res:/" + R.drawable.placeholder_disk_play_song));
    } else {
        try {
            ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(albumPath)).build();
            DraweeController controller = Fresco.newDraweeControllerBuilder().setOldController(albumView.getController()).setImageRequest(request).setControllerListener(controllerListener).build();
            albumView.setController(controller);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    Log.e("roundview", "setalbum = " + albumPath);
}
Also used : DraweeController(com.facebook.drawee.interfaces.DraweeController) ImageRequest(com.facebook.imagepipeline.request.ImageRequest)

Example 2 with DraweeController

use of com.facebook.drawee.interfaces.DraweeController in project BigImageViewer by Piasy.

the class FrescoImageLoader method showThumbnail.

@Override
public View showThumbnail(BigImageView parent, Uri thumbnail, int scaleType) {
    SimpleDraweeView thumbnailView = (SimpleDraweeView) LayoutInflater.from(parent.getContext()).inflate(R.layout.ui_fresco_thumbnail, parent, false);
    DraweeController controller = Fresco.newDraweeControllerBuilder().setUri(thumbnail).build();
    switch(scaleType) {
        case BigImageView.INIT_SCALE_TYPE_CENTER_CROP:
            thumbnailView.getHierarchy().setActualImageScaleType(ScalingUtils.ScaleType.CENTER_CROP);
            break;
        case BigImageView.INIT_SCALE_TYPE_CENTER_INSIDE:
            thumbnailView.getHierarchy().setActualImageScaleType(ScalingUtils.ScaleType.CENTER_INSIDE);
        default:
            break;
    }
    thumbnailView.setController(controller);
    return thumbnailView;
}
Also used : SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) DraweeController(com.facebook.drawee.interfaces.DraweeController)

Example 3 with DraweeController

use of com.facebook.drawee.interfaces.DraweeController in project Rocket.Chat.Android by RocketChat.

the class FrescoHelper method loadImage.

public static void loadImage(String imageUrl, SimpleDraweeView draweeView) {
    final DraweeController controller = Fresco.newDraweeControllerBuilder().setUri(Uri.parse(imageUrl)).setAutoPlayAnimations(true).setTapToRetryEnabled(true).build();
    draweeView.setController(controller);
}
Also used : DraweeController(com.facebook.drawee.interfaces.DraweeController)

Example 4 with DraweeController

use of com.facebook.drawee.interfaces.DraweeController in project fresco by facebook.

the class VolleyDraweeControllerBuilder method obtainController.

@Override
protected VolleyDraweeController obtainController() {
    DraweeController oldController = getOldController();
    VolleyDraweeController controller;
    if (oldController instanceof VolleyDraweeController) {
        controller = (VolleyDraweeController) oldController;
        controller.initialize(obtainDataSourceSupplier(), generateUniqueControllerId(), getCallerContext());
    } else {
        controller = mVolleyDraweeControllerFactory.newController(obtainDataSourceSupplier(), generateUniqueControllerId(), getCallerContext());
    }
    return controller;
}
Also used : DraweeController(com.facebook.drawee.interfaces.DraweeController)

Example 5 with DraweeController

use of com.facebook.drawee.interfaces.DraweeController in project fresco by facebook.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    // GIF
    final ViewGroup gifControls = (ViewGroup) findViewById(R.id.gif_controls);
    updateAnimationControls(gifControls, null);
    mAnimatedGifView = (SimpleDraweeView) findViewById(R.id.animated_gif);
    Uri animatedGifUri = Uri.parse("http://s3.amazonaws.com/giphygifs/media/4aBQ9oNjgEQ2k/giphy.gif");
    final TextView gifInfo = (TextView) findViewById(R.id.gif_info);
    DraweeController gifController = Fresco.newDraweeControllerBuilder().setUri(animatedGifUri).setControllerListener(new BaseControllerListener<ImageInfo>() {

        @Override
        public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable anim) {
            updateAnimationControls(gifControls, anim);
            gifInfo.setText(getAnimationInformation(anim));
        }
    }).build();
    mAnimatedGifView.setController(gifController);
    // Animated WebP
    final ViewGroup webpControls = (ViewGroup) findViewById(R.id.webp_controls);
    updateAnimationControls(webpControls, null);
    mAnimatedWebpView = (SimpleDraweeView) findViewById(R.id.animated_webp);
    final TextView webpInfo = (TextView) findViewById(R.id.webp_info);
    Uri animatedWebpUri = Uri.parse("http://www.gstatic.com/webp/animated/1.webp");
    DraweeController webpController = Fresco.newDraweeControllerBuilder().setUri(animatedWebpUri).setControllerListener(new BaseControllerListener<ImageInfo>() {

        @Override
        public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable anim) {
            updateAnimationControls(webpControls, anim);
            webpInfo.setText(getAnimationInformation(anim));
        }
    }).build();
    mAnimatedWebpView.setController(webpController);
}
Also used : BaseControllerListener(com.facebook.drawee.controller.BaseControllerListener) ViewGroup(android.view.ViewGroup) DraweeController(com.facebook.drawee.interfaces.DraweeController) Animatable(android.graphics.drawable.Animatable) TextView(android.widget.TextView) ImageInfo(com.facebook.imagepipeline.image.ImageInfo) Uri(android.net.Uri)

Aggregations

DraweeController (com.facebook.drawee.interfaces.DraweeController)53 ImageRequest (com.facebook.imagepipeline.request.ImageRequest)25 ResizeOptions (com.facebook.imagepipeline.common.ResizeOptions)10 Uri (android.net.Uri)8 SimpleDraweeView (com.facebook.drawee.view.SimpleDraweeView)8 Animatable (android.graphics.drawable.Animatable)7 BaseControllerListener (com.facebook.drawee.controller.BaseControllerListener)6 GenericDraweeHierarchy (com.facebook.drawee.generic.GenericDraweeHierarchy)5 ImageInfo (com.facebook.imagepipeline.image.ImageInfo)5 ControllerListener (com.facebook.drawee.controller.ControllerListener)4 QualityInfo (com.facebook.imagepipeline.image.QualityInfo)4 Drawable (android.graphics.drawable.Drawable)3 Nullable (android.support.annotation.Nullable)3 Canvas (android.graphics.Canvas)2 ColorDrawable (android.graphics.drawable.ColorDrawable)2 View (android.view.View)2 ViewGroup (android.view.ViewGroup)2 AbstractDraweeController (com.facebook.drawee.controller.AbstractDraweeController)2 ProgressBarDrawable (com.facebook.drawee.drawable.ProgressBarDrawable)2 GenericDraweeHierarchyBuilder (com.facebook.drawee.generic.GenericDraweeHierarchyBuilder)2