mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-10-27 05:17:38 +00:00
Simplify newImageLoader implementation
This commit is contained in:
@@ -125,9 +125,7 @@ public class App extends Application implements ImageLoaderFactory {
|
|||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public ImageLoader newImageLoader() {
|
public ImageLoader newImageLoader() {
|
||||||
final var isLowRamDevice = ContextCompat.getSystemService(this, ActivityManager.class)
|
return new ImageLoader.Builder(this)
|
||||||
.isLowRamDevice();
|
|
||||||
final var builder = new ImageLoader.Builder(this)
|
|
||||||
.memoryCache(() -> new MemoryCache.Builder(this)
|
.memoryCache(() -> new MemoryCache.Builder(this)
|
||||||
.maxSizeBytes(10 * 1024 * 1024)
|
.maxSizeBytes(10 * 1024 * 1024)
|
||||||
.build())
|
.build())
|
||||||
@@ -135,13 +133,10 @@ public class App extends Application implements ImageLoaderFactory {
|
|||||||
.directory(new File(getExternalCacheDir(), "coil"))
|
.directory(new File(getExternalCacheDir(), "coil"))
|
||||||
.maxSizeBytes(50 * 1024 * 1024)
|
.maxSizeBytes(50 * 1024 * 1024)
|
||||||
.build())
|
.build())
|
||||||
.allowRgb565(isLowRamDevice);
|
.allowRgb565(ContextCompat.getSystemService(this, ActivityManager.class)
|
||||||
|
.isLowRamDevice())
|
||||||
if (MainActivity.DEBUG) {
|
.logger(BuildConfig.DEBUG ? new DebugLogger() : null)
|
||||||
builder.logger(new DebugLogger());
|
.build();
|
||||||
}
|
|
||||||
|
|
||||||
return builder.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Downloader getDownloader() {
|
protected Downloader getDownloader() {
|
||||||
|
|||||||
Reference in New Issue
Block a user