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


Java RoundingParams.setBorder方法代码示例

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


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

示例1: 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

示例2: setShowBorder

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

示例3: 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

示例4: setShowBorder

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

示例5: maybeUpdateView

import com.facebook.drawee.generic.RoundingParams; //导入方法依赖的package包/类
public void maybeUpdateView() {
  if (!mIsDirty) {
    return;
  }

  boolean doResize = shouldResize(mUri);
  if (doResize && (getWidth() <= 0 || getHeight() <=0)) {
    // If need a resize and the size is not yet set, wait until the layout pass provides one
    return;
  }

  GenericDraweeHierarchy hierarchy = getHierarchy();
  hierarchy.setActualImageScaleType(mScaleType);

  if (mLoadingImageDrawable != null) {
    hierarchy.setPlaceholderImage(mLoadingImageDrawable, ScalingUtils.ScaleType.CENTER);
  }

  boolean usePostprocessorScaling =
      mScaleType != ScalingUtils.ScaleType.CENTER_CROP &&
      mScaleType != ScalingUtils.ScaleType.FOCUS_CROP;
  float hierarchyRadius = usePostprocessorScaling ? 0 : mBorderRadius;

  RoundingParams roundingParams = hierarchy.getRoundingParams();
  roundingParams.setCornersRadius(hierarchyRadius);
  roundingParams.setBorder(mBorderColor, mBorderWidth);
  if (mOverlayColor != Color.TRANSPARENT) {
      roundingParams.setOverlayColor(mOverlayColor);
  } else {
      // make sure the default rounding method is used.
      roundingParams.setRoundingMethod(RoundingParams.RoundingMethod.BITMAP_ONLY);
  }
  hierarchy.setRoundingParams(roundingParams);
  hierarchy.setFadeDuration(
      mFadeDurationMs >= 0
          ? mFadeDurationMs
          : mIsLocalImage ? 0 : REMOTE_IMAGE_FADE_DURATION_MS);

  Postprocessor postprocessor = usePostprocessorScaling ? mRoundedCornerPostprocessor : null;

  ResizeOptions resizeOptions = doResize ? new ResizeOptions(getWidth(), getHeight()) : null;

  ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(mUri)
      .setPostprocessor(postprocessor)
      .setResizeOptions(resizeOptions)
      .setAutoRotateEnabled(true)
      .setProgressiveRenderingEnabled(mProgressiveRenderingEnabled)
      .build();

  // This builder is reused
  mDraweeControllerBuilder.reset();

  mDraweeControllerBuilder
      .setAutoPlayAnimations(true)
      .setCallerContext(mCallerContext)
      .setOldController(getController())
      .setImageRequest(imageRequest);

  if (mControllerListener != null && mControllerForTesting != null) {
    ForwardingControllerListener combinedListener = new ForwardingControllerListener();
    combinedListener.addListener(mControllerListener);
    combinedListener.addListener(mControllerForTesting);
    mDraweeControllerBuilder.setControllerListener(combinedListener);
  } else if (mControllerForTesting != null) {
    mDraweeControllerBuilder.setControllerListener(mControllerForTesting);
  } else if (mControllerListener != null) {
    mDraweeControllerBuilder.setControllerListener(mControllerListener);
  }

  setController(mDraweeControllerBuilder.build());
  mIsDirty = false;
}
 
开发者ID:john1jan,项目名称:ReactNativeSignatureExample,代码行数:73,代码来源:ReactImageView.java

示例6: maybeUpdateView

import com.facebook.drawee.generic.RoundingParams; //导入方法依赖的package包/类
public void maybeUpdateView() {
  if (!mIsDirty) {
    return;
  }

  boolean doResize = shouldResize(mUri);
  if (doResize && (getWidth() <= 0 || getHeight() <=0)) {
    // If need a resize and the size is not yet set, wait until the layout pass provides one
    return;
  }

  GenericDraweeHierarchy hierarchy = getHierarchy();
  hierarchy.setActualImageScaleType(mScaleType);

  if (mLoadingImageDrawable != null) {
    hierarchy.setPlaceholderImage(mLoadingImageDrawable, ScalingUtils.ScaleType.CENTER);
  }

  boolean usePostprocessorScaling =
      mScaleType != ScalingUtils.ScaleType.CENTER_CROP &&
      mScaleType != ScalingUtils.ScaleType.FOCUS_CROP;

  RoundingParams roundingParams = hierarchy.getRoundingParams();

  if (usePostprocessorScaling) {
    roundingParams.setCornersRadius(0);
  } else {
    cornerRadii(sComputedCornerRadii);

    roundingParams.setCornersRadii(sComputedCornerRadii[0], sComputedCornerRadii[1], sComputedCornerRadii[2], sComputedCornerRadii[3]);
  }

  roundingParams.setBorder(mBorderColor, mBorderWidth);
  if (mOverlayColor != Color.TRANSPARENT) {
      roundingParams.setOverlayColor(mOverlayColor);
  } else {
      // make sure the default rounding method is used.
      roundingParams.setRoundingMethod(RoundingParams.RoundingMethod.BITMAP_ONLY);
  }
  hierarchy.setRoundingParams(roundingParams);
  hierarchy.setFadeDuration(
      mFadeDurationMs >= 0
          ? mFadeDurationMs
          : mIsLocalImage ? 0 : REMOTE_IMAGE_FADE_DURATION_MS);

  Postprocessor postprocessor = usePostprocessorScaling ? mRoundedCornerPostprocessor : null;

  ResizeOptions resizeOptions = doResize ? new ResizeOptions(getWidth(), getHeight()) : null;

  ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(mUri)
      .setPostprocessor(postprocessor)
      .setResizeOptions(resizeOptions)
      .setAutoRotateEnabled(true)
      .setProgressiveRenderingEnabled(mProgressiveRenderingEnabled)
      .build();

  // This builder is reused
  mDraweeControllerBuilder.reset();

  mDraweeControllerBuilder
      .setAutoPlayAnimations(true)
      .setCallerContext(mCallerContext)
      .setOldController(getController())
      .setImageRequest(imageRequest);

  if (mControllerListener != null && mControllerForTesting != null) {
    ForwardingControllerListener combinedListener = new ForwardingControllerListener();
    combinedListener.addListener(mControllerListener);
    combinedListener.addListener(mControllerForTesting);
    mDraweeControllerBuilder.setControllerListener(combinedListener);
  } else if (mControllerForTesting != null) {
    mDraweeControllerBuilder.setControllerListener(mControllerForTesting);
  } else if (mControllerListener != null) {
    mDraweeControllerBuilder.setControllerListener(mControllerListener);
  }

  setController(mDraweeControllerBuilder.build());
  mIsDirty = false;
}
 
开发者ID:ManrajGrover,项目名称:react-native-box-loaders,代码行数:80,代码来源:ReactImageView.java

示例7: maybeUpdateView

import com.facebook.drawee.generic.RoundingParams; //导入方法依赖的package包/类
public void maybeUpdateView() {
        if (!mIsDirty) {
            return;
        }

        boolean doResize = shouldResize(mUri);
        if (doResize && (getWidth() <= 0 || getHeight() <=0)) {
            // If need a resize and the size is not yet set, wait until the layout pass provides one
            return;
        }

        GenericDraweeHierarchy hierarchy = getHierarchy();
        hierarchy.setActualImageScaleType(mScaleType);

        if (mLoadingImageDrawable != null) {
//            hierarchy.setPlaceholderImage(mLoadingImageDrawable, ScalingUtils.ScaleType.CENTER);
        }

        boolean usePostprocessorScaling =
                mScaleType != ScalingUtils.ScaleType.CENTER_CROP &&
                        mScaleType != ScalingUtils.ScaleType.FOCUS_CROP;
        float hierarchyRadius = usePostprocessorScaling ? 0 : mBorderRadius;

        RoundingParams roundingParams = hierarchy.getRoundingParams();
        roundingParams.setCornersRadius(hierarchyRadius);
        roundingParams.setBorder(mBorderColor, mBorderWidth);
        hierarchy.setRoundingParams(roundingParams);
        hierarchy.setFadeDuration(
                mFadeDurationMs >= 0
                        ? mFadeDurationMs
                        : mIsLocalImage ? 0 : REMOTE_IMAGE_FADE_DURATION_MS);

        Postprocessor postprocessor = usePostprocessorScaling ? mRoundedCornerPostprocessor : null;
        Postprocessor redMeshPostprocessor = new redMeshPostprocessor();

        ResizeOptions resizeOptions = doResize ? new ResizeOptions(getWidth(), getHeight()) : null;

        ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(mUri)
                .setPostprocessor(redMeshPostprocessor)
                .setResizeOptions(resizeOptions)
                .setAutoRotateEnabled(true)
                .setProgressiveRenderingEnabled(mProgressiveRenderingEnabled)
                .build();

        // This builder is reused
        mDraweeControllerBuilder.reset();

        mDraweeControllerBuilder
                .setAutoPlayAnimations(true)
                .setCallerContext(mCallerContext)
                .setOldController(getController())
                .setImageRequest(imageRequest);

        if (mControllerListener != null && mControllerForTesting != null) {
            ForwardingControllerListener combinedListener = new ForwardingControllerListener();
            combinedListener.addListener(mControllerListener);
            combinedListener.addListener(mControllerForTesting);
            mDraweeControllerBuilder.setControllerListener(combinedListener);
        } else if (mControllerForTesting != null) {
            mDraweeControllerBuilder.setControllerListener(mControllerForTesting);
        } else if (mControllerListener != null) {
            mDraweeControllerBuilder.setControllerListener(mControllerListener);
        }

        setController(mDraweeControllerBuilder.build());
        mIsDirty = false;
    }
 
开发者ID:NorthFoxz,项目名称:react-native-imagewand,代码行数:68,代码来源:RNImageWand.java

示例8: maybeUpdateView

import com.facebook.drawee.generic.RoundingParams; //导入方法依赖的package包/类
public void maybeUpdateView() {
    if (!mIsDirty) {
        return;
    }

    boolean doResize = shouldResize(mUri);
    if (doResize && (getWidth() <= 0 || getHeight() <= 0)) {
        // If need a resize and the size is not yet set, wait until the layout pass provides one
        return;
    }

    GenericDraweeHierarchy hierarchy = getHierarchy();
    hierarchy.setActualImageScaleType(mScaleType);

    if (mLoadingImageDrawable != null) {
        hierarchy.setPlaceholderImage(mLoadingImageDrawable, ScalingUtils.ScaleType.CENTER);
    }

    boolean usePostprocessorScaling =
            mScaleType != ScalingUtils.ScaleType.CENTER_CROP &&
                    mScaleType != ScalingUtils.ScaleType.FOCUS_CROP;
    float hierarchyRadius = usePostprocessorScaling ? 0 : mBorderRadius;

    RoundingParams roundingParams = hierarchy.getRoundingParams();
    roundingParams.setCornersRadius(hierarchyRadius);
    roundingParams.setBorder(mBorderColor, mBorderWidth);
    if (mOverlayColor != Color.TRANSPARENT) {
        roundingParams.setOverlayColor(mOverlayColor);
    } else {
        // make sure the default rounding method is used.
        roundingParams.setRoundingMethod(RoundingParams.RoundingMethod.BITMAP_ONLY);
    }
    hierarchy.setRoundingParams(roundingParams);
    hierarchy.setFadeDuration(
            mFadeDurationMs >= 0
                    ? mFadeDurationMs
                    : mIsLocalImage ? 0 : REMOTE_IMAGE_FADE_DURATION_MS);

    Postprocessor postprocessor = usePostprocessorScaling ? mRoundedCornerPostprocessor : null;

    ResizeOptions resizeOptions = doResize ? new ResizeOptions(getWidth(), getHeight()) : null;

    ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(mUri)
            .setPostprocessor(postprocessor)
            .setResizeOptions(resizeOptions)
            .setAutoRotateEnabled(true)
            .setProgressiveRenderingEnabled(mProgressiveRenderingEnabled)
            .build();

    // This builder is reused
    mDraweeControllerBuilder.reset();

    mDraweeControllerBuilder
            .setAutoPlayAnimations(true)
            .setCallerContext(mCallerContext)
            .setOldController(getController())
            .setImageRequest(imageRequest);

    if (mControllerListener != null && mControllerForTesting != null) {
        ForwardingControllerListener combinedListener = new ForwardingControllerListener();
        combinedListener.addListener(mControllerListener);
        combinedListener.addListener(mControllerForTesting);
        mDraweeControllerBuilder.setControllerListener(combinedListener);
    } else if (mControllerForTesting != null) {
        mDraweeControllerBuilder.setControllerListener(mControllerForTesting);
    } else if (mControllerListener != null) {
        mDraweeControllerBuilder.setControllerListener(mControllerListener);
    }

    setController(mDraweeControllerBuilder.build());
    mIsDirty = false;
}
 
开发者ID:bylevel,项目名称:react-native-image-android,代码行数:73,代码来源:ImageAndroidView.java

示例9: 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.setBorder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。