Search in sources :

Example 31 with DraweeController

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

the class LockActivity method updateTrack.

public void updateTrack() {
    lrcRows = getLrcRows();
    String url = MusicPlayer.getAlbumPath();
    if (url == null) {
        mBack.setImageURI(Uri.parse("res:/" + R.drawable.login_bg_night));
    } else {
        try {
            ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(url)).build();
            DraweeController controller = Fresco.newDraweeControllerBuilder().setOldController(mBack.getController()).setImageRequest(request).setControllerListener(controllerListener).build();
            mBack.setController(controller);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
Also used : DraweeController(com.facebook.drawee.interfaces.DraweeController) ImageRequest(com.facebook.imagepipeline.request.ImageRequest) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException)

Example 32 with DraweeController

use of com.facebook.drawee.interfaces.DraweeController 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 33 with DraweeController

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

the class QuickControlsFragment method updateNowplayingCard.

public void updateNowplayingCard() {
    mTitle.setText(MusicPlayer.getTrackName());
    mArtist.setText(MusicPlayer.getArtistName());
    ControllerListener controllerListener = new BaseControllerListener<ImageInfo>() {

        @Override
        public void onFinalImageSet(String id, @Nullable ImageInfo imageInfo, @Nullable Animatable anim) {
            if (imageInfo == null) {
                return;
            }
            QualityInfo qualityInfo = imageInfo.getQualityInfo();
            FLog.d("Final image received! " + "Size %d x %d", "Quality level %d, good enough: %s, full quality: %s", imageInfo.getWidth(), imageInfo.getHeight(), qualityInfo.getQuality(), qualityInfo.isOfGoodEnoughQuality(), qualityInfo.isOfFullQuality());
        }

        @Override
        public void onIntermediateImageSet(String id, @Nullable ImageInfo imageInfo) {
        // FLog.d("Intermediate image received");
        }

        @Override
        public void onFailure(String id, Throwable throwable) {
            mAlbumArt.setImageURI(Uri.parse("res:/" + R.drawable.placeholder_disk_210));
        }
    };
    Uri uri = null;
    try {
        uri = Uri.parse(MusicPlayer.getAlbumPath());
    } catch (Exception e) {
        e.printStackTrace();
    }
    if (uri != null) {
        ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri).build();
        DraweeController controller = Fresco.newDraweeControllerBuilder().setOldController(mAlbumArt.getController()).setImageRequest(request).setControllerListener(controllerListener).build();
        mAlbumArt.setController(controller);
    } else {
        mAlbumArt.setImageURI(Uri.parse("content://" + MusicPlayer.getAlbumPath()));
    }
}
Also used : BaseControllerListener(com.facebook.drawee.controller.BaseControllerListener) DraweeController(com.facebook.drawee.interfaces.DraweeController) ImageRequest(com.facebook.imagepipeline.request.ImageRequest) Animatable(android.graphics.drawable.Animatable) BaseControllerListener(com.facebook.drawee.controller.BaseControllerListener) ControllerListener(com.facebook.drawee.controller.ControllerListener) QualityInfo(com.facebook.imagepipeline.image.QualityInfo) ImageInfo(com.facebook.imagepipeline.image.ImageInfo) Uri(android.net.Uri) Nullable(android.support.annotation.Nullable)

Example 34 with DraweeController

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

the class SimpleDraweeView method setImageRequest.

/**
 * Sets the image request
 *
 * @param request Image Request
 */
public void setImageRequest(ImageRequest request) {
    AbstractDraweeControllerBuilder controllerBuilder = mControllerBuilder;
    DraweeController controller = controllerBuilder.setImageRequest(request).setOldController(getController()).build();
    setController(controller);
}
Also used : AbstractDraweeControllerBuilder(com.facebook.drawee.controller.AbstractDraweeControllerBuilder) DraweeController(com.facebook.drawee.interfaces.DraweeController)

Example 35 with DraweeController

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

the class DraweeMocks method mockController.

/**
 * Creates a mock DraweeController with some methods stubbed.
 *
 * @return mock DraweeController
 */
public static DraweeController mockController() {
    DraweeController controller = mock(AbstractDraweeController.class);
    stubGetAndSetHierarchy(controller);
    stubGetAndSetContentDescription(controller);
    return controller;
}
Also used : DraweeController(com.facebook.drawee.interfaces.DraweeController) AbstractDraweeController(com.facebook.drawee.controller.AbstractDraweeController)

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