本文整理匯總了Java中com.facebook.drawee.generic.GenericDraweeHierarchyBuilder.build方法的典型用法代碼示例。如果您正苦於以下問題:Java GenericDraweeHierarchyBuilder.build方法的具體用法?Java GenericDraweeHierarchyBuilder.build怎麽用?Java GenericDraweeHierarchyBuilder.build使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.facebook.drawee.generic.GenericDraweeHierarchyBuilder
的用法示例。
在下文中一共展示了GenericDraweeHierarchyBuilder.build方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createDraweeHierarchy
import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; //導入方法依賴的package包/類
/**
* Creates the Hierarchy using the information into the Config
*
* @param context The Context
* @param config The Config object
* @return The Hierarchy to use
*/
public static GenericDraweeHierarchy createDraweeHierarchy(
final Context context,
final Config config) {
GenericDraweeHierarchyBuilder builder =
new GenericDraweeHierarchyBuilder(context.getResources())
.setFadeDuration(config.fadeDurationMs)
.setPlaceholderImage(Const.PLACEHOLDER)
.setFailureImage(Const.FAILURE)
.setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER);
applyScaleType(builder, config);
if (config.useRoundedCorners || config.drawBorder) {
final Resources res = context.getResources();
final RoundingParams roundingParams = new RoundingParams();
if (config.useRoundedCorners) {
roundingParams.setRoundingMethod(RoundingParams.RoundingMethod.BITMAP_ONLY);
roundingParams.setCornersRadius(res.getDimensionPixelSize(R.dimen.drawee_corner_radius));
roundingParams.setRoundAsCircle(config.useRoundedAsCircle);
}
if (config.drawBorder) {
//noinspection deprecation
roundingParams.setBorderColor(res.getColor(R.color.colorPrimary));
roundingParams.setBorderWidth(res.getDimensionPixelSize(R.dimen.drawee_border_width));
}
builder.setRoundingParams(roundingParams);
}
return builder.build();
}
示例2: frescoViewSetScaleType
import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; //導入方法依賴的package包/類
private void frescoViewSetScaleType(Context context, SimpleDraweeView mFrescoView){
GenericDraweeHierarchyBuilder builder =
new GenericDraweeHierarchyBuilder(context.getResources());
GenericDraweeHierarchy hierarchy = builder.build();
mFrescoView.setHierarchy(hierarchy);
switch (mScaleType) {
case FIT_XY:
hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.FIT_XY);
break;
case FIT_START:
hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.FIT_START);
break;
case FIT_CENTER:
hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER);
break;
case FIT_END:
hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.FIT_END);
break;
case CENTER:
hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.CENTER);
break;
case CENTER_CROP:
hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.CENTER_CROP);
break;
case CENTER_INSIDE:
hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.CENTER_INSIDE);
break;
}
}
示例3: getImageViewHierarchy
import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; //導入方法依賴的package包/類
/**
* 圖像選項類
* @param isRound 是否圓角
* @param radius 圓角角度
* @return
*/
public static GenericDraweeHierarchy getImageViewHierarchy(Resources resources, boolean isRound, float radius) {
GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(resources);
builder.setFailureImage(resources.getDrawable(R.drawable.ic_loading));
builder.setPlaceholderImage(resources.getDrawable(R.drawable.ic_loading));
builder.setFadeDuration(300);
if (isRound) {
RoundingParams roundingParams = RoundingParams.fromCornersRadius(radius);
builder.setRoundingParams(roundingParams);
}
return builder.build();
}
示例4: getSplashViewHierarchy
import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; //導入方法依賴的package包/類
/**
* splash界麵
* @param resources Resources
*/
public static GenericDraweeHierarchy getSplashViewHierarchy(Resources resources) {
GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(resources);
builder.setFailureImage(resources.getDrawable(R.drawable.transparent));
builder.setPlaceholderImage(resources.getDrawable(R.drawable.transparent));
builder.setFadeDuration(300);
return builder.build();
}
示例5: getImageProgHierarchy
import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; //導入方法依賴的package包/類
/**
* 圖像選項類
* @param resources Resources
* @param isRound 是否圓角
* @param radius 圓角角度
*/
public static GenericDraweeHierarchy getImageProgHierarchy(Resources resources, boolean isRound, float radius) {
GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(resources);
builder.setFailureImage(resources.getDrawable(R.drawable.ic_loading));
builder.setPlaceholderImage(resources.getDrawable(R.drawable.ic_loading));
// builder.setProgressBarImage(new CustomProgressbarDrawable());
builder.setFadeDuration(300);
if (isRound) {
RoundingParams roundingParams = RoundingParams.fromCornersRadius(radius);
builder.setRoundingParams(roundingParams);
}
return builder.build();
}
示例6: initView
import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; //導入方法依賴的package包/類
@Override
protected void initView() {
super.initView();
GenericDraweeHierarchyBuilder builder =
new GenericDraweeHierarchyBuilder(getResources());
GenericDraweeHierarchy hierarchy = builder
// .setProgressBarImage(getContext().getResources().getDrawable(R.drawable.default_loading))
// .setFailureImage(getContext().getResources().getDrawable(R.drawable.job_error))
.build();
mDraweeHolder = DraweeHolder.create(hierarchy, getContext());
setWillNotDraw(false);
}
示例7: getDraweeHierarchy
import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; //導入方法依賴的package包/類
private GenericDraweeHierarchy getDraweeHierarchy(PostItem item) {
GenericDraweeHierarchyBuilder builder =
new GenericDraweeHierarchyBuilder(getResources())
.setFadeDuration(300)
.setActualImageFocusPoint(new PointF(0.5f, 0f));
return builder.build();
}
示例8: fetchImage
import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; //導入方法依賴的package包/類
/**
* @param frescoPlusView The draweeView is to display the bitmap
* @param uri The source uri
* @param callback Listening to the success or failure
*/
private void fetchImage(FrescoPlusView frescoPlusView, Uri uri, FPFetchCallback<ImageInfo> callback) {
GenericDraweeHierarchyBuilder hierarchyBuilder = new GenericDraweeHierarchyBuilder(null);
hierarchyBuilder.setFadeDuration(fadeDuration);
hierarchyBuilder.setRoundingParams(RoundingParams.fromCornersRadius(radius));
hierarchyBuilder.setActualImageScaleType(scaleType);
if (defaultDrawable != null)
hierarchyBuilder.setPlaceholderImage(defaultDrawable, scaleType);
if (pressedDrawable != null)
hierarchyBuilder.setPressedStateOverlay(pressedDrawable);
if (retryDrawable != null)
hierarchyBuilder.setRetryImage(retryDrawable);
if (overlayDrawable != null)
hierarchyBuilder.setOverlay(overlayDrawable);
if (failureDrawable != null)
hierarchyBuilder.setFailureImage(failureDrawable, scaleType);
if (progressDrawable != null)
hierarchyBuilder.setProgressBarImage(progressDrawable);
GenericDraweeHierarchy hierarchy = hierarchyBuilder.build();
ImageRequestBuilder requestBuilder = ImageRequestBuilder.newBuilderWithSource(uri);
requestBuilder.setLowestPermittedRequestLevel(requestLevel);
requestBuilder.setAutoRotateEnabled(autoRotateEnabled);
if (postprocessor != null)
requestBuilder.setPostprocessor(postprocessor);
Priority priority = requestPriority == FrescoPriority.HIGH ? Priority.HIGH : Priority.MEDIUM;
requestBuilder.setRequestPriority(priority);
if (resizeWidth > 0 && resizeHeight > 0)
requestBuilder.setResizeOptions(new ResizeOptions(resizeWidth, resizeHeight));
ImageRequest imageRequest = requestBuilder.build();
DraweeController draweeController = FrescoPlusCore.newDraweeControllerBuilder()
.setOldController(frescoPlusView.getController())
.setAutoPlayAnimations(true)
.setRetainImageOnFailure(true)
.setTapToRetryEnabled(true)
.setImageRequest(imageRequest)
.setControllerListener(FetchImageControllerListenerSupplier.newInstance(callback))
.build();
frescoPlusView.setHierarchy(hierarchy);
frescoPlusView.setController(draweeController);
}