Java 类com.facebook.drawee.generic.RoundingParams 实例源码

项目:GitHub    文件:DraweeRoundedCornersFragment.java   
private void changeDraweeViewScaleType(
    SimpleDraweeView draweeView,
    ScaleType scaleType,
    @Nullable PointF focusPoint) {
  final GenericDraweeHierarchy hierarchy = draweeView.getHierarchy();
  hierarchy.setActualImageScaleType(scaleType);
  hierarchy.setActualImageFocusPoint(focusPoint != null ? focusPoint : new PointF(0.5f, 0.5f));

  final RoundingParams roundingParams = Preconditions.checkNotNull(hierarchy.getRoundingParams());
  if (BITMAP_ONLY_SCALETYPES.contains(scaleType)) {
    roundingParams.setRoundingMethod(RoundingParams.RoundingMethod.BITMAP_ONLY);
  } else {
    roundingParams.setOverlayColor(mWindowBackgroundColor);
  }
  hierarchy.setRoundingParams(roundingParams);
}
项目:PotRoom    文件:MessageViewHolder.java   
public void bind(final Message message, final OnClickMessageListener mListener) {

        imageUser.setImageURI(Uri.parse(message.getUrlAvatar()));

        RoundingParams roundingParams = new RoundingParams();
        roundingParams.setRoundAsCircle(true);

        if (!message.isRead()) {
            roundingParams.setBorderColor(ContextCompat.getColor(imageUser.getContext(), R.color.colorAccent));
            roundingParams.setBorderWidth(5f);
        }
        else {
            roundingParams.setBorderWidth(0);
        }

        imageUser.getHierarchy().setRoundingParams(roundingParams);

        imageUser.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mListener.onClickMessage(message);
            }
        });
    }
项目:react-native-udesk    文件:UdeskUtil.java   
public static void loadHeadView(Context context, SimpleDraweeView simpleDraweeView, Uri httpUri) {
    //初始化圆角圆形参数对象
    RoundingParams rp = new RoundingParams();
    //设置图像是否为圆形
    rp.setRoundAsCircle(true);

    final GenericDraweeHierarchy hierarchy = new GenericDraweeHierarchyBuilder(context.getResources())
            .setRoundingParams(rp)
            .build();

    DraweeController controller = Fresco.newDraweeControllerBuilder()
            .setUri(httpUri)
            .setTapToRetryEnabled(true)
            .setOldController(simpleDraweeView.getController())
            .build();
    simpleDraweeView.setHierarchy(hierarchy);
    simpleDraweeView.setController(controller);
}
项目:Open-Quran-Radio    文件:MainActivity.java   
private void fillUserProfileData() {
    SimpleDraweeView imageView = (SimpleDraweeView) navigationView.getHeaderView(0).findViewById(R.id.imageView);
    TextView txtUserProfileName = (TextView) navigationView.getHeaderView(0).findViewById(R.id.txtUserProfileName);
    TextView txtProfileEmail = (TextView) navigationView.getHeaderView(0).findViewById(R.id.txtProfileEmail);


    // Check if user is signed in (non-null) and update UI accordingly.
    FirebaseUser currentUser = mAuth.getCurrentUser();
    // Name, email address, and profile photo Url
    txtUserProfileName.setText(currentUser.getDisplayName());
    txtProfileEmail.setText(currentUser.getEmail());
    Uri photoUrl = currentUser.getPhotoUrl();

    //set round icon
    if (photoUrl != null) {
        int color = ContextCompat.getColor(this, R.color.colorPrimary);
        RoundingParams roundingParams = RoundingParams.fromCornersRadius(5f);
        roundingParams.setBorder(color, 1.0f);
        roundingParams.setRoundAsCircle(true);
        imageView.getHierarchy().setRoundingParams(roundingParams);
        imageView.setImageURI(photoUrl);//.setImageBitmap(stationImageSmall);
    }
}
项目:Li-MVPArms    文件:ConfigConstants.java   
public static GenericDraweeHierarchy getGenericDraweeHierarchy(Context context){
      GenericDraweeHierarchy gdh = new GenericDraweeHierarchyBuilder(context.getResources())
//            .reset()//重置
//            .setActualImageColorFilter(colorFilter)//颜色过滤
//            .setActualImageFocusPoint(focusPoint)//focusCrop, 需要指定一个居中点
//            .setActualImageMatrix(actualImageMatrix)
//            .setActualImageScaleType(actualImageScaleType)//fresco:actualImageScaleType="focusCrop"缩放类型
//            .setBackground(background)//fresco:backgroundImage="@color/blue"背景图片
//            .setBackgrounds(backgrounds)
//            .setFadeDuration(fadeDuration)//fresco:fadeDuration="300"加载图片动画时间
              .setFailureImage(ConfigConstants.sErrorDrawable)//fresco:failureImage="@drawable/error"失败图
//            .setFailureImage(failureDrawable, failureImageScaleType)//fresco:failureImageScaleType="centerInside"失败图缩放类型
//            .setOverlay(overlay)//fresco:overlayImage="@drawable/watermark"叠加图
//            .setOverlays(overlays)
              .setPlaceholderImage(ConfigConstants.sPlaceholderDrawable)//fresco:placeholderImage="@color/wait_color"占位图
//            .setPlaceholderImage(placeholderDrawable, placeholderImageScaleType)//fresco:placeholderImageScaleType="fitCenter"占位图缩放类型
//            .setPressedStateOverlay(drawable)//fresco:pressedStateOverlayImage="@color/red"按压状态下的叠加图
              .setProgressBarImage(new ProgressBarDrawable())//进度条fresco:progressBarImage="@drawable/progress_bar"进度条
//            .setProgressBarImage(progressBarImage, progressBarImageScaleType)//fresco:progressBarImageScaleType="centerInside"进度条类型
//            .setRetryImage(retryDrawable)//fresco:retryImage="@drawable/retrying"点击重新加载
//            .setRetryImage(retryDrawable, retryImageScaleType)//fresco:retryImageScaleType="centerCrop"点击重新加载缩放类型
              .setRoundingParams(RoundingParams.asCircle())//圆形/圆角fresco:roundAsCircle="true"圆形
              .build();
      return gdh;
  }
项目:actor-platform    文件:AvatarView.java   
public void init(int size, float placeholderTextSize) {
    this.size = size;
    this.placeholderTextSize = placeholderTextSize;

    GenericDraweeHierarchyBuilder builder =
            new GenericDraweeHierarchyBuilder(getResources());

    GenericDraweeHierarchy hierarchy = builder
            .setFadeDuration(200)
            .setRoundingParams(new RoundingParams()
                    .setRoundAsCircle(true)
                    .setRoundingMethod(RoundingParams.RoundingMethod.BITMAP_ONLY))
            //.setActualImageColorFilter(new PorterDuffColorFilter(0x19000000, PorterDuff.Mode.MULTIPLY))
            //.setOverlay(new AvatarBorderDrawable())
            .build();
    setHierarchy(hierarchy);
}
项目:android-support-learn    文件:PApplication.java   
public static GenericDraweeHierarchy getGenericDraweeHierarchy(Context context){
        GenericDraweeHierarchy gdh = new GenericDraweeHierarchyBuilder(context.getResources())
//            .reset()//重置
//            .setActualImageColorFilter(colorFilter)//颜色过滤
//            .setActualImageFocusPoint(focusPoint)//focusCrop, 需要指定一个居中点
//            .setActualImageMatrix(actualImageMatrix)
//            .setActualImageScaleType(actualImageScaleType)//fresco:actualImageScaleType="focusCrop"缩放类型
//            .setBackground(background)//fresco:backgroundImage="@color/blue"背景图片
//            .setBackgrounds(backgrounds)
//            .setFadeDuration(fadeDuration)//fresco:fadeDuration="300"加载图片动画时间
         //       .setFailureImage(ConfigConstants.sErrorDrawable)//fresco:failureImage="@drawable/error"失败图
//            .setFailureImage(failureDrawable, failureImageScaleType)//fresco:failureImageScaleType="centerInside"失败图缩放类型
//            .setOverlay(overlay)//fresco:overlayImage="@drawable/watermark"叠加图
//            .setOverlays(overlays)
            //    .setPlaceholderImage(ConfigConstants.sPlaceholderDrawable)//fresco:placeholderImage="@color/wait_color"占位图
//            .setPlaceholderImage(placeholderDrawable, placeholderImageScaleType)//fresco:placeholderImageScaleType="fitCenter"占位图缩放类型
//            .setPressedStateOverlay(drawable)//fresco:pressedStateOverlayImage="@color/red"按压状态下的叠加图
                .setProgressBarImage(new ProgressBarDrawable())//进度条fresco:progressBarImage="@drawable/progress_bar"进度条
//            .setProgressBarImage(progressBarImage, progressBarImageScaleType)//fresco:progressBarImageScaleType="centerInside"进度条类型
//            .setRetryImage(retryDrawable)//fresco:retryImage="@drawable/retrying"点击重新加载
//            .setRetryImage(retryDrawable, retryImageScaleType)//fresco:retryImageScaleType="centerCrop"点击重新加载缩放类型
                .setRoundingParams(RoundingParams.asCircle())//圆形/圆角fresco:roundAsCircle="true"圆形
                .build();
        return gdh;
    }
项目:fresco    文件:DraweeRoundedCornersFragment.java   
private void changeDraweeViewScaleType(
    SimpleDraweeView draweeView,
    ScaleType scaleType,
    @Nullable PointF focusPoint) {
  final GenericDraweeHierarchy hierarchy = draweeView.getHierarchy();
  hierarchy.setActualImageScaleType(scaleType);
  hierarchy.setActualImageFocusPoint(focusPoint != null ? focusPoint : new PointF(0.5f, 0.5f));

  final RoundingParams roundingParams = Preconditions.checkNotNull(hierarchy.getRoundingParams());
  if (BITMAP_ONLY_SCALETYPES.contains(scaleType)) {
    roundingParams.setRoundingMethod(RoundingParams.RoundingMethod.BITMAP_ONLY);
  } else {
    roundingParams.setOverlayColor(mWindowBackgroundColor);
  }
  hierarchy.setRoundingParams(roundingParams);
}
项目:S1-Go    文件:ImageLoader.java   
public static Drawable applyRoundingBitmapOnly(
        @Nullable RoundingParams roundingParams,
        Resources resources,
        Drawable drawable) {
    if (roundingParams == null ||
            roundingParams.getRoundingMethod() != RoundingParams.RoundingMethod.BITMAP_ONLY) {
        return drawable;
    }

    if (drawable instanceof BitmapDrawable || drawable instanceof ColorDrawable) {
        return applyRounding(roundingParams, resources, drawable);
    } else {
        Drawable parent = drawable;
        Drawable child = parent.getCurrent();
        while (child != null && parent != child) {
            if (parent instanceof ForwardingDrawable &&
                    (child instanceof BitmapDrawable || child instanceof ColorDrawable)) {
                ((ForwardingDrawable) parent).setCurrent(
                        applyRounding(roundingParams, resources, child));
            }
            parent = child;
            child = parent.getCurrent();
        }
    }
    return drawable;
}
项目:S1-Go    文件:ImageLoader.java   
public static Drawable applyRounding(
        @Nullable RoundingParams roundingParams,
        Resources resources,
        Drawable drawable) {
    if (drawable instanceof BitmapDrawable) {
        RoundedBitmapDrawable roundedBitmapDrawable =
                RoundedBitmapDrawable.fromBitmapDrawable(resources, (BitmapDrawable) drawable);
        applyRoundingParams(roundedBitmapDrawable, roundingParams);
        return roundedBitmapDrawable;
    }
    if (drawable instanceof ColorDrawable &&
            Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        RoundedColorDrawable roundedColorDrawable =
                RoundedColorDrawable.fromColorDrawable((ColorDrawable) drawable);
        applyRoundingParams(roundedColorDrawable, roundingParams);
        return roundedColorDrawable;
    }
    return drawable;
}
项目:africhat-platform-0.1    文件:AvatarView.java   
public void init(int size, float placeholderTextSize) {
    this.size = size;
    this.placeholderTextSize = placeholderTextSize;

    GenericDraweeHierarchyBuilder builder =
            new GenericDraweeHierarchyBuilder(getResources());

    GenericDraweeHierarchy hierarchy = builder
            .setFadeDuration(200)
            .setRoundingParams(new RoundingParams()
                    .setRoundAsCircle(true)
                    .setRoundingMethod(RoundingParams.RoundingMethod.BITMAP_ONLY))
                    // .setOverlay(new AvatarBorderDrawable())
            .build();
    setHierarchy(hierarchy);
}
项目:BlueBoard    文件:FrescoConfig.java   
public static GenericDraweeHierarchy getGenericDraweeHierarchy(Context context) {
        GenericDraweeHierarchy gdh = new GenericDraweeHierarchyBuilder(context.getResources())
//            .reset()//重置
//            .setActualImageColorFilter(colorFilter)//颜色过滤
//            .setActualImageFocusPoint(focusPoint)//focusCrop, 需要指定一个居中点
//            .setActualImageMatrix(actualImageMatrix)
//            .setActualImageScaleType(actualImageScaleType)//fresco:actualImageScaleType="focusCrop"缩放类型
//            .setBackground(background)//fresco:backgroundImage="@color/blue"背景图片
//            .setBackgrounds(backgrounds)
//            .setFadeDuration(fadeDuration)//fresco:fadeDuration="300"加载图片动画时间
                .setFailureImage(FrescoConfig.sErrorDrawable)//fresco:failureImage="@drawable/error"失败图
//            .setFailureImage(failureDrawable, failureImageScaleType)//fresco:failureImageScaleType="centerInside"失败图缩放类型
//            .setOverlay(overlay)//fresco:overlayImage="@drawable/watermark"叠加图
//            .setOverlays(overlays)
                .setPlaceholderImage(FrescoConfig.sPlaceholderDrawable)//fresco:placeholderImage="@color/wait_color"占位图
//            .setPlaceholderImage(placeholderDrawable, placeholderImageScaleType)//fresco:placeholderImageScaleType="fitCenter"占位图缩放类型
//            .setPressedStateOverlay(drawable)//fresco:pressedStateOverlayImage="@color/red"按压状态下的叠加图
                .setProgressBarImage(new ProgressBarDrawable())//进度条fresco:progressBarImage="@drawable/progress_bar"进度条
//            .setProgressBarImage(progressBarImage, progressBarImageScaleType)//fresco:progressBarImageScaleType="centerInside"进度条类型
//            .setRetryImage(retryDrawable)//fresco:retryImage="@drawable/retrying"点击重新加载
//            .setRetryImage(retryDrawable, retryImageScaleType)//fresco:retryImageScaleType="centerCrop"点击重新加载缩放类型
                .setRoundingParams(RoundingParams.asCircle())//圆形/圆角fresco:roundAsCircle="true"圆形
                .build();
        return gdh;
    }
项目:GitHub    文件:DraweeRoundedCornersFragment.java   
private void setShowBorder(SimpleDraweeView draweeView, boolean show) {
  final RoundingParams roundingParams =
      Preconditions.checkNotNull(draweeView.getHierarchy().getRoundingParams());
  if (show) {
    roundingParams.setBorder(
        mColorPrimary,
        getResources().getDimensionPixelSize(R.dimen.drawee_rounded_corners_border_width));
  } else {
    roundingParams.setBorder(Color.TRANSPARENT, 0);
  }
  draweeView.getHierarchy().setRoundingParams(roundingParams);
}
项目:GitHub    文件:DraweeUtil.java   
/**
 * 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();
}
项目:FrescoLoader    文件:FrescoLoader.java   
public FrescoLoader cornersRadius(int radius) {
    if (this.mRoundingParams == null) {
        this.mRoundingParams = new RoundingParams();
    }
    this.mRoundingParams.setCornersRadius(radius);
    return this;
}
项目:FrescoLoader    文件:FrescoLoader.java   
public FrescoLoader border(int borderColor, float borderWidth) {
    if (this.mRoundingParams == null) {
        this.mRoundingParams = new RoundingParams();
    }
    this.mRoundingParams.setBorder(borderColor, borderWidth);
    return this;
}
项目:FrescoLoader    文件:FrescoLoader.java   
public FrescoLoader roundAsCircle() {
    if (this.mRoundingParams == null) {
        this.mRoundingParams = new RoundingParams();
    }
    this.mRoundingParams.setRoundAsCircle(true);
    return this;
}
项目:FrescoLoader    文件:FrescoLoader.java   
public FrescoLoader cornersRadii(float topLeft, float topRight, float bottomRight, float bottomLeft) {
    if (this.mRoundingParams == null) {
        this.mRoundingParams = new RoundingParams();
    }
    this.mRoundingParams.setCornersRadii(topLeft, topRight, bottomRight, bottomLeft);
    return this;
}
项目:FrescoLoader    文件:FrescoLoader.java   
public FrescoLoader cornersRadii(float[] radii) {
    if (this.mRoundingParams == null) {
        this.mRoundingParams = new RoundingParams();
    }
    this.mRoundingParams.setCornersRadii(radii);
    return this;
}
项目:FrescoLoader    文件:FrescoLoader.java   
public FrescoLoader roundingMethodWithOverlayColor() {
    if (this.mRoundingParams == null) {
        this.mRoundingParams = new RoundingParams();
    }
    this.mRoundingParams.setRoundingMethod(RoundingParams.RoundingMethod.OVERLAY_COLOR);
    return this;
}
项目:FrescoLoader    文件:FrescoLoader.java   
public FrescoLoader roundingMethodWithBitmapOnly() {
    if (this.mRoundingParams == null) {
        this.mRoundingParams = new RoundingParams();
    }
    this.mRoundingParams.setRoundingMethod(RoundingParams.RoundingMethod.BITMAP_ONLY);
    return this;
}
项目:JD-Test    文件:ImageLoaderUtil.java   
/**
 * 设置图片的原角半径(原来为圆角的不能修改为圆圈,反之亦然)
 * @param radius 圆角半径
 * @return this
 */
public ImageLoaderUtil setRoundingParams(float radius){
    RoundingParams roundingParams = hierarchy.getRoundingParams();
    if(roundingParams == null){
        hierarchy.setRoundingParams(new RoundingParams().setCornersRadius(radius));
    }else{
        roundingParams.setCornersRadius(radius);
        hierarchy.setRoundingParams(roundingParams);
    }

    return this;
}
项目:JD-Test    文件:CircleImageView.java   
/**
 * 使用代码设置为圆圈形状
 */
private void initCircleImage() {
    GenericDraweeHierarchy hierarchy = getHierarchy();
    if(hierarchy != null){
        hierarchy.setRoundingParams(new RoundingParams().setRoundAsCircle(true));
        setHierarchy(hierarchy);
    }
}
项目:GongXianSheng    文件:FrecoFactory.java   
public void setDefaultHierarchy(DraweeView draweeView, Drawable defaultDrawable, ScalingUtils.ScaleType defaultScaleType, ScalingUtils.ScaleType targerScaleType, boolean isCircle) {
        GenericDraweeHierarchy gdh = new GenericDraweeHierarchyBuilder( mContext.getResources())
                .setPlaceholderImage(defaultDrawable, defaultScaleType)
                .setFailureImage(defaultDrawable, ScalingUtils.ScaleType.CENTER_CROP)
//              .setProgressBarImage(new ProgressBarDrawable())
                .setActualImageScaleType(targerScaleType)
                .build();
        if ( isCircle ) {
            gdh.setRoundingParams(RoundingParams.asCircle());
        }
        draweeView.setHierarchy(gdh);
    }
项目:Li-MVPArms    文件:FrescoHelper.java   
/**
 * 图像选项类
 * @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();
}
项目:Li-MVPArms    文件:FrescoHelper.java   
/**
     * 图像选项类
     * @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();
    }
项目:Li-MVPArms    文件:FrescoHelper.java   
/**
 * 图像选项类
 * @param resources Resources
 * @param isCircle 是否圆圈
 */
public static GenericDraweeHierarchy getImageViewHierarchy(Resources resources, boolean isCircle) {
    GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(resources);
    builder.setFailureImage(resources.getDrawable(R.drawable.defalut_avatar), ScaleType.FIT_XY);
    builder.setPlaceholderImage(resources.getDrawable(R.drawable.defalut_avatar));
    builder.setFadeDuration(300);
    if (isCircle) {
        RoundingParams circleParams = RoundingParams.asCircle();
        circleParams.setBorder(R.color.black_avart_magin, 1.0f);
        circleParams.setRoundAsCircle(true);
        builder.setRoundingParams(circleParams);
    }
    return builder.build();
}
项目:Li-MVPArms    文件:ConfigConstants.java   
public static RoundingParams getRoundingParams(){
      RoundingParams roundingParams = RoundingParams.fromCornersRadius(7f);
//    roundingParams.asCircle();//圆形
//    roundingParams.setBorder(color, width);//fresco:roundingBorderWidth="2dp"边框  fresco:roundingBorderColor="@color/border_color"
//    roundingParams.setCornersRadii(radii);//半径
//    roundingParams.setCornersRadii(topLeft, topRight, bottomRight, bottomLeft)//fresco:roundTopLeft="true" fresco:roundTopRight="false" fresco:roundBottomLeft="false" fresco:roundBottomRight="true"
//    roundingParams. setCornersRadius(radius);//fresco:roundedCornerRadius="1dp"圆角
//    roundingParams.setOverlayColor(overlayColor);//fresco:roundWithOverlayColor="@color/corner_color"
//    roundingParams.setRoundAsCircle(roundAsCircle);//圆
//    roundingParams.setRoundingMethod(roundingMethod);
//    fresco:progressBarAutoRotateInterval="1000"自动旋转间隔
      // 或用 fromCornersRadii 以及 asCircle 方法
      return roundingParams;
  }
项目:collapselrecycler    文件:GalleryActivity.java   
/**
 * 加载头像
 */
public void loadImg(){
    GenericDraweeHierarchy hierarchy = GenericDraweeHierarchyBuilder.newInstance(getResources())
            .setRoundingParams(RoundingParams.asCircle())
            .build();
    sdv.setHierarchy(hierarchy);
    DraweeController controller = Fresco.newDraweeControllerBuilder()
            .setUri(Uri.parse(url))
            .build();
    sdv.setController(controller);
}
项目:Fishing    文件:DateDetailActivity.java   
@Override
public void setData(Date data) {
    getExpansion().dismissProgressPage();
    avatar.setImageURI(Uri.parse(data.getAuthorAvatar()));
    name.setText(data.getAuthorName());
    title.setText(data.getTitle());
    strTitle = data.getTitle();
    time.setText(new JTimeTransform(data.getTime()).toString(new JTimeTransform.RecentDateFormat()));
    dateTime.setText(new SimpleDateFormat("yyyy年MM月dd日").format(new java.util.Date(data.getAcTime())));
    content.setText(data.getContent());
    int uid = AccountModel.getInstance().getAccount().getUID();
    for (PersonBrief personBrief : data.getEnrollMember()) {
        if (personBrief.getUID() == uid) {
            joined = true;
            join.setText("进入");
        }
        SimpleDraweeView draweeView = new SimpleDraweeView(DateDetailActivity.this);
        draweeView.setLayoutParams(new ViewGroup.LayoutParams(JUtils.dip2px(40), JUtils.dip2px(40)));
        draweeView.setImageURI(Uri.parse(personBrief.getAvatar()));
        draweeView.getHierarchy().setRoundingParams(RoundingParams.asCircle());
        draweeView.setOnClickListener(v -> {
            Intent i = new Intent(DateDetailActivity.this, UserDetailActivity.class);
            i.putExtra("id", personBrief.getUID());
            startActivity(i);
        });
        joinMember.addView(draweeView);
    }
}
项目:actor-platform    文件:BackgroundPreviewView.java   
public void init(int width, int height, int corenerRadius) {
    this.width = width;
    this.height = height;

    GenericDraweeHierarchyBuilder builder =
            new GenericDraweeHierarchyBuilder(getResources());

    GenericDraweeHierarchy hierarchy = builder
            .setFadeDuration(200)
            .setRoundingParams(new RoundingParams()
                    .setCornersRadius(corenerRadius)
                    .setRoundingMethod(RoundingParams.RoundingMethod.BITMAP_ONLY))
            .build();
    setHierarchy(hierarchy);
}
项目:actor-platform    文件:LocationHolder.java   
public LocationHolder(MessagesAdapter adapter, View itemView, Peer peer) {
    super(adapter, itemView, false);
    this.context = adapter.getMessagesFragment().getActivity();

    COLOR_PENDING = ActorSDK.sharedActor().style.getConvMediaStatePendingColor();
    COLOR_SENT = ActorSDK.sharedActor().style.getConvMediaStateSentColor();
    COLOR_RECEIVED = ActorSDK.sharedActor().style.getConvMediaStateDeliveredColor();
    COLOR_READ = ActorSDK.sharedActor().style.getConvMediaStateReadColor();
    COLOR_ERROR = ActorSDK.sharedActor().style.getConvMediaStateErrorColor();

    messageBubble = (FrameLayout) itemView.findViewById(R.id.bubbleContainer);

    // Content
    previewView = (SimpleDraweeView) itemView.findViewById(R.id.image);
    GenericDraweeHierarchyBuilder builder =
            new GenericDraweeHierarchyBuilder(context.getResources());

    GenericDraweeHierarchy hierarchy = builder
            .setFadeDuration(200)
            .setRoundingParams(new RoundingParams()
                    .setCornersRadius(Screen.dp(2))
                    .setRoundingMethod(RoundingParams.RoundingMethod.BITMAP_ONLY))
            .build();
    previewView.setHierarchy(hierarchy);

    time = (TextView) itemView.findViewById(R.id.time);

    stateIcon = (TintImageView) itemView.findViewById(R.id.stateIcon);
    onConfigureViewHolder();
}
项目:actor-platform    文件:DialogView.java   
protected void initStyles() {
        GenericDraweeHierarchy hierarchy = new GenericDraweeHierarchyBuilder(getResources())
                .setFadeDuration(0)
                .setRoundingParams(new RoundingParams()
                        .setRoundAsCircle(true))
                .build();
        draweeHolder = DraweeHolder.create(hierarchy, getContext());
        draweeHolder.getTopLevelDrawable().setCallback(this);

        setLayoutParams(new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, Screen.dp(72)));
        setDividerPaddingLeft(Screen.dp(72));

//        setLayerType(LAYER_TYPE_HARDWARE, null);
    }
项目:android-support-learn    文件:PApplication.java   
public static RoundingParams getRoundingParams(){
        RoundingParams roundingParams = RoundingParams.fromCornersRadius(7f);
//    roundingParams.asCircle();//圆形
//    roundingParams.setBorder(color, width);//fresco:roundingBorderWidth="2dp"边框  fresco:roundingBorderColor="@color/border_color"
//    roundingParams.setCornersRadii(radii);//半径
//    roundingParams.setCornersRadii(topLeft, topRight, bottomRight, bottomLeft)//fresco:roundTopLeft="true" fresco:roundTopRight="false" fresco:roundBottomLeft="false" fresco:roundBottomRight="true"
//    roundingParams. setCornersRadius(radius);//fresco:roundedCornerRadius="1dp"圆角
//    roundingParams.setOverlayColor(overlayColor);//fresco:roundWithOverlayColor="@color/corner_color"
//    roundingParams.setRoundAsCircle(roundAsCircle);//圆
//    roundingParams.setRoundingMethod(roundingMethod);
//    fresco:progressBarAutoRotateInterval="1000"自动旋转间隔
        // 或用 fromCornersRadii 以及 asCircle 方法
        return roundingParams;
    }
项目:fresco    文件:DraweeRoundedCornersFragment.java   
private void setShowBorder(SimpleDraweeView draweeView, boolean show, boolean scaleInside) {
  final RoundingParams roundingParams =
      Preconditions.checkNotNull(draweeView.getHierarchy().getRoundingParams());
  if (show) {
    roundingParams.setBorder(
        mColorPrimary,
        getResources().getDimensionPixelSize(R.dimen.drawee_rounded_corners_border_width));
    roundingParams.setScaleDownInsideBorders(scaleInside);
  } else {
    roundingParams.setBorder(Color.TRANSPARENT, 0);
  }
  draweeView.getHierarchy().setRoundingParams(roundingParams);
}
项目:fresco    文件:DraweeUtil.java   
/**
 * 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();
}
项目:S1-Go    文件:ImageLoader.java   
private static void applyRoundingParams(Rounded rounded, RoundingParams roundingParams) {
    rounded.setCircle(roundingParams.getRoundAsCircle());
    rounded.setRadii(roundingParams.getCornersRadii());
    rounded.setBorder(
            roundingParams.getBorderColor(),
            roundingParams.getBorderWidth());
}
项目:africhat-platform-0.1    文件:PhotoHolder.java   
public PhotoHolder(MessagesAdapter fragment, View itemView) {
    super(fragment, itemView, false);
    this.context = fragment.getMessagesFragment().getActivity();

    COLOR_PENDING = context.getResources().getColor(R.color.conv_media_state_pending);
    COLOR_SENT = context.getResources().getColor(R.color.conv_media_state_sent);
    COLOR_RECEIVED = context.getResources().getColor(R.color.conv_media_state_delivered);
    COLOR_READ = context.getResources().getColor(R.color.conv_media_state_read);
    COLOR_ERROR = context.getResources().getColor(R.color.conv_media_state_error);

    messageBubble = (FrameLayout) itemView.findViewById(R.id.bubbleContainer);
    overlay = itemView.findViewById(R.id.photoOverlay);

    // Content
    previewView = (SimpleDraweeView) itemView.findViewById(R.id.image);
    GenericDraweeHierarchyBuilder builder =
            new GenericDraweeHierarchyBuilder(context.getResources());

    GenericDraweeHierarchy hierarchy = builder
            .setFadeDuration(200)
            .setRoundingParams(new RoundingParams()
                    .setCornersRadius(Screen.dp(2))
                    .setRoundingMethod(RoundingParams.RoundingMethod.BITMAP_ONLY))
            .build();
    previewView.setHierarchy(hierarchy);

    fastThumbLoader = new FastThumbLoader(previewView);
    time = (TextView) itemView.findViewById(R.id.time);
    duration = (TextView) itemView.findViewById(R.id.duration);

    stateIcon = (TintImageView) itemView.findViewById(R.id.stateIcon);

    progressContainer = itemView.findViewById(R.id.progressBg);
    progressValue = (TextView) itemView.findViewById(R.id.progressValue);
    progressView = (CircularView) itemView.findViewById(R.id.progressView);
    progressView.setColor(Color.WHITE);
    progressIcon = (ImageView) itemView.findViewById(R.id.contentIcon);
}
项目:BlueBoard    文件:FrescoConfig.java   
public static RoundingParams getRoundingParams() {
        RoundingParams roundingParams = RoundingParams.fromCornersRadius(7f);
//    roundingParams.asCircle();//圆形
//    roundingParams.setBorder(color, width);//fresco:roundingBorderWidth="2dp"边框  fresco:roundingBorderColor="@color/border_color"
//    roundingParams.setCornersRadii(radii);//半径
//    roundingParams.setCornersRadii(topLeft, topRight, bottomRight, bottomLeft)//fresco:roundTopLeft="true" fresco:roundTopRight="false" fresco:roundBottomLeft="false" fresco:roundBottomRight="true"
//    roundingParams. setCornersRadius(radius);//fresco:roundedCornerRadius="1dp"圆角
//    roundingParams.setOverlayColor(overlayColor);//fresco:roundWithOverlayColor="@color/corner_color"
//    roundingParams.setRoundAsCircle(roundAsCircle);//圆
//    roundingParams.setRoundingMethod(roundingMethod);
//    fresco:progressBarAutoRotateInterval="1000"自动旋转间隔
        // 或用 fromCornersRadii 以及 asCircle 方法
        return roundingParams;
    }
项目:FinalProject    文件:FrescoImageView.java   
@Override
public void setRoundingParmas(RoundingParams roundingParmas) {
    this.getHierarchy().setRoundingParams(roundingParmas);
}