From ce8b5e31d7c8ee8e98725142b9c22c478f78cefd Mon Sep 17 00:00:00 2001 From: fightyz Date: Tue, 13 Apr 2021 04:01:54 +0800 Subject: [PATCH] TranscoderRegistry.getTranscodeClasses method should return registered transcode classes --- .../glide/load/resource/transcode/TranscoderRegistry.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/library/src/main/java/com/bumptech/glide/load/resource/transcode/TranscoderRegistry.java b/library/src/main/java/com/bumptech/glide/load/resource/transcode/TranscoderRegistry.java index 18bd05f16d..7802604115 100644 --- a/library/src/main/java/com/bumptech/glide/load/resource/transcode/TranscoderRegistry.java +++ b/library/src/main/java/com/bumptech/glide/load/resource/transcode/TranscoderRegistry.java @@ -60,6 +60,7 @@ public synchronized ResourceTranscoder get( } @NonNull + @SuppressWarnings("unchecked") public synchronized List> getTranscodeClasses( @NonNull Class resourceClass, @NonNull Class transcodeClass) { List> transcodeClasses = new ArrayList<>(); @@ -70,8 +71,9 @@ public synchronized List> getTranscodeClasses( } for (Entry entry : transcoders) { - if (entry.handles(resourceClass, transcodeClass)) { - transcodeClasses.add(transcodeClass); + if (entry.handles(resourceClass, transcodeClass) + && !transcodeClasses.contains((Class) entry.toClass)) { + transcodeClasses.add((Class) entry.toClass); } }