Skip to content

Commit

Permalink
feat(android): add image type to HippyDrawable
Browse files Browse the repository at this point in the history
  • Loading branch information
siguangli2018 authored and siguangli committed Aug 10, 2021
1 parent 1ea8fc1 commit cfe76c6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ public class HippyDrawable implements IDrawableTarget {
// 静态图片
private Bitmap mBitmap;

private String imageType;

public void setImageType(String type) {
imageType = type;
}

@Override
public String getImageType() {
return imageType;
}

public void setDrawable(Drawable drawable) {
mDrawable = drawable;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,11 @@ private void computeMatrixParams() {

@Override
protected void handleImageRequest(IDrawableTarget target, int sourceType, Object requestInfo) {
if (target instanceof HippyDrawable && ((HippyDrawable) target).isAnimated()) {
if (target != null && !TextUtils.isEmpty(target.getImageType())) {
mImageType = target.getImageType();
}

if (target instanceof HippyDrawable && ((HippyDrawable)target).isAnimated()) {
mGifMovie = ((HippyDrawable) target).getGIF();
setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public interface IDrawableTarget

Object getExtraData();

String getImageType();

void onDrawableAttached();

void onDrawableDetached();
Expand Down

0 comments on commit cfe76c6

Please sign in to comment.