use of com.facebook.drawee.interfaces.DraweeController in project fresco by facebook.
the class PipelineDraweeControllerBuilder method obtainController.
@Override
protected PipelineDraweeController obtainController() {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.beginSection("PipelineDraweeControllerBuilder#obtainController");
}
try {
DraweeController oldController = getOldController();
PipelineDraweeController controller;
final String controllerId = generateUniqueControllerId();
if (oldController instanceof PipelineDraweeController) {
controller = (PipelineDraweeController) oldController;
} else {
controller = mPipelineDraweeControllerFactory.newController();
}
controller.initialize(obtainDataSourceSupplier(controller, controllerId), controllerId, getCacheKey(), getCallerContext(), mCustomDrawableFactories, mImageOriginListener);
controller.initializePerformanceMonitoring(mImagePerfDataListener, this, Suppliers.BOOLEAN_FALSE);
return controller;
} finally {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.endSection();
}
}
}
use of com.facebook.drawee.interfaces.DraweeController in project fresco by facebook.
the class DraweeSpanStringBuilder method setImageSpan.
public void setImageSpan(DraweeHolder draweeHolder, int startIndex, int endIndex, final int drawableWidthPx, final int drawableHeightPx, boolean enableResizing, @BetterImageSpan.BetterImageSpanAlignment int verticalAlignment) {
if (endIndex >= length()) {
// Example: Text = "ABC", insert image at position 18.
return;
}
Drawable topLevelDrawable = draweeHolder.getTopLevelDrawable();
if (topLevelDrawable != null) {
if (topLevelDrawable.getBounds().isEmpty()) {
topLevelDrawable.setBounds(0, 0, drawableWidthPx, drawableHeightPx);
}
topLevelDrawable.setCallback(mDrawableCallback);
}
DraweeSpan draweeSpan = new DraweeSpan(draweeHolder, verticalAlignment);
final DraweeController controller = draweeHolder.getController();
if (controller instanceof AbstractDraweeController) {
((AbstractDraweeController) controller).addControllerListener(new DrawableChangedListener(draweeSpan, enableResizing, drawableHeightPx));
}
mDraweeSpans.add(draweeSpan);
setSpan(draweeSpan, startIndex, endIndex + 1, SPAN_EXCLUSIVE_EXCLUSIVE);
}
use of com.facebook.drawee.interfaces.DraweeController in project fresco by facebook.
the class MyPagerAdapter method instantiateItem.
@Override
public Object instantiateItem(ViewGroup container, int position) {
FrameLayout page = (FrameLayout) container.getChildAt(position);
if (page == null) {
return null;
}
ZoomableDraweeView zoomableDraweeView = (ZoomableDraweeView) page.findViewById(R.id.zoomableView);
zoomableDraweeView.setAllowTouchInterceptionWhileZoomed(mAllowSwipingWhileZoomed);
// needed for double tap to zoom
zoomableDraweeView.setIsLongpressEnabled(false);
zoomableDraweeView.setTapListener(new DoubleTapGestureListener(zoomableDraweeView));
DraweeController controller = Fresco.newDraweeControllerBuilder().setUri(SAMPLE_URIS[position % SAMPLE_URIS.length]).setCallerContext("ZoomableApp-MyPagerAdapter").build();
zoomableDraweeView.setController(controller);
page.requestLayout();
return page;
}
use of com.facebook.drawee.interfaces.DraweeController in project teaTime by ancfdy.
the class FrescoUtils method moreImgRequst.
/**
* 多图请求需 自定义ImageRequest(图片预览)
* @param draweeView
* @param lowResUri
* @param highResUri
*/
public static void moreImgRequst(SimpleDraweeView draweeView, String lowResUri, String highResUri) {
DraweeController controller = Fresco.newDraweeControllerBuilder().setLowResImageRequest(// 低分辨率的缩略图
ImageRequest.fromUri(Uri.parse(lowResUri))).setImageRequest(// 高分辨率的图
ImageRequest.fromUri(Uri.parse(highResUri))).setOldController(draweeView.getController()).build();
draweeView.setController(controller);
}
use of com.facebook.drawee.interfaces.DraweeController in project teaTime by ancfdy.
the class FrescoUtils method loadGif.
/**
* 加载gif图
* @param draweeView
* @param uriString
*/
public static void loadGif(SimpleDraweeView draweeView, String uriString) {
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(uriString)).build();
DraweeController controller = Fresco.newDraweeControllerBuilder().setImageRequest(request).setAutoPlayAnimations(true).build();
draweeView.setController(controller);
}
Aggregations