Search in sources :

Example 16 with GenericDraweeHierarchy

use of com.facebook.drawee.generic.GenericDraweeHierarchy in project actor-platform by actorapp.

the class AvatarView method init.

public void init(int size, float placeholderTextSize) {
    this.size = size;
    this.placeholderTextSize = placeholderTextSize;
    GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources());
    GenericDraweeHierarchy hierarchy = builder.setFadeDuration(200).setRoundingParams(new RoundingParams().setRoundAsCircle(true).setRoundingMethod(RoundingParams.RoundingMethod.BITMAP_ONLY)).build();
    setHierarchy(hierarchy);
}
Also used : GenericDraweeHierarchyBuilder(com.facebook.drawee.generic.GenericDraweeHierarchyBuilder) GenericDraweeHierarchy(com.facebook.drawee.generic.GenericDraweeHierarchy) RoundingParams(com.facebook.drawee.generic.RoundingParams)

Example 17 with GenericDraweeHierarchy

use of com.facebook.drawee.generic.GenericDraweeHierarchy in project actor-platform by actorapp.

the class StickerView method init.

private void init() {
    builder = new GenericDraweeHierarchyBuilder(getResources());
    GenericDraweeHierarchy hierarchy = builder.setFadeDuration(200).setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER).build();
    setHierarchy(hierarchy);
    fastThumbLoader = new FastThumbLoader(this);
}
Also used : GenericDraweeHierarchyBuilder(com.facebook.drawee.generic.GenericDraweeHierarchyBuilder) GenericDraweeHierarchy(com.facebook.drawee.generic.GenericDraweeHierarchy) FastThumbLoader(im.actor.sdk.controllers.conversation.view.FastThumbLoader)

Example 18 with GenericDraweeHierarchy

use of com.facebook.drawee.generic.GenericDraweeHierarchy in project GalleryFinal by pengjianbo.

the class FrescoImageLoader method displayImage.

@Override
public void displayImage(Activity activity, String path, final GFImageView imageView, final Drawable defaultDrawable, int width, int height) {
    Resources resources = context.getResources();
    GenericDraweeHierarchy hierarchy = new GenericDraweeHierarchyBuilder(resources).setFadeDuration(300).setPlaceholderImage(defaultDrawable).setFailureImage(defaultDrawable).setProgressBarImage(new ProgressBarDrawable()).build();
    final DraweeHolder<GenericDraweeHierarchy> draweeHolder = DraweeHolder.create(hierarchy, context);
    imageView.setOnImageViewListener(new GFImageView.OnImageViewListener() {

        @Override
        public void onDetach() {
            draweeHolder.onDetach();
        }

        @Override
        public void onAttach() {
            draweeHolder.onAttach();
        }

        @Override
        public boolean verifyDrawable(Drawable dr) {
            if (dr == draweeHolder.getHierarchy().getTopLevelDrawable()) {
                return true;
            }
            return false;
        }

        @Override
        public void onDraw(Canvas canvas) {
            Drawable drawable = draweeHolder.getHierarchy().getTopLevelDrawable();
            if (drawable == null) {
                imageView.setImageDrawable(defaultDrawable);
            } else {
                imageView.setImageDrawable(drawable);
            }
        }
    });
    Uri uri = new Uri.Builder().scheme(UriUtil.LOCAL_FILE_SCHEME).path(path).build();
    ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(uri).setResizeOptions(//图片目标大小
    new ResizeOptions(width, height)).build();
    DraweeController controller = Fresco.newDraweeControllerBuilder().setOldController(draweeHolder.getController()).setImageRequest(imageRequest).build();
    draweeHolder.setController(controller);
}
Also used : ProgressBarDrawable(com.facebook.drawee.drawable.ProgressBarDrawable) GenericDraweeHierarchy(com.facebook.drawee.generic.GenericDraweeHierarchy) GenericDraweeHierarchyBuilder(com.facebook.drawee.generic.GenericDraweeHierarchyBuilder) DraweeController(com.facebook.drawee.interfaces.DraweeController) Canvas(android.graphics.Canvas) Drawable(android.graphics.drawable.Drawable) ProgressBarDrawable(com.facebook.drawee.drawable.ProgressBarDrawable) Uri(android.net.Uri) ResizeOptions(com.facebook.imagepipeline.common.ResizeOptions) ImageRequest(com.facebook.imagepipeline.request.ImageRequest) Resources(android.content.res.Resources) GFImageView(cn.finalteam.galleryfinal.widget.GFImageView)

Example 19 with GenericDraweeHierarchy

use of com.facebook.drawee.generic.GenericDraweeHierarchy in project Rocket.Chat.Android by RocketChat.

the class RocketChatAvatar method loadImage.

public void loadImage(String url, Drawable placeholder) {
    final GenericDraweeHierarchy hierarchy = draweeView.getHierarchy();
    hierarchy.setPlaceholderImage(placeholder);
    hierarchy.setFailureImage(placeholder);
    final DraweeController controller = Fresco.newDraweeControllerBuilder().setUri(Uri.parse(url)).setAutoPlayAnimations(true).build();
    draweeView.setController(controller);
}
Also used : GenericDraweeHierarchy(com.facebook.drawee.generic.GenericDraweeHierarchy) DraweeController(com.facebook.drawee.interfaces.DraweeController)

Example 20 with GenericDraweeHierarchy

use of com.facebook.drawee.generic.GenericDraweeHierarchy in project ride-read-android by Ride-Read.

the class FrescoImgLoader method displayImage.

@Override
public void displayImage(Activity activity, Context context, String path, final GalleryImageView imageView, int width, int height) {
    GenericDraweeHierarchy hierarchy = // 占位图
    new GenericDraweeHierarchyBuilder(context.getResources()).setFadeDuration(300).setPlaceholderImage(R.mipmap.gallery_pick_photo).setFailureImage(// 加载失败图
    R.mipmap.gallery_pick_photo).setProgressBarImage(// loading
    new ProgressBarDrawable()).build();
    final DraweeHolder<GenericDraweeHierarchy> draweeHolder = DraweeHolder.create(hierarchy, context);
    imageView.setOnImageViewListener(new GalleryImageView.OnImageViewListener() {

        @Override
        public void onDraw(Canvas canvas) {
            Drawable drawable = draweeHolder.getHierarchy().getTopLevelDrawable();
            if (drawable == null) {
                imageView.setImageResource(R.mipmap.gallery_pick_photo);
            } else {
                imageView.setImageDrawable(drawable);
            }
        }

        @Override
        public boolean verifyDrawable(Drawable dr) {
            return dr == draweeHolder.getHierarchy().getTopLevelDrawable();
        }

        @Override
        public void onDetach() {
            draweeHolder.onDetach();
        }

        @Override
        public void onAttach() {
            draweeHolder.onAttach();
        }
    });
    Uri uri = new Uri.Builder().scheme(UriUtil.LOCAL_FILE_SCHEME).path(path).build();
    ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(uri).setResizeOptions(new ResizeOptions(width, height)).build();
    DraweeController controller = Fresco.newDraweeControllerBuilder().setOldController(draweeHolder.getController()).setImageRequest(imageRequest).build();
    draweeHolder.setController(controller);
}
Also used : GalleryImageView(com.yancy.gallerypick.widget.GalleryImageView) ProgressBarDrawable(com.facebook.drawee.drawable.ProgressBarDrawable) GenericDraweeHierarchy(com.facebook.drawee.generic.GenericDraweeHierarchy) GenericDraweeHierarchyBuilder(com.facebook.drawee.generic.GenericDraweeHierarchyBuilder) DraweeController(com.facebook.drawee.interfaces.DraweeController) Canvas(android.graphics.Canvas) Drawable(android.graphics.drawable.Drawable) ProgressBarDrawable(com.facebook.drawee.drawable.ProgressBarDrawable) Uri(android.net.Uri) ResizeOptions(com.facebook.imagepipeline.common.ResizeOptions) ImageRequest(com.facebook.imagepipeline.request.ImageRequest)

Aggregations

GenericDraweeHierarchy (com.facebook.drawee.generic.GenericDraweeHierarchy)22 GenericDraweeHierarchyBuilder (com.facebook.drawee.generic.GenericDraweeHierarchyBuilder)11 RoundingParams (com.facebook.drawee.generic.RoundingParams)5 ProgressBarDrawable (com.facebook.drawee.drawable.ProgressBarDrawable)4 DraweeController (com.facebook.drawee.interfaces.DraweeController)4 Uri (android.net.Uri)3 ResizeOptions (com.facebook.imagepipeline.common.ResizeOptions)3 ImageRequest (com.facebook.imagepipeline.request.ImageRequest)3 Canvas (android.graphics.Canvas)2 PointF (android.graphics.PointF)2 Drawable (android.graphics.drawable.Drawable)2 InstrumentedDraweeView (com.facebook.samples.comparison.instrumentation.InstrumentedDraweeView)2 InstrumentedDraweeView (com.facebook.samples.scrollperf.instrumentation.InstrumentedDraweeView)2 ObjectAnimator (android.animation.ObjectAnimator)1 Context (android.content.Context)1 Resources (android.content.res.Resources)1 Animatable (android.graphics.drawable.Animatable)1 Keep (android.support.annotation.Keep)1 Nullable (android.support.annotation.Nullable)1 RecyclerView (android.support.v7.widget.RecyclerView)1