From 1747c22a04529dd0548d9126bceea29a6e7eae8c Mon Sep 17 00:00:00 2001 From: Isira Seneviratne Date: Wed, 26 Jun 2024 09:57:44 +0530 Subject: [PATCH] Simplify newImageLoader implementation --- app/src/main/java/org/schabi/newpipe/App.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/App.java b/app/src/main/java/org/schabi/newpipe/App.java index 68ae0ca53fa..216a5b19f13 100644 --- a/app/src/main/java/org/schabi/newpipe/App.java +++ b/app/src/main/java/org/schabi/newpipe/App.java @@ -125,9 +125,7 @@ public void onCreate() { @NonNull @Override public ImageLoader newImageLoader() { - final var isLowRamDevice = ContextCompat.getSystemService(this, ActivityManager.class) - .isLowRamDevice(); - final var builder = new ImageLoader.Builder(this) + return new ImageLoader.Builder(this) .memoryCache(() -> new MemoryCache.Builder(this) .maxSizeBytes(10 * 1024 * 1024) .build()) @@ -135,13 +133,10 @@ public ImageLoader newImageLoader() { .directory(new File(getExternalCacheDir(), "coil")) .maxSizeBytes(50 * 1024 * 1024) .build()) - .allowRgb565(isLowRamDevice); - - if (MainActivity.DEBUG) { - builder.logger(new DebugLogger()); - } - - return builder.build(); + .allowRgb565(ContextCompat.getSystemService(this, ActivityManager.class) + .isLowRamDevice()) + .logger(BuildConfig.DEBUG ? new DebugLogger() : null) + .build(); } protected Downloader getDownloader() {