Skip to content

Commit

Permalink
Simplify newImageLoader implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Isira-Seneviratne committed Jun 26, 2024
1 parent 9c33445 commit c924175
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions app/src/main/java/org/schabi/newpipe/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,23 +125,18 @@ 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())
.diskCache(() -> new DiskCache.Builder()
.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(MainActivity.DEBUG ? new DebugLogger() : null)
.build();
}

protected Downloader getDownloader() {
Expand Down

0 comments on commit c924175

Please sign in to comment.