diff --git a/app/src/main/java/org/schabi/newpipe/App.java b/app/src/main/java/org/schabi/newpipe/App.java index 2ae21137f..3a22bf511 100644 --- a/app/src/main/java/org/schabi/newpipe/App.java +++ b/app/src/main/java/org/schabi/newpipe/App.java @@ -11,8 +11,6 @@ import android.os.Build; import android.util.Log; import com.nostra13.universalimageloader.cache.memory.impl.LRULimitedMemoryCache; -import com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache; -import com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache; import com.nostra13.universalimageloader.core.ImageLoader; import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; @@ -83,7 +81,7 @@ public class App extends Application { initNotificationChannel(); // Initialize image loader - ImageLoader.getInstance().init(getImageLoaderConfigurations(10)); + ImageLoader.getInstance().init(getImageLoaderConfigurations(10, 50)); configureRxJavaErrorHandler(); } @@ -121,9 +119,11 @@ public class App extends Application { }); } - private ImageLoaderConfiguration getImageLoaderConfigurations(final int memoryCacheSizeMb) { + private ImageLoaderConfiguration getImageLoaderConfigurations(final int memoryCacheSizeMb, + final int diskCacheSizeMb) { return new ImageLoaderConfiguration.Builder(this) .memoryCache(new LRULimitedMemoryCache(memoryCacheSizeMb * 1024 * 1024)) + .diskCacheSize(diskCacheSizeMb * 1024 * 1024) .build(); } diff --git a/app/src/main/java/org/schabi/newpipe/fragments/local/LocalPlaylistFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/local/LocalPlaylistFragment.java index 058dc43b2..ea7242055 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/local/LocalPlaylistFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/local/LocalPlaylistFragment.java @@ -35,6 +35,7 @@ import org.schabi.newpipe.util.NavigationHelper; import org.schabi.newpipe.util.OnClickGesture; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; @@ -289,6 +290,8 @@ public class LocalPlaylistFragment extends BaseLocalListFragment result) { super.handleResult(result); + if (itemListAdapter == null) return; + itemListAdapter.clearStreamItemList(); if (result.isEmpty()) { @@ -349,7 +352,7 @@ public class LocalPlaylistFragment extends BaseLocalListFragment + .setPositiveButton(R.string.rename, (dialogInterface, i) -> changePlaylistName(nameEdit.getText().toString()) ); @@ -382,6 +385,8 @@ public class LocalPlaylistFragment extends BaseLocalListFragment infoItems = itemListAdapter.getItemsList(); List streamInfoItems = new ArrayList<>(infoItems.size()); for (final LocalItem item : infoItems) { diff --git a/app/src/main/java/org/schabi/newpipe/fragments/local/bookmark/StatisticsPlaylistFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/local/bookmark/StatisticsPlaylistFragment.java index d4e888c30..ec2dda0a4 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/local/bookmark/StatisticsPlaylistFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/local/bookmark/StatisticsPlaylistFragment.java @@ -27,6 +27,7 @@ import org.schabi.newpipe.util.NavigationHelper; import org.schabi.newpipe.util.OnClickGesture; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import icepick.State; @@ -185,6 +186,8 @@ public abstract class StatisticsPlaylistFragment @Override public void handleResult(@NonNull List result) { super.handleResult(result); + if (itemListAdapter == null) return; + itemListAdapter.clearStreamItemList(); if (result.isEmpty()) { @@ -275,6 +278,10 @@ public abstract class StatisticsPlaylistFragment } private PlayQueue getPlayQueue(final int index) { + if (itemListAdapter == null) { + return new SinglePlayQueue(Collections.emptyList(), 0); + } + final List infoItems = itemListAdapter.getItemsList(); List streamInfoItems = new ArrayList<>(infoItems.size()); for (final LocalItem item : infoItems) { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 577d85ce5..05db15da1 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -233,6 +233,7 @@ Delete All Checksum Dismiss + Rename New mission