mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-25 01:20:34 +00:00
-Fixed NPE issues when button views are clicked on local playlist and statistics playlist fragments are out of focus.
-Added disk cache size limit for image loader. -Fixed button names for playlist rename dialog.
This commit is contained in:
parent
3c3fe7bf83
commit
efd4db40ef
@ -11,8 +11,6 @@ import android.os.Build;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.nostra13.universalimageloader.cache.memory.impl.LRULimitedMemoryCache;
|
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.ImageLoader;
|
||||||
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
|
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
|
||||||
|
|
||||||
@ -83,7 +81,7 @@ public class App extends Application {
|
|||||||
initNotificationChannel();
|
initNotificationChannel();
|
||||||
|
|
||||||
// Initialize image loader
|
// Initialize image loader
|
||||||
ImageLoader.getInstance().init(getImageLoaderConfigurations(10));
|
ImageLoader.getInstance().init(getImageLoaderConfigurations(10, 50));
|
||||||
|
|
||||||
configureRxJavaErrorHandler();
|
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)
|
return new ImageLoaderConfiguration.Builder(this)
|
||||||
.memoryCache(new LRULimitedMemoryCache(memoryCacheSizeMb * 1024 * 1024))
|
.memoryCache(new LRULimitedMemoryCache(memoryCacheSizeMb * 1024 * 1024))
|
||||||
|
.diskCacheSize(diskCacheSizeMb * 1024 * 1024)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ import org.schabi.newpipe.util.NavigationHelper;
|
|||||||
import org.schabi.newpipe.util.OnClickGesture;
|
import org.schabi.newpipe.util.OnClickGesture;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
@ -289,6 +290,8 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
|
|||||||
@Override
|
@Override
|
||||||
public void handleResult(@NonNull List<PlaylistStreamEntry> result) {
|
public void handleResult(@NonNull List<PlaylistStreamEntry> result) {
|
||||||
super.handleResult(result);
|
super.handleResult(result);
|
||||||
|
if (itemListAdapter == null) return;
|
||||||
|
|
||||||
itemListAdapter.clearStreamItemList();
|
itemListAdapter.clearStreamItemList();
|
||||||
|
|
||||||
if (result.isEmpty()) {
|
if (result.isEmpty()) {
|
||||||
@ -349,7 +352,7 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
|
|||||||
.setView(dialogView)
|
.setView(dialogView)
|
||||||
.setCancelable(true)
|
.setCancelable(true)
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(R.string.cancel, null)
|
||||||
.setPositiveButton(R.string.create, (dialogInterface, i) ->
|
.setPositiveButton(R.string.rename, (dialogInterface, i) ->
|
||||||
changePlaylistName(nameEdit.getText().toString())
|
changePlaylistName(nameEdit.getText().toString())
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -382,6 +385,8 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void deleteItem(final PlaylistStreamEntry item) {
|
private void deleteItem(final PlaylistStreamEntry item) {
|
||||||
|
if (itemListAdapter == null) return;
|
||||||
|
|
||||||
itemListAdapter.removeItem(item);
|
itemListAdapter.removeItem(item);
|
||||||
setVideoCount(itemListAdapter.getItemsList().size());
|
setVideoCount(itemListAdapter.getItemsList().size());
|
||||||
saveChanges();
|
saveChanges();
|
||||||
@ -543,6 +548,10 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
|
|||||||
}
|
}
|
||||||
|
|
||||||
private PlayQueue getPlayQueue(final int index) {
|
private PlayQueue getPlayQueue(final int index) {
|
||||||
|
if (itemListAdapter == null) {
|
||||||
|
return new SinglePlayQueue(Collections.emptyList(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
final List<LocalItem> infoItems = itemListAdapter.getItemsList();
|
final List<LocalItem> infoItems = itemListAdapter.getItemsList();
|
||||||
List<StreamInfoItem> streamInfoItems = new ArrayList<>(infoItems.size());
|
List<StreamInfoItem> streamInfoItems = new ArrayList<>(infoItems.size());
|
||||||
for (final LocalItem item : infoItems) {
|
for (final LocalItem item : infoItems) {
|
||||||
|
@ -27,6 +27,7 @@ import org.schabi.newpipe.util.NavigationHelper;
|
|||||||
import org.schabi.newpipe.util.OnClickGesture;
|
import org.schabi.newpipe.util.OnClickGesture;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import icepick.State;
|
import icepick.State;
|
||||||
@ -185,6 +186,8 @@ public abstract class StatisticsPlaylistFragment
|
|||||||
@Override
|
@Override
|
||||||
public void handleResult(@NonNull List<StreamStatisticsEntry> result) {
|
public void handleResult(@NonNull List<StreamStatisticsEntry> result) {
|
||||||
super.handleResult(result);
|
super.handleResult(result);
|
||||||
|
if (itemListAdapter == null) return;
|
||||||
|
|
||||||
itemListAdapter.clearStreamItemList();
|
itemListAdapter.clearStreamItemList();
|
||||||
|
|
||||||
if (result.isEmpty()) {
|
if (result.isEmpty()) {
|
||||||
@ -275,6 +278,10 @@ public abstract class StatisticsPlaylistFragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
private PlayQueue getPlayQueue(final int index) {
|
private PlayQueue getPlayQueue(final int index) {
|
||||||
|
if (itemListAdapter == null) {
|
||||||
|
return new SinglePlayQueue(Collections.emptyList(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
final List<LocalItem> infoItems = itemListAdapter.getItemsList();
|
final List<LocalItem> infoItems = itemListAdapter.getItemsList();
|
||||||
List<StreamInfoItem> streamInfoItems = new ArrayList<>(infoItems.size());
|
List<StreamInfoItem> streamInfoItems = new ArrayList<>(infoItems.size());
|
||||||
for (final LocalItem item : infoItems) {
|
for (final LocalItem item : infoItems) {
|
||||||
|
@ -233,6 +233,7 @@
|
|||||||
<string name="delete_all">Delete All</string>
|
<string name="delete_all">Delete All</string>
|
||||||
<string name="checksum">Checksum</string>
|
<string name="checksum">Checksum</string>
|
||||||
<string name="dismiss">Dismiss</string>
|
<string name="dismiss">Dismiss</string>
|
||||||
|
<string name="rename">Rename</string>
|
||||||
|
|
||||||
<!-- Fragment -->
|
<!-- Fragment -->
|
||||||
<string name="add">New mission</string>
|
<string name="add">New mission</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user