Search in sources :

Example 26 with DraweeController

use of com.facebook.drawee.interfaces.DraweeController in project MyDiary by erttyy8821.

the class PhotoDetailViewerFragment method initZoomableDraweeView.

private void initZoomableDraweeView() {
    zdvPhotoDetail.setAllowTouchInterceptionWhileZoomed(true);
    // needed for double tap to zoom
    zdvPhotoDetail.setIsLongpressEnabled(false);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        // Implement the InmmersiveMode
        zdvPhotoDetail.setTapListener(new TapGestureListener(getActivity().getWindow().getDecorView(), zdvPhotoDetail));
    } else {
        // Only implement double tap
        zdvPhotoDetail.setTapListener(new DoubleTapGestureListener(zdvPhotoDetail));
    }
    DraweeController controller = Fresco.newDraweeControllerBuilder().setUri(photoUri).build();
    zdvPhotoDetail.setController(controller);
}
Also used : DoubleTapGestureListener(com.facebook.samples.zoomable.DoubleTapGestureListener) DraweeController(com.facebook.drawee.interfaces.DraweeController) DoubleTapGestureListener(com.facebook.samples.zoomable.DoubleTapGestureListener)

Example 27 with DraweeController

use of com.facebook.drawee.interfaces.DraweeController in project apps-android-wikipedia by wikimedia.

the class FaceAndColorDetectImageView method loadImage.

private void loadImage(@NonNull ImageRequestBuilder builder) {
    DraweeController controller = Fresco.newDraweeControllerBuilder().setImageRequest(builder.setPostprocessor(new FacePostprocessor(listener)).build()).setAutoPlayAnimations(true).build();
    setController(controller);
}
Also used : DraweeController(com.facebook.drawee.interfaces.DraweeController)

Example 28 with DraweeController

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

the class MediaVariationsFragment method loadThumb.

private void loadThumb(SimpleDraweeView draweeView, Size size, ImageRequest.RequestLevel requestLevel) {
    ImageRequest request = ImageRequestBuilder.newBuilderWithSource(size.uri).setMediaVariations(MediaVariations.newBuilderForMediaId(MEDIA_ID).setForceRequestForSpecifiedUri(true).build()).setLowestPermittedRequestLevel(requestLevel).setResizeOptions(new ResizeOptions(draweeView.getWidth(), draweeView.getHeight())).build();
    DraweeController controller = Fresco.newDraweeControllerBuilder().setImageRequest(request).setOldController(draweeView.getController()).build();
    draweeView.setController(controller);
}
Also used : ResizeOptions(com.facebook.imagepipeline.common.ResizeOptions) DraweeController(com.facebook.drawee.interfaces.DraweeController) ImageRequest(com.facebook.imagepipeline.request.ImageRequest)

Example 29 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);
    findViewAndLoadUri(R.id.baseline_jpeg, "https://www.gstatic.com/webp/gallery/1.sm.jpg");
    ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse("http://pooyak.com/p/progjpeg/jpegload.cgi?o=1")).setProgressiveRenderingEnabled(true).build();
    DraweeController controller = Fresco.newDraweeControllerBuilder().setImageRequest(request).setRetainImageOnFailure(true).build();
    findViewAndSetController(R.id.progressive_jpeg, controller);
    findViewAndLoadUri(R.id.static_webp, "https://www.gstatic.com/webp/gallery/2.sm.webp");
    findViewAndLoadUri(R.id.alpha_webp, "http://frescolib.org/static/translucent.webp").getHierarchy().setBackgroundImage(new ColorDrawable(0xFF302013));
    findViewAndLoadAnimatedImageUri(R.id.animated_gif, "https://s3.amazonaws.com/giphygifs/media/4aBQ9oNjgEQ2k/giphy.gif");
    findViewAndLoadAnimatedImageUri(R.id.animated_webp, "https://www.gstatic.com/webp/animated/1.webp");
    findViewAndLoadAnimatedImageUri(R.id.one_loop_animated_webp, "https://dl.dropboxusercontent.com/u/6610969/webp_180_example.webp");
    String dataUri = "data:image/webp;base64," + "UklGRjgCAABXRUJQVlA4WAoAAAAQAAAAFwAAFwAAQUxQSC0AAAABJ6AgbQNm1+EkTnRExDkWahpJgRIk" + "oOCVgAKy/mVdSxvR/wyEHWJ49xCbCAcAVlA4IOQBAACQCgCdASoYABgAPlEkjkWjoiEUBAA4BQS2AE6Z" + "Qjgbyv8ZuWF3B3ANsBdoHoAeWj+s3wleTHcua7PMAYrNOLPHFqAbpKGWe8x3KqHen7YXTMnmq/c9GqBt" + "ZtuQ0AAA/r031iZbkliICmd/QSg0OjEWbX/nv8v+g4UDPpobcehywI6oypX8hbuzcQndgaVt0zW5DiZP" + "6Ueo/21IPqsuRm1WyZHL3bJIFStwH8BOWif7xVniUiHwD5HwW8AXIZiq2maDmyIvxn4a0fetR+flTrt/" + "5/Vq3BVTeorYBHMN7L09DE9xDW/2+dj45/mCe9vjNUGRpT5EJhV8jDz/ZxPixLvN9Tl5iPD/neh1RCl6" + "AOcx3JudnAseXqvm8dEtF+rA40Bg881EW88XwU1oXf/5RY/4ToF9NwcXPLC/AodLaAFPpiXt+C6cFDIj" + "+uqi12PWFO+p7jn1P+sjCpbP/OBdHIoez8Rp6nslBEiFG19LKqv6dkGzLKtvt9dRIpz2sef2JFUVB+v+" + "hvMMmQ4o6d8aMTGuv/4wZxogl/n/k3g83NO3bBnf7/TL8Baf97pQw43+FVR0hXfpvD0k51yE35e2jNF/" + "98Uv3fAfPXw0T8irZQR4r1/ktG5xrypg/aKDooBtoI5aQAAA";
    findViewAndLoadUri(R.id.data_webp, dataUri);
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) DraweeController(com.facebook.drawee.interfaces.DraweeController) ImageRequest(com.facebook.imagepipeline.request.ImageRequest)

Example 30 with DraweeController

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

the class MainActivity method updateImageUri.

private void updateImageUri(Uri uri) {
    DraweeController controller = Fresco.newDraweeControllerBuilder().setUri(uri).setAutoPlayAnimations(true).build();
    mSimpleDraweeView.setController(controller);
    // Trigger GC to check in logs for any unclosed CloseableReferences
    // DO NOT INCLUDE THIS IN YOUR OWN APPS: It is only intended for testing changes to the library
    Runtime.getRuntime().gc();
}
Also used : DraweeController(com.facebook.drawee.interfaces.DraweeController)

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