use of com.facebook.imagepipeline.request.ImageRequest in project actor-platform by actorapp.
the class AvatarView method bindRaw.
public void bindRaw(String fileName) {
if (bindedFile != null) {
bindedFile.detach();
bindedFile = null;
}
currentId = 0;
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.fromFile(new File(fileName))).setResizeOptions(new ResizeOptions(size, size)).setAutoRotateEnabled(true).build();
PipelineDraweeController controller = (PipelineDraweeController) Fresco.newDraweeControllerBuilder().setOldController(getController()).setImageRequest(request).build();
setController(controller);
}
use of com.facebook.imagepipeline.request.ImageRequest in project actor-platform by actorapp.
the class CallBackgroundAvatarView method bind.
public void bind(Avatar avatar) {
// Same avatar
if (avatar != null && getImage(avatar) != null && getImage(avatar).getFileReference().getFileId() == currentId) {
return;
}
fastThumbLoader = new FastThumbLoader(this);
fastThumbLoader.setBlur(10);
if (bindedFile != null) {
bindedFile.detach();
bindedFile = null;
}
setImageURI(null);
if (avatar == null || getImage(avatar) == null) {
currentId = 0;
return;
}
currentId = getImage(avatar).getFileReference().getFileId();
bindedFile = messenger().bindFile(getImage(avatar).getFileReference(), true, new FileVMCallback() {
@Override
public void onNotDownloaded() {
}
@Override
public void onDownloading(float progress) {
}
@Override
public void onDownloaded(FileSystemReference reference) {
blurActor.send(new BlurActor.RequestBlur(reference.getDescriptor(), 10, new BlurActor.BluredListener() {
@Override
public void onBlured(final File f) {
((BaseActivity) getContext()).runOnUiThread(new Runnable() {
@Override
public void run() {
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.fromFile(f)).setResizeOptions(new ResizeOptions(Screen.getWidth(), Screen.getHeight())).build();
PipelineDraweeController controller = (PipelineDraweeController) Fresco.newDraweeControllerBuilder().setOldController(getController()).setImageRequest(request).build();
setController(controller);
}
});
}
}));
}
});
}
use of com.facebook.imagepipeline.request.ImageRequest 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();
}
}
}
use of com.facebook.imagepipeline.request.ImageRequest in project boxing by Bilibili.
the class BoxingFrescoLoader method displayRaw.
@Override
public void displayRaw(@NonNull ImageView img, @NonNull String absPath, IBoxingCallback callback) {
absPath = "file://" + absPath;
ImageRequestBuilder requestBuilder = ImageRequestBuilder.newBuilderWithSource(Uri.parse(absPath));
ImageRequest request = requestBuilder.build();
loadImage(request, img, callback);
}
use of com.facebook.imagepipeline.request.ImageRequest in project lzc_app_lib by httplzc.
the class BigImgDataRequestHelper method getHolderData.
// 获取holder 的catch
private void getHolderData(final WrapperUri wrapperUri) {
final Uri holderUri = wrapperUri.getLowUri();
if (holderUri == null)
return;
ImagePipeline imagePipeline = Fresco.getImagePipeline();
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(holderUri).setResizeOptions(new ResizeOptions(ScreenData.widthPX / 3, ScreenData.heightPX / 3)).build();
DataSource<CloseableReference<CloseableImage>> dataSource = imagePipeline.fetchDecodedImage(request, "");
dataSource.subscribe(new BaseDataSubscriber<CloseableReference<CloseableImage>>() {
@Override
protected void onNewResultImpl(DataSource<CloseableReference<CloseableImage>> dataSource) {
if (!dataSource.isFinished()) {
return;
}
CloseableReference<CloseableImage> ref = dataSource.getResult();
if (ref != null && ref.isValid()) {
try {
if (data.get(wrapperUri.getUri()) == null) {
holderData.put(holderUri, ref.clone());
if (imgDataLoadCompleteListener != null)
imgDataLoadCompleteListener.onHolderDataLoadComplete(wrapperUri);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
CloseableReference.closeSafely(ref);
}
}
}
@Override
protected void onFailureImpl(DataSource<CloseableReference<CloseableImage>> dataSource) {
}
}, UiThreadImmediateExecutorService.getInstance());
}
Aggregations