当前位置: 首页>>代码示例>>Java>>正文


Java RoundingParams.setRoundAsCircle方法代码示例

本文整理汇总了Java中com.facebook.drawee.generic.RoundingParams.setRoundAsCircle方法的典型用法代码示例。如果您正苦于以下问题:Java RoundingParams.setRoundAsCircle方法的具体用法?Java RoundingParams.setRoundAsCircle怎么用?Java RoundingParams.setRoundAsCircle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.facebook.drawee.generic.RoundingParams的用法示例。


在下文中一共展示了RoundingParams.setRoundAsCircle方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: bind

import com.facebook.drawee.generic.RoundingParams; //导入方法依赖的package包/类
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);
            }
        });
    }
 
开发者ID:BackPackerDz,项目名称:PotRoom,代码行数:25,代码来源:MessageViewHolder.java

示例2: loadHeadView

import com.facebook.drawee.generic.RoundingParams; //导入方法依赖的package包/类
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);
}
 
开发者ID:lennyup,项目名称:react-native-udesk,代码行数:19,代码来源:UdeskUtil.java

示例3: fillUserProfileData

import com.facebook.drawee.generic.RoundingParams; //导入方法依赖的package包/类
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);
    }
}
 
开发者ID:malah-code,项目名称:Open-Quran-Radio,代码行数:24,代码来源:MainActivity.java

示例4: createDraweeHierarchy

import com.facebook.drawee.generic.RoundingParams; //导入方法依赖的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

示例5: getImageViewHierarchy

import com.facebook.drawee.generic.RoundingParams; //导入方法依赖的package包/类
/**
 * 图像选项类
 * @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();
}
 
开发者ID:lizubing1992,项目名称:Li-MVPArms,代码行数:19,代码来源:FrescoHelper.java

示例6: initView

import com.facebook.drawee.generic.RoundingParams; //导入方法依赖的package包/类
private void initView() {

        //获取SimpleDraweeView
        sdv = (SimpleDraweeView) findViewById(R.id.main_sdv);

        //初始化圆角圆形参数对象
        RoundingParams rp = new RoundingParams();
        //设置图像是否为圆形
        rp.setRoundAsCircle(true);
        //设置圆角半径
        //rp.setCornersRadius(20);
        //分别设置左上角、右上角、左下角、右下角的圆角半径
        //rp.setCornersRadii(20,25,30,35);
        //分别设置(前2个)左上角、(3、4)右上角、(5、6)左下角、(7、8)右下角的圆角半径
        //rp.setCornersRadii(new float[]{20,25,30,35,40,45,50,55});
        //设置边框颜色及其宽度
        rp.setBorder(Color.BLACK, 10);
        //设置叠加颜色
        rp.setOverlayColor(Color.GRAY);
        //设置圆形圆角模式
        //rp.setRoundingMethod(RoundingParams.RoundingMethod.BITMAP_ONLY);
        //设置圆形圆角模式
        rp.setRoundingMethod(RoundingParams.RoundingMethod.OVERLAY_COLOR);

        //获取GenericDraweeHierarchy对象
        GenericDraweeHierarchy hierarchy = GenericDraweeHierarchyBuilder.newInstance(getResources())
                //设置圆形圆角参数
                .setRoundingParams(rp)
                //设置圆角半径
                //.setRoundingParams(RoundingParams.fromCornersRadius(20))
                //分别设置左上角、右上角、左下角、右下角的圆角半径
                //.setRoundingParams(RoundingParams.fromCornersRadii(20,25,30,35))
                //分别设置(前2个)左上角、(3、4)右上角、(5、6)左下角、(7、8)右下角的圆角半径
                //.setRoundingParams(RoundingParams.fromCornersRadii(new float[]{20,25,30,35,40,45,50,55}))
                //设置圆形圆角参数;RoundingParams.asCircle()是将图像设置成圆形
                //.setRoundingParams(RoundingParams.asCircle())
                //设置淡入淡出动画持续时间(单位:毫秒ms)
                .setFadeDuration(5000)
                //构建
                .build();

        //设置Hierarchy
        sdv.setHierarchy(hierarchy);

        //构建Controller
        DraweeController controller = Fresco.newDraweeControllerBuilder()
                //设置需要下载的图片地址
                .setUri(imageUrl)
                //设置点击重试是否开启
                .setTapToRetryEnabled(true)
                //构建
                .build();

        //设置Controller
        sdv.setController(controller);
    }
 
开发者ID:scp504677840,项目名称:Fresco,代码行数:57,代码来源:MainActivity.java


注:本文中的com.facebook.drawee.generic.RoundingParams.setRoundAsCircle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。