mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2025-01-31 19:04:52 +01:00
FeedManager will now delete the oldest DownloadStatus when log becomes
too big
This commit is contained in:
parent
1fefa40c56
commit
b99a810a1b
@ -266,7 +266,8 @@ public class FeedManager {
|
|||||||
for (FeedItem item : unreadItems) {
|
for (FeedItem item : unreadItems) {
|
||||||
item.read = true;
|
item.read = true;
|
||||||
}
|
}
|
||||||
final ArrayList<FeedItem> unreadItemsCopy = new ArrayList<FeedItem>(unreadItems);
|
final ArrayList<FeedItem> unreadItemsCopy = new ArrayList<FeedItem>(
|
||||||
|
unreadItems);
|
||||||
unreadItems.clear();
|
unreadItems.clear();
|
||||||
sendUnreadItemsUpdateBroadcast(context, null);
|
sendUnreadItemsUpdateBroadcast(context, null);
|
||||||
dbExec.execute(new Runnable() {
|
dbExec.execute(new Runnable() {
|
||||||
@ -340,13 +341,13 @@ public class FeedManager {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
downloadLog.add(status);
|
downloadLog.add(status);
|
||||||
|
Collections.sort(downloadLog, new DownloadStatusComparator());
|
||||||
final DownloadStatus removedStatus;
|
final DownloadStatus removedStatus;
|
||||||
if (downloadLog.size() > DOWNLOAD_LOG_SIZE) {
|
if (downloadLog.size() > DOWNLOAD_LOG_SIZE) {
|
||||||
removedStatus = downloadLog.remove(0);
|
removedStatus = downloadLog.remove(downloadLog.size() - 1);
|
||||||
} else {
|
} else {
|
||||||
removedStatus = null;
|
removedStatus = null;
|
||||||
}
|
}
|
||||||
Collections.sort(downloadLog, new DownloadStatusComparator());
|
|
||||||
context.sendBroadcast(new Intent(ACTION_DOWNLOADLOG_UPDATE));
|
context.sendBroadcast(new Intent(ACTION_DOWNLOADLOG_UPDATE));
|
||||||
dbExec.execute(new Runnable() {
|
dbExec.execute(new Runnable() {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user