本文整理汇总了Java中com.facebook.drawee.controller.BaseControllerListener类的典型用法代码示例。如果您正苦于以下问题:Java BaseControllerListener类的具体用法?Java BaseControllerListener怎么用?Java BaseControllerListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BaseControllerListener类属于com.facebook.drawee.controller包,在下文中一共展示了BaseControllerListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import com.facebook.drawee.controller.BaseControllerListener; //导入依赖的package包/类
private void init() {
mInstrumentation = new Instrumentation(this);
mListener = new BaseControllerListener<Object>() {
@Override
public void onSubmit(String id, Object callerContext) {
mInstrumentation.onStart();
}
@Override
public void onFinalImageSet(
String id,
@Nullable Object imageInfo,
@Nullable Animatable animatable) {
mInstrumentation.onSuccess();
}
@Override
public void onFailure(String id, Throwable throwable) {
mInstrumentation.onFailure();
}
@Override
public void onRelease(String id) {
mInstrumentation.onCancellation();
}
};
}
示例2: onCreate
import com.facebook.drawee.controller.BaseControllerListener; //导入依赖的package包/类
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
ButterKnife.bind(this);
Uri uri = Uri.parse("asset:///splash.webp");
mSplashPresenter = new SplashPresenterImpl(this);
DraweeController controller = Fresco.newDraweeControllerBuilder()
.setUri(uri)
.setAutoPlayAnimations(true)
.setControllerListener(new BaseControllerListener<ImageInfo>(){
@Override
public void onFinalImageSet(String id, @Nullable ImageInfo imageInfo, @Nullable Animatable animatable) {
super.onFinalImageSet(id, imageInfo, animatable);
mSplashPresenter.startCountDown(1);
}
})
.build();
splashDraweee.setController(controller);
}
示例3: loadImage
import com.facebook.drawee.controller.BaseControllerListener; //导入依赖的package包/类
public static void loadImage(final PhotoDraweeView mPhotoDraweeView,
Uri uri) {
PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder();
controller.setUri(uri);
controller.setAutoPlayAnimations(true);
controller.setOldController(mPhotoDraweeView.getController());
controller.setControllerListener(new BaseControllerListener<ImageInfo>() {
@Override
public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
super.onFinalImageSet(id, imageInfo, animatable);
if (imageInfo == null || mPhotoDraweeView == null) {
return;
}
mPhotoDraweeView.update(imageInfo.getWidth(), imageInfo.getHeight());
}
});
mPhotoDraweeView.setController(controller.build());
}
示例4: loadImage
import com.facebook.drawee.controller.BaseControllerListener; //导入依赖的package包/类
public void loadImage(String url,String lowurl, int placeHolderResId, int errorResId,ScalingUtils.ScaleType scaleType){
final boolean isHttp = url.startsWith("http");
Uri uri = isHttp ? Uri.parse(url) : Uri.fromFile(new File(url));
PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder()
.setImageRequest(ImageRequest.fromUri(uri));
if(lowurl!=null && lowurl.startsWith("http")) {
controller .setLowResImageRequest(ImageRequest.fromUri(lowurl));
}
getHierarchy().setActualImageScaleType(scaleType);
// controller.setUri(URI);
getHierarchy().setPlaceholderImage(getResources().getDrawable( placeHolderResId ),scaleType);
getHierarchy().setFailureImage(getResources().getDrawable(errorResId),scaleType);
controller.setOldController(this.getController())
.setControllerListener(new BaseControllerListener<ImageInfo>() {
@Override
public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
if (imageInfo == null) {
return;
}
PhotoDraweeView.this.update(imageInfo.getWidth(), imageInfo.getHeight());
}
});
this.setController(controller.build());
}
示例5: load
import com.facebook.drawee.controller.BaseControllerListener; //导入依赖的package包/类
public static void load(Uri uri,SimpleDraweeView draweeView,BasePostprocessor processor,int width,int height,
BaseControllerListener listener){
ImageRequest request =
ImageRequestBuilder.newBuilderWithSource(uri)
.setPostprocessor(processor)
.setResizeOptions(new ResizeOptions(width,height))
//缩放,在解码前修改内存中的图片大小, 配合Downsampling可以处理所有图片,否则只能处理jpg,
// 开启Downsampling:在初始化时设置.setDownsampleEnabled(true)
.setProgressiveRenderingEnabled(true)//支持图片渐进式加载
.setAutoRotateEnabled(true) //如果图片是侧着,可以自动旋转
.build();
PipelineDraweeController controller =
(PipelineDraweeController) Fresco.newDraweeControllerBuilder()
.setImageRequest(request)
.setControllerListener(listener)
.setOldController(draweeView.getController())
.setAutoPlayAnimations(true) //自动播放gif动画
.build();
draweeView.setController(controller);
}
示例6: showThumb
import com.facebook.drawee.controller.BaseControllerListener; //导入依赖的package包/类
/**
* showThumb
*
* @param draweeView draweeView
* @param url url
* @param resizeWidthDp resizeWidth
* @param resizeHeightDp resizeHeight
*/
public static void showThumb(SimpleDraweeView draweeView, String url, int resizeWidthDp, int resizeHeightDp) {
try {
if (!isInit)
return;
if (url == null || "".equals(url))
return;
if (draweeView == null)
return;
initialize(draweeView.getContext());
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(url))
.setResizeOptions(new ResizeOptions(DimenUtils.dip2px(draweeView.getContext(), resizeWidthDp), DimenUtils.dip2px(draweeView.getContext(), resizeHeightDp)))
.build();
DraweeController controller = Fresco.newDraweeControllerBuilder()
.setImageRequest(request)
.setOldController(draweeView.getController())
.setControllerListener(new BaseControllerListener<ImageInfo>())
.build();
draweeView.setController(controller);
} catch (Exception e) {
}
}
示例7: showResGif
import com.facebook.drawee.controller.BaseControllerListener; //导入依赖的package包/类
public static DraweeController showResGif(int resourceId, SimpleDraweeView simpleDraweeView) {
ControllerListener controllerListener = new BaseControllerListener<ImageInfo>() {
@Override
public void onFinalImageSet(
String id,
@Nullable ImageInfo imageInfo,
@Nullable Animatable anim) {
if (anim != null) {
anim.start();
}
}
};
Uri uri = Uri.parse("res://com.blinnnk.gaia/" + resourceId);
DraweeController draweeController = Fresco.newDraweeControllerBuilder()
.setUri(uri)
.setControllerListener(controllerListener)
.build();
simpleDraweeView.setController(draweeController);
return draweeController;
}
示例8: initLoad
import com.facebook.drawee.controller.BaseControllerListener; //导入依赖的package包/类
@Override
public void initLoad() {
super.initLoad();
if (!TextUtils.isEmpty(mImageUrl)) {
PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder();
controller.setUri(mImageUrl);
controller.setOldController(mPhotoIv.getController());
controller.setControllerListener(new BaseControllerListener<ImageInfo>() {
@Override
public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
super.onFinalImageSet(id, imageInfo, animatable);
if (imageInfo == null || mPhotoIv == null) {
return;
}
mPhotoIv.update(imageInfo.getWidth(), imageInfo.getHeight());
}
});
mPhotoIv.setController(controller.build());
}
}
示例9: loadByFresco
import com.facebook.drawee.controller.BaseControllerListener; //导入依赖的package包/类
private void loadByFresco(String url) {
Uri uri = Uri.parse(url);
ControllerListener listener = new BaseControllerListener<ImageInfo>() {
@Override
public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
super.onFinalImageSet(id, imageInfo, animatable);
Log.d(TAG, "Fresco----->onFinalImageSet: " + LogTime.getElapsedMillis(startTimeFresco) + "ms");
textFresco.setText(getString(R.string.text_load_time, "Fresco", String.format("%.6f", LogTime.getElapsedMillis(startTimeFresco))));
}
};
DraweeController controller = Fresco.newDraweeControllerBuilder()
.setControllerListener(listener)
.setUri(uri)
.build();
imgFresco.setController(controller);
}
示例10: display
import com.facebook.drawee.controller.BaseControllerListener; //导入依赖的package包/类
public static void display(final PhotoDraweeView draweeView, Uri uri) {
PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder();
controller.setUri(uri);
controller.setOldController(draweeView.getController());
controller.setControllerListener(new BaseControllerListener<ImageInfo>() {
@Override
public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
super.onFinalImageSet(id, imageInfo, animatable);
if (imageInfo == null || draweeView == null) {
return;
}
draweeView.update(imageInfo.getWidth(), imageInfo.getHeight());
}
});
draweeView.setController(controller.build());
}
示例11: onCreate
import com.facebook.drawee.controller.BaseControllerListener; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String imageUrl = getIntent().getStringExtra(IMAGE_URL);
if (!TextUtils.isEmpty(imageUrl)) {
PipelineDraweeControllerBuilder builder = Fresco.newDraweeControllerBuilder();
builder.setUri(Uri.parse(imageUrl));
builder.setOldController(photoView.getController());
builder.setControllerListener(new BaseControllerListener<ImageInfo>() {
@Override
public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
super.onFinalImageSet(id, imageInfo, animatable);
if (imageInfo == null || photoView == null) {
return;
}
photoView.update(imageInfo.getWidth(), imageInfo.getHeight());
}
});
photoView.setController(builder.build());
}
}
示例12: onBindItemViewHolder
import com.facebook.drawee.controller.BaseControllerListener; //导入依赖的package包/类
@Override
public void onBindItemViewHolder(final ViewHolder holder, final int position) {
MediaEntity entity = getItem(position);
holder.mImageViewCover.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onItemClickListener.onItemClick(getItem(position));
}
});
holder.mTextViewLikesCount.setTextImageStart(18, R.mipmap.ic_thumb_up_gray_18dp, " " + entity.getLikes_count());
holder.mTextViewRecommendCaption.setText(entity.getCaption());
String url = entity.getCover_pic().replace("!thumb320", "");
DraweeController controller = Fresco.newDraweeControllerBuilder()
.setControllerListener(new BaseControllerListener<ImageInfo>() {
@Override
public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
float aspectRatio = (float)imageInfo.getWidth() / (float)imageInfo.getHeight();
holder.mImageViewCover.setAspectRatio(aspectRatio);
}
})
.setUri(Uri.parse(url))
.build();
holder.mImageViewCover.setController(controller);
AppUtils.loadSmallUserAvata(getItem(position).getUser(), holder.mImageViewAvatar);
}
示例13: init
import com.facebook.drawee.controller.BaseControllerListener; //导入依赖的package包/类
private void init() {
mInstrumentation = new Instrumentation(this);
if (mConfig.instrumentationEnabled) {
mListener = new BaseControllerListener<Object>() {
@Override
public void onSubmit(String id, Object callerContext) {
mInstrumentation.onStart();
}
@Override
public void onFinalImageSet(
String id,
@Nullable Object imageInfo,
@Nullable Animatable animatable) {
mInstrumentation.onSuccess();
}
@Override
public void onFailure(String id, Throwable throwable) {
mInstrumentation.onFailure();
}
@Override
public void onRelease(String id) {
mInstrumentation.onCancellation();
}
};
}
DraweeUtil.setBgColor(this, mConfig);
}
示例14: init
import com.facebook.drawee.controller.BaseControllerListener; //导入依赖的package包/类
@Override
protected void init() {
super.init();
transparentStatusBar();
ButterKnife.bind(this);
url = getIntent().getStringExtra("url");
PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder();
controller.setUri(Uri.parse(url));
controller.setAutoPlayAnimations(true);
controller.setOldController(photoDraweeView.getController());
controller.setControllerListener(new BaseControllerListener<ImageInfo>() {
@Override
public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
super.onFinalImageSet(id, imageInfo, animatable);
if (imageInfo == null || photoDraweeView == null) {
return;
}
photoDraweeView.update(imageInfo.getWidth(), imageInfo.getHeight());
normalScale = photoDraweeView.getScale();
}
});
photoDraweeView.setController(controller.build());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
String name = getIntent().getStringExtra("transition_name");
photoDraweeView.setTransitionName(name);
getWindow().setSharedElementEnterTransition(DraweeTransition.createTransitionSet(
ScalingUtils.ScaleType.CENTER_CROP, ScalingUtils.ScaleType.FIT_CENTER));
getWindow().setSharedElementReturnTransition(DraweeTransition.createTransitionSet(
ScalingUtils.ScaleType.FIT_CENTER, ScalingUtils.ScaleType.CENTER_CROP));
}
}
示例15: loadFileFromSdcard
import com.facebook.drawee.controller.BaseControllerListener; //导入依赖的package包/类
public static void loadFileFromSdcard(final Context context, final SimpleDraweeView draweeView, Uri loackUri, final int reqWidth, final int reqHeight) {
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(loackUri)
.setRotationOptions(RotationOptions.autoRotate())
.setLocalThumbnailPreviewsEnabled(true)
.setResizeOptions(new ResizeOptions(dip2px(context, 140), dip2px(context, 220)))
.build();
DraweeController controller = Fresco.newDraweeControllerBuilder()
.setImageRequest(request)
.setOldController(draweeView.getController())
.setTapToRetryEnabled(true)
.setControllerListener(new BaseControllerListener<ImageInfo>() {
@Override
public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable anim) {
if (imageInfo == null) {
return;
}
ViewGroup.LayoutParams layoutParams = draweeView.getLayoutParams();
int width = reqWidth;
int height = reqHeight;
int imgWidth = dip2px(context, 140);
int imgHight = dip2px(context, 220);
int bitScalew = getRatioSize(width, height, imgHight, imgWidth);
layoutParams.height = height / bitScalew;
layoutParams.width = width / bitScalew;
draweeView.requestLayout();
}
})
.setAutoPlayAnimations(true)
.build();
draweeView.setController(controller);
}