本文整理匯總了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));
}
}