本文整理汇总了Java中com.facebook.drawee.generic.RoundingParams类的典型用法代码示例。如果您正苦于以下问题:Java RoundingParams类的具体用法?Java RoundingParams怎么用?Java RoundingParams使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RoundingParams类属于com.facebook.drawee.generic包,在下文中一共展示了RoundingParams类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: changeDraweeViewScaleType
import com.facebook.drawee.generic.RoundingParams; //导入依赖的package包/类
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);
}
示例2: 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);
}
});
}
示例3: 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);
}
示例4: 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);
}
}
示例5: getGenericDraweeHierarchy
import com.facebook.drawee.generic.RoundingParams; //导入依赖的package包/类
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;
}
示例6: init
import com.facebook.drawee.generic.RoundingParams; //导入依赖的package包/类
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);
}
示例7: getGenericDraweeHierarchy
import com.facebook.drawee.generic.RoundingParams; //导入依赖的package包/类
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;
}
示例8: applyRoundingBitmapOnly
import com.facebook.drawee.generic.RoundingParams; //导入依赖的package包/类
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;
}
示例9: applyRounding
import com.facebook.drawee.generic.RoundingParams; //导入依赖的package包/类
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;
}
示例10: init
import com.facebook.drawee.generic.RoundingParams; //导入依赖的package包/类
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);
}
示例11: getGenericDraweeHierarchy
import com.facebook.drawee.generic.RoundingParams; //导入依赖的package包/类
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;
}
示例12: 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);
}
示例13: 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();
}
示例14: cornersRadius
import com.facebook.drawee.generic.RoundingParams; //导入依赖的package包/类
public FrescoLoader cornersRadius(int radius) {
if (this.mRoundingParams == null) {
this.mRoundingParams = new RoundingParams();
}
this.mRoundingParams.setCornersRadius(radius);
return this;
}
示例15: border
import com.facebook.drawee.generic.RoundingParams; //导入依赖的package包/类
public FrescoLoader border(int borderColor, float borderWidth) {
if (this.mRoundingParams == null) {
this.mRoundingParams = new RoundingParams();
}
this.mRoundingParams.setBorder(borderColor, borderWidth);
return this;
}