diff options
author | GitStart <1501599+gitstart@users.noreply.github.com> | 2023-02-22 20:04:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-22 20:04:04 +0100 |
commit | 25ddd73f244dc6444ed052942d763384f5c58cac (patch) | |
tree | f0b032d95c166df3c06092b83aafb3147bbcd2f5 /storage/database | |
parent | 50eb1e9cf93c81e4eec440934feb9ad30bda85b4 (diff) | |
download | AntennaPod-25ddd73f244dc6444ed052942d763384f5c58cac.zip |
Add sort option to episodes screen (#6286)
Diffstat (limited to 'storage/database')
-rw-r--r-- | storage/database/src/main/java/de/danoeh/antennapod/storage/database/PodDBAdapter.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/storage/database/src/main/java/de/danoeh/antennapod/storage/database/PodDBAdapter.java b/storage/database/src/main/java/de/danoeh/antennapod/storage/database/PodDBAdapter.java index bcb57f3bb..bb0218a0b 100644 --- a/storage/database/src/main/java/de/danoeh/antennapod/storage/database/PodDBAdapter.java +++ b/storage/database/src/main/java/de/danoeh/antennapod/storage/database/PodDBAdapter.java @@ -45,6 +45,8 @@ import org.apache.commons.io.FileUtils; import static de.danoeh.antennapod.model.feed.FeedPreferences.SPEED_USE_GLOBAL; import static de.danoeh.antennapod.model.feed.SortOrder.toCodeString; +import de.danoeh.antennapod.storage.database.mapper.FeedItemSortQuery; + /** * Implements methods for accessing the database */ @@ -1059,11 +1061,13 @@ public class PodDBAdapter { return db.rawQuery(query, null); } - public final Cursor getRecentlyPublishedItemsCursor(int offset, int limit, FeedItemFilter filter) { + public final Cursor getRecentlyPublishedItemsCursor(int offset, int limit, + FeedItemFilter filter, SortOrder sortOrder) { + String orderByQuery = FeedItemSortQuery.generateFrom(sortOrder); String filterQuery = FeedItemFilterQuery.generateFrom(filter); String whereClause = "".equals(filterQuery) ? "" : " WHERE " + filterQuery; final String query = SELECT_FEED_ITEMS_AND_MEDIA + whereClause - + " ORDER BY " + KEY_PUBDATE + " DESC LIMIT " + offset + ", " + limit; + + "ORDER BY " + orderByQuery + " LIMIT " + offset + ", " + limit; return db.rawQuery(query, null); } |