File tree Expand file tree Collapse file tree
app/src/main/java/org/schabi/newpipe Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package org .schabi .newpipe ;
22
3+ import android .app .ActivityManager ;
34import android .app .Application ;
45import android .content .Context ;
56import android .content .SharedPreferences ;
89import androidx .annotation .NonNull ;
910import androidx .core .app .NotificationChannelCompat ;
1011import androidx .core .app .NotificationManagerCompat ;
12+ import androidx .core .content .ContextCompat ;
1113import androidx .preference .PreferenceManager ;
1214
1315import com .jakewharton .processphoenix .ProcessPhoenix ;
@@ -123,6 +125,8 @@ public void onCreate() {
123125 @ NonNull
124126 @ Override
125127 public ImageLoader newImageLoader () {
128+ final var isLowRamDevice = ContextCompat .getSystemService (this , ActivityManager .class )
129+ .isLowRamDevice ();
126130 final var builder = new ImageLoader .Builder (this )
127131 .memoryCache (() -> new MemoryCache .Builder (this )
128132 .maxSizeBytes (10 * 1024 * 1024 )
@@ -131,7 +135,7 @@ public ImageLoader newImageLoader() {
131135 .directory (new File (getExternalCacheDir (), "coil" ))
132136 .maxSizeBytes (50 * 1024 * 1024 )
133137 .build ())
134- .allowRgb565 (true );
138+ .allowRgb565 (isLowRamDevice );
135139
136140 if (MainActivity .DEBUG ) {
137141 builder .logger (new DebugLogger ());
You can’t perform that action at this time.
0 commit comments