本文整理汇总了Java中com.facebook.drawee.view.DraweeView.setController方法的典型用法代码示例。如果您正苦于以下问题:Java DraweeView.setController方法的具体用法?Java DraweeView.setController怎么用?Java DraweeView.setController使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.facebook.drawee.view.DraweeView
的用法示例。
在下文中一共展示了DraweeView.setController方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setShotUrl
import com.facebook.drawee.view.DraweeView; //导入方法依赖的package包/类
public static final void setShotUrl(DraweeView view, String url, String thumbnail/*, BaseControllerListener listener*/) {
ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(Uri.parse(url))
// .setResizeOptions(
// new ResizeOptions(300, 400))
.setProgressiveRenderingEnabled(true)
.build();
ImageRequest lowRequest = null;
if (!TextUtils.isEmpty(thumbnail)) {
lowRequest = ImageRequest.fromUri(thumbnail);
}
DraweeController draweeController = Fresco.newDraweeControllerBuilder()
.setImageRequest(imageRequest)
.setLowResImageRequest(lowRequest)
.setOldController(view.getController())
.setAutoPlayAnimations(true)
// .setControllerListener(listener)
.build();
view.setController(draweeController);
}
示例2: disPlay
import com.facebook.drawee.view.DraweeView; //导入方法依赖的package包/类
/**
* 自定义控件调用该方法显示
* @param draweeView
* @param uri
* @param resizeOptions
* @param defaultDrawable
* @param scaleType
*/
public void disPlay(DraweeView draweeView, Uri uri, String lowResUri, ResizeOptions resizeOptions, Drawable defaultDrawable, ScalingUtils.ScaleType scaleType, ControllerListener controllerListener) {
// System.out.println(draweeView.hasHierarchy());
if (!draweeView.hasHierarchy()) {
setDefaultHierarchy(draweeView,defaultDrawable,scaleType);
}
ImageRequestBuilder imageRequestBuilder =
ImageRequestBuilder.newBuilderWithSource(uri);
if (UriUtil.isNetworkUri(uri)) {
imageRequestBuilder.setProgressiveRenderingEnabled(true);
}
else {
imageRequestBuilder.setLocalThumbnailPreviewsEnabled(true);
imageRequestBuilder.setProgressiveRenderingEnabled(false);
if ( resizeOptions != null ) {
imageRequestBuilder.setResizeOptions(resizeOptions);
}
}
// imageRequestBuilder.setAutoRotateEnabled(true);
// imageRequestBuilder.setLowestPermittedRequestLevel(ImageRequest.RequestLevel.FULL_FETCH);
DraweeController draweeController = Fresco.newDraweeControllerBuilder()
.setImageRequest(imageRequestBuilder.build())
.setOldController(draweeView.getController())
.setLowResImageRequest(ImageRequest.fromUri(lowResUri))
.setControllerListener(controllerListener)
.build();
draweeView.setController(draweeController);
}
示例3: bindImage
import com.facebook.drawee.view.DraweeView; //导入方法依赖的package包/类
@Override
public void bindImage(ImageView photoImageView, Uri uri, int width, int height) {
DraweeView draweeView = (DraweeView) photoImageView;
final ImageRequestBuilder requestBuilder = ImageRequestBuilder.newBuilderWithSource(uri);
if (width > 0 && height > 0) {
requestBuilder.setResizeOptions(new ResizeOptions(width, height));
}
ImageRequest imageRequest = requestBuilder.build();
DraweeController controller = Fresco.newDraweeControllerBuilder()
.setOldController(draweeView.getController())
.setImageRequest(imageRequest).build();
draweeView.setController(controller);
}
示例4: setShotImage
import com.facebook.drawee.view.DraweeView; //导入方法依赖的package包/类
public static final void setShotImage(DraweeView view, Uri uri) {
ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(uri)
.setProgressiveRenderingEnabled(true)
// .setResizeOptions(new ResizeOptions(1024,1024))
.build();
DraweeController draweeController = Fresco.newDraweeControllerBuilder()
.setImageRequest(imageRequest)
.setOldController(view.getController())
.setAutoPlayAnimations(true)
.build();
view.setController(draweeController);
}
示例5: setShotUrl
import com.facebook.drawee.view.DraweeView; //导入方法依赖的package包/类
public static final void setShotUrl(DraweeView view, String url, String thumbnail, BaseDataSubscriber subscriber, boolean full) {
if (TextUtils.isEmpty(thumbnail) && TextUtils.isEmpty(url)) {
return;
}
ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(Uri.parse(url))
// .setResizeOptions(
// new ResizeOptions(300, 400))
.setProgressiveRenderingEnabled(true)
.build();
ImageRequest lowRequest = null;
if (!TextUtils.isEmpty(thumbnail)) {
lowRequest = ImageRequest.fromUri(thumbnail);
}
if (subscriber != null) {
if (lowRequest != null && !full) {
setSubscribe(view.getContext(), lowRequest, subscriber);
} else if (imageRequest != null) {
setSubscribe(view.getContext(), imageRequest, subscriber);
}
}
DraweeController draweeController = Fresco.newDraweeControllerBuilder()
.setImageRequest(imageRequest)
.setLowResImageRequest(lowRequest)
.setOldController(view.getController())
.setAutoPlayAnimations(true)
// .setControllerListener(listener)
.build();
// ImagePipeline imagePipeline = Fresco.getImagePipeline();
// ImageRequest request = lowRequest == null ? imageRequest : lowRequest;
// DataSource<CloseableReference<CloseableImage>> dataSource =
// imagePipeline.fetchDecodedImage(request, view.getContext());
// dataSource.subscribe(new BaseBitmapDataSubscriber() {
// @Override
// protected void onFailureImpl(DataSource<CloseableReference<CloseableImage>> dataSource) {
//
// }
//
// @Override protected void onNewResultImpl(@Nullable Bitmap bitmap) {
// Palette.from(bitmap).maximumColorCount(3).generate(new Palette.PaletteAsyncListener() {
// @Override public void onGenerated(Palette palette) {
// }
// });
// }
// }, CallerThreadExecutor.getInstance());
view.setController(draweeController);
}