本文整理汇总了Java中com.facebook.imagepipeline.image.ImageInfo类的典型用法代码示例。如果您正苦于以下问题:Java ImageInfo类的具体用法?Java ImageInfo怎么用?Java ImageInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ImageInfo类属于com.facebook.imagepipeline.image包,在下文中一共展示了ImageInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.facebook.imagepipeline.image.ImageInfo; //导入依赖的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);
}
示例2: loadImage
import com.facebook.imagepipeline.image.ImageInfo; //导入依赖的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());
}
示例3: loadImage
import com.facebook.imagepipeline.image.ImageInfo; //导入依赖的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());
}
示例4: getImageViewController
import com.facebook.imagepipeline.image.ImageInfo; //导入依赖的package包/类
/**
* 图像选项类
* @param uri 图片路径
* @param oldController DraweeView.getoldcontroller
* @param controllerListener 监听
* @return
*/
public static DraweeController getImageViewController(String uri, DraweeController oldController,
ControllerListener<ImageInfo> controllerListener) {
PipelineDraweeControllerBuilder builder = Fresco.newDraweeControllerBuilder();
if (!TextUtils.isEmpty(uri)) {
// Logger.d("StringUtils.utf8Encode(uri)"+StringUtils.utf8Encode(uri));
builder.setUri(Uri.parse(uri));
}
if (oldController != null) {
builder.setOldController(oldController);
}
if (controllerListener != null) {
builder.setControllerListener(controllerListener);
}
return builder.build();
}
示例5: showThumb
import com.facebook.imagepipeline.image.ImageInfo; //导入依赖的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) {
}
}
示例6: showResGif
import com.facebook.imagepipeline.image.ImageInfo; //导入依赖的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;
}
示例7: initLoad
import com.facebook.imagepipeline.image.ImageInfo; //导入依赖的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());
}
}
示例8: createDraweeController
import com.facebook.imagepipeline.image.ImageInfo; //导入依赖的package包/类
private DraweeController createDraweeController(
DraweeView draweeView, Uri uri, ControllerListener<ImageInfo> listener) {
JungleSize size = ImageLoaderUtils.getAppropriateSize(draweeView);
ImageRequest request = ImageRequestBuilder
.newBuilderWithSource(uri)
.setResizeOptions(new ResizeOptions(size.mWidth, size.mHeight))
.setAutoRotateEnabled(true)
.build();
return Fresco.newDraweeControllerBuilder()
.setUri(uri)
.setImageRequest(request)
.setControllerListener(listener)
.setAutoPlayAnimations(true)
.setOldController(draweeView.getController())
.build();
}
示例9: loadByFresco
import com.facebook.imagepipeline.image.ImageInfo; //导入依赖的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.imagepipeline.image.ImageInfo; //导入依赖的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: updateImageSize
import com.facebook.imagepipeline.image.ImageInfo; //导入依赖的package包/类
/**
* 更新图片的尺寸
* @param imageView
* @param imageInfo
*/
private void updateImageSize(SimpleDraweeView imageView, ImageInfo imageInfo){
if(imageInfo != null){
Log.d(TAG, "ImageInfo: width=" + imageInfo.getWidth() + ", height=" + imageInfo.getHeight());
ViewGroup.LayoutParams lp = imageView.getLayoutParams();
final int imageWidth = imageView.getMeasuredWidth();
final int imageHeight = imageView.getMeasuredHeight();
lp.width = imageWidth;
lp.height = imageWidth * imageInfo.getHeight() / imageInfo.getWidth();
imageView.setLayoutParams(lp);
imageView.setAspectRatio((float)imageInfo.getWidth() / imageInfo.getHeight());
}
}
示例12: onCreate
import com.facebook.imagepipeline.image.ImageInfo; //导入依赖的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());
}
}
示例13: onBindItemViewHolder
import com.facebook.imagepipeline.image.ImageInfo; //导入依赖的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);
}
示例14: onFinalImageSet
import com.facebook.imagepipeline.image.ImageInfo; //导入依赖的package包/类
@Override
public void onFinalImageSet(
String id,
ImageInfo imageInfo,
Animatable animatable) {
if (mEnableResizing &&
imageInfo != null &&
mDraweeSpan.getDraweeHolder().getTopLevelDrawable() != null) {
Drawable topLevelDrawable = mDraweeSpan.getDraweeHolder().getTopLevelDrawable();
Rect topLevelDrawableBounds = topLevelDrawable.getBounds();
if (mFixedHeight != UNSET_SIZE) {
float imageWidth = ((float) mFixedHeight / imageInfo.getHeight()) * imageInfo.getWidth();
int imageWidthPx = (int) imageWidth;
if (topLevelDrawableBounds.width() != imageWidthPx ||
topLevelDrawableBounds.height() != mFixedHeight) {
topLevelDrawable.setBounds(0, 0, imageWidthPx, mFixedHeight);
if (mDraweeSpanChangedListener != null) {
mDraweeSpanChangedListener.onDraweeSpanChanged(DraweeSpanStringBuilder.this);
}
}
} else if (topLevelDrawableBounds.width() != imageInfo.getWidth() ||
topLevelDrawableBounds.height() != imageInfo.getHeight()) {
topLevelDrawable.setBounds(0, 0, imageInfo.getWidth(), imageInfo.getHeight());
if (mDraweeSpanChangedListener != null) {
mDraweeSpanChangedListener.onDraweeSpanChanged(DraweeSpanStringBuilder.this);
}
}
}
}
示例15: init
import com.facebook.imagepipeline.image.ImageInfo; //导入依赖的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));
}
}