From 4096aaf47ea6f0341274e82fc14c5a3960a83f5f Mon Sep 17 00:00:00 2001 From: GitStart <1501599+gitstart@users.noreply.github.com> Date: Sat, 11 Feb 2023 19:04:14 +0100 Subject: Convert subscriptions screen to cards (#6261) --- .../danoeh/antennapod/ui/glide/ApGlideModule.java | 2 -- .../danoeh/antennapod/ui/glide/PaletteBitmap.java | 20 ----------- .../antennapod/ui/glide/PaletteBitmapResource.java | 40 ---------------------- .../ui/glide/PaletteBitmapTranscoder.java | 31 ----------------- 4 files changed, 93 deletions(-) delete mode 100644 ui/glide/src/main/java/de/danoeh/antennapod/ui/glide/PaletteBitmap.java delete mode 100644 ui/glide/src/main/java/de/danoeh/antennapod/ui/glide/PaletteBitmapResource.java delete mode 100644 ui/glide/src/main/java/de/danoeh/antennapod/ui/glide/PaletteBitmapTranscoder.java (limited to 'ui/glide') diff --git a/ui/glide/src/main/java/de/danoeh/antennapod/ui/glide/ApGlideModule.java b/ui/glide/src/main/java/de/danoeh/antennapod/ui/glide/ApGlideModule.java index d233fba14..132ed4901 100644 --- a/ui/glide/src/main/java/de/danoeh/antennapod/ui/glide/ApGlideModule.java +++ b/ui/glide/src/main/java/de/danoeh/antennapod/ui/glide/ApGlideModule.java @@ -2,7 +2,6 @@ package de.danoeh.antennapod.ui.glide; import android.annotation.SuppressLint; import android.content.Context; -import android.graphics.Bitmap; import android.util.Log; import androidx.annotation.NonNull; @@ -51,6 +50,5 @@ public class ApGlideModule extends AppGlideModule { registry.append(String.class, InputStream.class, new NoHttpStringLoader.StreamFactory()); registry.append(EmbeddedChapterImage.class, ByteBuffer.class, new ChapterImageModelLoader.Factory()); - registry.register(Bitmap.class, PaletteBitmap.class, new PaletteBitmapTranscoder()); } } diff --git a/ui/glide/src/main/java/de/danoeh/antennapod/ui/glide/PaletteBitmap.java b/ui/glide/src/main/java/de/danoeh/antennapod/ui/glide/PaletteBitmap.java deleted file mode 100644 index a3b590ba2..000000000 --- a/ui/glide/src/main/java/de/danoeh/antennapod/ui/glide/PaletteBitmap.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Source: https://github.com/bumptech/glide/wiki/Custom-targets#palette-example - */ - -package de.danoeh.antennapod.ui.glide; - -import android.graphics.Bitmap; - -import androidx.annotation.NonNull; -import androidx.palette.graphics.Palette; - -public class PaletteBitmap { - public final Palette palette; - public final Bitmap bitmap; - - public PaletteBitmap(@NonNull Bitmap bitmap, Palette palette) { - this.bitmap = bitmap; - this.palette = palette; - } -} \ No newline at end of file diff --git a/ui/glide/src/main/java/de/danoeh/antennapod/ui/glide/PaletteBitmapResource.java b/ui/glide/src/main/java/de/danoeh/antennapod/ui/glide/PaletteBitmapResource.java deleted file mode 100644 index 2fd18a0cb..000000000 --- a/ui/glide/src/main/java/de/danoeh/antennapod/ui/glide/PaletteBitmapResource.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Source: https://github.com/bumptech/glide/wiki/Custom-targets#palette-example - */ - -package de.danoeh.antennapod.ui.glide; - -import androidx.annotation.NonNull; - -import com.bumptech.glide.load.engine.Resource; -import com.bumptech.glide.util.Util; - -public class PaletteBitmapResource implements Resource { - private final PaletteBitmap paletteBitmap; - - public PaletteBitmapResource(@NonNull PaletteBitmap paletteBitmap) { - this.paletteBitmap = paletteBitmap; - } - - @NonNull - @Override - public Class getResourceClass() { - return PaletteBitmap.class; - } - - @NonNull - @Override - public PaletteBitmap get() { - return paletteBitmap; - } - - @Override - public int getSize() { - return Util.getBitmapByteSize(paletteBitmap.bitmap); - } - - @Override - public void recycle() { - paletteBitmap.bitmap.recycle(); - } -} \ No newline at end of file diff --git a/ui/glide/src/main/java/de/danoeh/antennapod/ui/glide/PaletteBitmapTranscoder.java b/ui/glide/src/main/java/de/danoeh/antennapod/ui/glide/PaletteBitmapTranscoder.java deleted file mode 100644 index bcb5f590a..000000000 --- a/ui/glide/src/main/java/de/danoeh/antennapod/ui/glide/PaletteBitmapTranscoder.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Source: https://github.com/bumptech/glide/wiki/Custom-targets#palette-example - */ - -package de.danoeh.antennapod.ui.glide; - -import android.graphics.Bitmap; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.palette.graphics.Palette; - -import com.bumptech.glide.load.Options; -import com.bumptech.glide.load.engine.Resource; -import com.bumptech.glide.load.resource.transcode.ResourceTranscoder; -import de.danoeh.antennapod.storage.preferences.UserPreferences; - -public class PaletteBitmapTranscoder implements ResourceTranscoder { - - @Nullable - @Override - public Resource transcode(@NonNull Resource toTranscode, @NonNull Options options) { - Bitmap bitmap = toTranscode.get(); - Palette palette = null; - if (UserPreferences.shouldShowSubscriptionTitle()) { - palette = new Palette.Builder(bitmap).generate(); - } - PaletteBitmap result = new PaletteBitmap(bitmap, palette); - return new PaletteBitmapResource(result); - } -} -- cgit v1.2.3