use of com.facebook.drawee.generic.GenericDraweeHierarchy 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.GenericDraweeHierarchy 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);
}
use of com.facebook.drawee.generic.GenericDraweeHierarchy 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.GenericDraweeHierarchy in project Rocket.Chat.Android by RocketChat.
the class RocketChatAvatar method loadImage.
public void loadImage(String url, Drawable placeholder) {
final GenericDraweeHierarchy hierarchy = draweeView.getHierarchy();
hierarchy.setPlaceholderImage(placeholder);
hierarchy.setFailureImage(placeholder);
final DraweeController controller = Fresco.newDraweeControllerBuilder().setUri(Uri.parse(url)).setAutoPlayAnimations(true).build();
draweeView.setController(controller);
}
use of com.facebook.drawee.generic.GenericDraweeHierarchy in project ride-read-android by Ride-Read.
the class FrescoImgLoader method displayImage.
@Override
public void displayImage(Activity activity, Context context, String path, final GalleryImageView imageView, int width, int height) {
GenericDraweeHierarchy hierarchy = // 占位图
new GenericDraweeHierarchyBuilder(context.getResources()).setFadeDuration(300).setPlaceholderImage(R.mipmap.gallery_pick_photo).setFailureImage(// 加载失败图
R.mipmap.gallery_pick_photo).setProgressBarImage(// loading
new ProgressBarDrawable()).build();
final DraweeHolder<GenericDraweeHierarchy> draweeHolder = DraweeHolder.create(hierarchy, context);
imageView.setOnImageViewListener(new GalleryImageView.OnImageViewListener() {
@Override
public void onDraw(Canvas canvas) {
Drawable drawable = draweeHolder.getHierarchy().getTopLevelDrawable();
if (drawable == null) {
imageView.setImageResource(R.mipmap.gallery_pick_photo);
} else {
imageView.setImageDrawable(drawable);
}
}
@Override
public boolean verifyDrawable(Drawable dr) {
return dr == draweeHolder.getHierarchy().getTopLevelDrawable();
}
@Override
public void onDetach() {
draweeHolder.onDetach();
}
@Override
public void onAttach() {
draweeHolder.onAttach();
}
});
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);
}
Aggregations