penfeizhou / APNG4Android

Android animation support for APNG & Animated WebP & Gif & Animated AVIF, High performance
Apache License 2.0
570 stars 75 forks source link

Glide 支持 DiskCacheStrategy.ALL 和 DiskCacheStrategy.RESOURCE 示意代码 #213

Closed tudou0digua closed 2 months ago

tudou0digua commented 6 months ago

@GlideModule public class GlideAnimationModule extends LibraryGlideModule { @Override public void registerComponents(@NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) { super.registerComponents(context, glide, registry); ....... registry.append(FrameSeqDecoder.class, new ApngDrawableEncoder()); } }

public class ApngDrawableEncoder implements ResourceEncoder {

@NonNull
@Override
public EncodeStrategy getEncodeStrategy(@NonNull Options options) {
    return EncodeStrategy.SOURCE;
}

@Override
public boolean encode(@NonNull Resource<FrameSeqDecoder> data, @NonNull File file, @NonNull Options options) {
    return false;
}

}

大佬看看这个demo是否有啥问题