本文整理匯總了Java中com.facebook.drawee.generic.GenericDraweeHierarchyBuilder.setRoundingParams方法的典型用法代碼示例。如果您正苦於以下問題:Java GenericDraweeHierarchyBuilder.setRoundingParams方法的具體用法?Java GenericDraweeHierarchyBuilder.setRoundingParams怎麽用?Java GenericDraweeHierarchyBuilder.setRoundingParams使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.facebook.drawee.generic.GenericDraweeHierarchyBuilder
的用法示例。
在下文中一共展示了GenericDraweeHierarchyBuilder.setRoundingParams方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: 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();
}
示例3: 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();
}
示例4: 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);
}