use of com.facebook.drawee.generic.GenericDraweeHierarchyBuilder in project GalleryFinal by pengjianbo.
the class FrescoImageLoader method displayImage.
@Override
public void displayImage(Activity activity, String path, final GFImageView imageView, final Drawable defaultDrawable, int width, int height) {
Resources resources = context.getResources();
GenericDraweeHierarchy hierarchy = new GenericDraweeHierarchyBuilder(resources).setFadeDuration(300).setPlaceholderImage(defaultDrawable).setFailureImage(defaultDrawable).setProgressBarImage(new ProgressBarDrawable()).build();
final DraweeHolder<GenericDraweeHierarchy> draweeHolder = DraweeHolder.create(hierarchy, context);
imageView.setOnImageViewListener(new GFImageView.OnImageViewListener() {
@Override
public void onDetach() {
draweeHolder.onDetach();
}
@Override
public void onAttach() {
draweeHolder.onAttach();
}
@Override
public boolean verifyDrawable(Drawable dr) {
if (dr == draweeHolder.getHierarchy().getTopLevelDrawable()) {
return true;
}
return false;
}
@Override
public void onDraw(Canvas canvas) {
Drawable drawable = draweeHolder.getHierarchy().getTopLevelDrawable();
if (drawable == null) {
imageView.setImageDrawable(defaultDrawable);
} else {
imageView.setImageDrawable(drawable);
}
}
});
Uri uri = new Uri.Builder().scheme(UriUtil.LOCAL_FILE_SCHEME).path(path).build();
ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(uri).setResizeOptions(//图片目标大小
new ResizeOptions(width, height)).build();
DraweeController controller = Fresco.newDraweeControllerBuilder().setOldController(draweeHolder.getController()).setImageRequest(imageRequest).build();
draweeHolder.setController(controller);
}
use of com.facebook.drawee.generic.GenericDraweeHierarchyBuilder in project actor-platform by actorapp.
the class DialogView method initStyles.
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);
}
use of com.facebook.drawee.generic.GenericDraweeHierarchyBuilder in project actor-platform by actorapp.
the class BackgroundPreviewView method init.
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);
}
use of com.facebook.drawee.generic.GenericDraweeHierarchyBuilder in project actor-platform by actorapp.
the class AvatarView method init.
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)).build();
setHierarchy(hierarchy);
}
use of com.facebook.drawee.generic.GenericDraweeHierarchyBuilder in project actor-platform by actorapp.
the class StickerView method init.
private void init() {
builder = new GenericDraweeHierarchyBuilder(getResources());
GenericDraweeHierarchy hierarchy = builder.setFadeDuration(200).setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER).build();
setHierarchy(hierarchy);
fastThumbLoader = new FastThumbLoader(this);
}
Aggregations