mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2025-01-19 12:23:22 +01:00
DownloadLog entries are now sorted by their completion date
This commit is contained in:
parent
fdb9a296ad
commit
1d890208e0
@ -15,6 +15,7 @@ import de.danoeh.antennapod.asynctask.DownloadStatus;
|
|||||||
import de.danoeh.antennapod.service.PlaybackService;
|
import de.danoeh.antennapod.service.PlaybackService;
|
||||||
import de.danoeh.antennapod.storage.*;
|
import de.danoeh.antennapod.storage.*;
|
||||||
import de.danoeh.antennapod.util.FeedtitleComparator;
|
import de.danoeh.antennapod.util.FeedtitleComparator;
|
||||||
|
import de.danoeh.antennapod.util.comparator.DownloadStatusComparator;
|
||||||
import de.danoeh.antennapod.util.comparator.FeedItemPubdateComparator;
|
import de.danoeh.antennapod.util.comparator.FeedItemPubdateComparator;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -344,6 +345,7 @@ public class FeedManager {
|
|||||||
} 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() {
|
||||||
|
|
||||||
@ -973,6 +975,7 @@ public class FeedManager {
|
|||||||
} while (logCursor.moveToNext());
|
} while (logCursor.moveToNext());
|
||||||
}
|
}
|
||||||
logCursor.close();
|
logCursor.close();
|
||||||
|
Collections.sort(downloadLog, new DownloadStatusComparator());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void extractQueueFromCursor(Context context, PodDBAdapter adapter) {
|
private void extractQueueFromCursor(Context context, PodDBAdapter adapter) {
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
package de.danoeh.antennapod.util.comparator;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
|
import de.danoeh.antennapod.asynctask.DownloadStatus;
|
||||||
|
|
||||||
|
/** Compares the completion date of two Downloadstatus objects. */
|
||||||
|
public class DownloadStatusComparator implements Comparator<DownloadStatus> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compare(DownloadStatus lhs, DownloadStatus rhs) {
|
||||||
|
return -lhs.getCompletionDate().compareTo(rhs.getCompletionDate());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user