當前位置: 首頁>>代碼示例>>Java>>正文


Java GenericDraweeHierarchyBuilder.setRoundingParams方法代碼示例

本文整理匯總了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();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:39,代碼來源:DraweeUtil.java

示例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();
}
 
開發者ID:lizubing1992,項目名稱:Li-MVPArms,代碼行數:18,代碼來源:FrescoHelper.java

示例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();
	}
 
開發者ID:lizubing1992,項目名稱:Li-MVPArms,代碼行數:19,代碼來源:FrescoHelper.java

示例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);
}
 
開發者ID:Sunzxyong,項目名稱:FrescoPlus,代碼行數:47,代碼來源:FrescoPlusFetcher.java


注:本文中的com.facebook.drawee.generic.GenericDraweeHierarchyBuilder.setRoundingParams方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。