summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java61
-rw-r--r--storage/database/src/main/java/de/danoeh/antennapod/storage/database/PodDBAdapter.java129
-rw-r--r--storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/ChapterCursorMapper.java10
-rw-r--r--storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/DownloadStatusCursorMapper.java16
-rw-r--r--storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/FeedCursorMapper.java40
-rw-r--r--storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/FeedPreferencesCursorMapper.java30
-rw-r--r--ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/years/YearStatisticsListAdapter.java2
7 files changed, 154 insertions, 134 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java
index e7e8e9587..36c1c6694 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java
@@ -7,7 +7,6 @@ import androidx.collection.ArrayMap;
import android.text.TextUtils;
import android.util.Log;
-import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -852,52 +851,34 @@ public final class DBReader {
adapter.open();
StatisticsResult result = new StatisticsResult();
- List<Feed> feeds = getFeedList();
- for (Feed feed : feeds) {
- long feedPlayedTime = 0;
- long feedTotalTime = 0;
- long episodes = 0;
- long episodesStarted = 0;
- long totalDownloadSize = 0;
- long episodesDownloadCount = 0;
- List<FeedItem> items = getFeed(feed.getId()).getItems();
- for (FeedItem item : items) {
- FeedMedia media = item.getMedia();
- if (media == null) {
- continue;
- }
-
- if (media.getLastPlayedTime() > 0 && media.getPlayedDuration() != 0) {
- result.oldestDate = Math.min(result.oldestDate, media.getLastPlayedTime());
- }
- if (media.getLastPlayedTime() >= timeFilterFrom
- && media.getLastPlayedTime() <= timeFilterTo) {
- if (media.getPlayedDuration() != 0) {
- feedPlayedTime += media.getPlayedDuration() / 1000;
- } else if (includeMarkedAsPlayed && item.isPlayed()) {
- feedPlayedTime += media.getDuration() / 1000;
- }
- }
+ try (Cursor cursor = adapter.getFeedStatisticsCursor(includeMarkedAsPlayed, timeFilterFrom, timeFilterTo)) {
+ int indexOldestDate = cursor.getColumnIndexOrThrow("oldest_date");
+ int indexNumEpisodes = cursor.getColumnIndexOrThrow("num_episodes");
+ int indexEpisodesStarted = cursor.getColumnIndexOrThrow("episodes_started");
+ int indexTotalTime = cursor.getColumnIndexOrThrow("total_time");
+ int indexPlayedTime = cursor.getColumnIndexOrThrow("played_time");
+ int indexNumDownloaded = cursor.getColumnIndexOrThrow("num_downloaded");
+ int indexDownloadSize = cursor.getColumnIndexOrThrow("download_size");
- boolean markedAsStarted = item.isPlayed() || media.getPosition() != 0;
- boolean hasStatistics = media.getPlaybackCompletionDate() != null || media.getPlayedDuration() > 0;
- if (hasStatistics || (includeMarkedAsPlayed && markedAsStarted)) {
- episodesStarted++;
- }
+ while (cursor.moveToNext()) {
+ Feed feed = extractFeedFromCursorRow(cursor);
- feedTotalTime += media.getDuration() / 1000;
+ long feedPlayedTime = Long.parseLong(cursor.getString(indexPlayedTime)) / 1000;
+ long feedTotalTime = Long.parseLong(cursor.getString(indexTotalTime)) / 1000;
+ long episodes = Long.parseLong(cursor.getString(indexNumEpisodes));
+ long episodesStarted = Long.parseLong(cursor.getString(indexEpisodesStarted));
+ long totalDownloadSize = Long.parseLong(cursor.getString(indexDownloadSize));
+ long episodesDownloadCount = Long.parseLong(cursor.getString(indexNumDownloaded));
+ long oldestDate = Long.parseLong(cursor.getString(indexOldestDate));
- if (media.isDownloaded()) {
- totalDownloadSize += new File(media.getFile_url()).length();
- episodesDownloadCount++;
+ if (episodes > 0 && oldestDate < Long.MAX_VALUE) {
+ result.oldestDate = Math.min(result.oldestDate, oldestDate);
}
- episodes++;
+ result.feedTime.add(new StatisticsItem(feed, feedTotalTime, feedPlayedTime, episodes,
+ episodesStarted, totalDownloadSize, episodesDownloadCount));
}
- result.feedTime.add(new StatisticsItem(feed, feedTotalTime, feedPlayedTime, episodes,
- episodesStarted, totalDownloadSize, episodesDownloadCount));
}
-
adapter.close();
return result;
}
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 453d1c184..5ce75a2ae 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
@@ -227,46 +227,6 @@ public class PodDBAdapter {
+ KEY_FEEDITEM + " INTEGER," + KEY_FEED + " INTEGER)";
/**
- * Select all columns from the feed-table
- */
- private static final String[] FEED_SEL_STD = {
- TABLE_NAME_FEEDS + "." + KEY_ID,
- TABLE_NAME_FEEDS + "." + KEY_TITLE,
- TABLE_NAME_FEEDS + "." + KEY_CUSTOM_TITLE,
- TABLE_NAME_FEEDS + "." + KEY_FILE_URL,
- TABLE_NAME_FEEDS + "." + KEY_DOWNLOAD_URL,
- TABLE_NAME_FEEDS + "." + KEY_DOWNLOADED,
- TABLE_NAME_FEEDS + "." + KEY_LINK,
- TABLE_NAME_FEEDS + "." + KEY_DESCRIPTION,
- TABLE_NAME_FEEDS + "." + KEY_PAYMENT_LINK,
- TABLE_NAME_FEEDS + "." + KEY_LASTUPDATE,
- TABLE_NAME_FEEDS + "." + KEY_LANGUAGE,
- TABLE_NAME_FEEDS + "." + KEY_AUTHOR,
- TABLE_NAME_FEEDS + "." + KEY_IMAGE_URL,
- TABLE_NAME_FEEDS + "." + KEY_TYPE,
- TABLE_NAME_FEEDS + "." + KEY_FEED_IDENTIFIER,
- TABLE_NAME_FEEDS + "." + KEY_AUTO_DOWNLOAD_ENABLED,
- TABLE_NAME_FEEDS + "." + KEY_KEEP_UPDATED,
- TABLE_NAME_FEEDS + "." + KEY_IS_PAGED,
- TABLE_NAME_FEEDS + "." + KEY_NEXT_PAGE_LINK,
- TABLE_NAME_FEEDS + "." + KEY_USERNAME,
- TABLE_NAME_FEEDS + "." + KEY_PASSWORD,
- TABLE_NAME_FEEDS + "." + KEY_HIDE,
- TABLE_NAME_FEEDS + "." + KEY_SORT_ORDER,
- TABLE_NAME_FEEDS + "." + KEY_LAST_UPDATE_FAILED,
- TABLE_NAME_FEEDS + "." + KEY_AUTO_DELETE_ACTION,
- TABLE_NAME_FEEDS + "." + KEY_FEED_VOLUME_ADAPTION,
- TABLE_NAME_FEEDS + "." + KEY_INCLUDE_FILTER,
- TABLE_NAME_FEEDS + "." + KEY_EXCLUDE_FILTER,
- TABLE_NAME_FEEDS + "." + KEY_MINIMAL_DURATION_FILTER,
- TABLE_NAME_FEEDS + "." + KEY_FEED_PLAYBACK_SPEED,
- TABLE_NAME_FEEDS + "." + KEY_FEED_TAGS,
- TABLE_NAME_FEEDS + "." + KEY_FEED_SKIP_INTRO,
- TABLE_NAME_FEEDS + "." + KEY_FEED_SKIP_ENDING,
- TABLE_NAME_FEEDS + "." + KEY_EPISODE_NOTIFICATION
- };
-
- /**
* All the tables in the database
*/
private static final String[] ALL_TABLES = {
@@ -281,6 +241,7 @@ public class PodDBAdapter {
public static final String SELECT_KEY_ITEM_ID = "item_id";
public static final String SELECT_KEY_MEDIA_ID = "media_id";
+ public static final String SELECT_KEY_FEED_ID = "feed_id";
private static final String KEYS_FEED_ITEM_WITHOUT_DESCRIPTION =
TABLE_NAME_FEED_ITEMS + "." + KEY_ID + " AS " + SELECT_KEY_ITEM_ID + ", "
@@ -312,6 +273,42 @@ public class PodDBAdapter {
+ TABLE_NAME_FEED_MEDIA + "." + KEY_HAS_EMBEDDED_PICTURE + ", "
+ TABLE_NAME_FEED_MEDIA + "." + KEY_LAST_PLAYED_TIME;
+ private static final String KEYS_FEED =
+ TABLE_NAME_FEEDS + "." + KEY_ID + " AS " + SELECT_KEY_FEED_ID + ", "
+ + TABLE_NAME_FEEDS + "." + KEY_TITLE + ", "
+ + TABLE_NAME_FEEDS + "." + KEY_CUSTOM_TITLE + ", "
+ + TABLE_NAME_FEEDS + "." + KEY_FILE_URL + ", "
+ + TABLE_NAME_FEEDS + "." + KEY_DOWNLOAD_URL + ", "
+ + TABLE_NAME_FEEDS + "." + KEY_DOWNLOADED + ", "
+ + TABLE_NAME_FEEDS + "." + KEY_LINK + ", "
+ + TABLE_NAME_FEEDS + "." + KEY_DESCRIPTION + ", "
+ + TABLE_NAME_FEEDS + "." + KEY_PAYMENT_LINK + ", "
+ + TABLE_NAME_FEEDS + "." + KEY_LASTUPDATE + ", "
+ + TABLE_NAME_FEEDS + "." + KEY_LANGUAGE + ", "
+ + TABLE_NAME_FEEDS + "." + KEY_AUTHOR + ", "
+ + TABLE_NAME_FEEDS + "." + KEY_IMAGE_URL + ", "
+ + TABLE_NAME_FEEDS + "." + KEY_TYPE + ", "
+ + TABLE_NAME_FEEDS + "." + KEY_FEED_IDENTIFIER + ", "
+ + TABLE_NAME_FEEDS + "." + KEY_IS_PAGED + ", "
+ + TABLE_NAME_FEEDS + "." + KEY_NEXT_PAGE_LINK + ", "
+ + TABLE_NAME_FEEDS + "." + KEY_LAST_UPDATE_FAILED + ", "
+ + TABLE_NAME_FEEDS + "." + KEY_AUTO_DOWNLOAD_ENABLED + ", "
+ + TABLE_NAME_FEEDS + "." + KEY_KEEP_UPDATED + ", "
+ + TABLE_NAME_FEEDS + "." + KEY_USERNAME + ", "
+ + TABLE_NAME_FEEDS + "." + KEY_PASSWORD + ", "
+ + TABLE_NAME_FEEDS + "." + KEY_HIDE + ", "
+ + TABLE_NAME_FEEDS + "." + KEY_SORT_ORDER + ", "
+ + TABLE_NAME_FEEDS + "." + KEY_AUTO_DELETE_ACTION + ", "
+ + TABLE_NAME_FEEDS + "." + KEY_FEED_VOLUME_ADAPTION + ", "
+ + TABLE_NAME_FEEDS + "." + KEY_INCLUDE_FILTER + ", "
+ + TABLE_NAME_FEEDS + "." + KEY_EXCLUDE_FILTER + ", "
+ + TABLE_NAME_FEEDS + "." + KEY_MINIMAL_DURATION_FILTER + ", "
+ + TABLE_NAME_FEEDS + "." + KEY_FEED_PLAYBACK_SPEED + ", "
+ + TABLE_NAME_FEEDS + "." + KEY_FEED_TAGS + ", "
+ + TABLE_NAME_FEEDS + "." + KEY_FEED_SKIP_INTRO + ", "
+ + TABLE_NAME_FEEDS + "." + KEY_FEED_SKIP_ENDING + ", "
+ + TABLE_NAME_FEEDS + "." + KEY_EPISODE_NOTIFICATION;
+
private static final String JOIN_FEED_ITEM_AND_MEDIA = " LEFT JOIN " + TABLE_NAME_FEED_MEDIA
+ " ON " + TABLE_NAME_FEED_ITEMS + "." + KEY_ID + "=" + TABLE_NAME_FEED_MEDIA + "." + KEY_FEEDITEM + " ";
@@ -914,8 +911,10 @@ public class PodDBAdapter {
* @return The cursor of the query
*/
public final Cursor getAllFeedsCursor() {
- return db.query(TABLE_NAME_FEEDS, FEED_SEL_STD, null, null, null, null,
- KEY_TITLE + " COLLATE NOCASE ASC");
+ final String query = "SELECT " + KEYS_FEED
+ + " FROM " + TABLE_NAME_FEEDS
+ + " ORDER BY " + TABLE_NAME_FEEDS + "." + KEY_TITLE + " COLLATE NOCASE ASC";
+ return db.rawQuery(query, null);
}
public final Cursor getFeedCursorDownloadUrls() {
@@ -1102,8 +1101,10 @@ public class PodDBAdapter {
}
public final Cursor getFeedCursor(final long id) {
- return db.query(TABLE_NAME_FEEDS, FEED_SEL_STD, KEY_ID + "=" + id, null,
- null, null, null);
+ final String query = "SELECT " + KEYS_FEED
+ + " FROM " + TABLE_NAME_FEEDS
+ + " WHERE " + SELECT_KEY_FEED_ID + " = " + id;
+ return db.rawQuery(query, null);
}
public final Cursor getFeedItemCursor(final String id) {
@@ -1167,6 +1168,46 @@ public class PodDBAdapter {
return db.rawQuery(query, null);
}
+ public final Cursor getFeedStatisticsCursor(boolean includeMarkedAsPlayed, long timeFilterFrom, long timeFilterTo) {
+ final String lastPlayedTime = TABLE_NAME_FEED_MEDIA + "." + KEY_LAST_PLAYED_TIME;
+ String wasStarted = TABLE_NAME_FEED_MEDIA + "." + KEY_PLAYBACK_COMPLETION_DATE + " > 0"
+ + " AND " + TABLE_NAME_FEED_MEDIA + "." + KEY_PLAYED_DURATION + " > 0";
+ if (includeMarkedAsPlayed) {
+ wasStarted = "(" + wasStarted + ") OR "
+ + TABLE_NAME_FEED_ITEMS + "." + KEY_READ + "=" + FeedItem.PLAYED + " OR "
+ + TABLE_NAME_FEED_MEDIA + "." + KEY_POSITION + "> 0";
+ }
+ final String timeFilter = lastPlayedTime + ">=" + timeFilterFrom
+ + " AND " + lastPlayedTime + "<=" + timeFilterTo;
+ String playedTime = TABLE_NAME_FEED_MEDIA + "." + KEY_PLAYED_DURATION;
+ if (includeMarkedAsPlayed) {
+ playedTime = "(CASE WHEN " + playedTime + " != 0"
+ + " THEN " + playedTime + " ELSE ("
+ + "CASE WHEN " + TABLE_NAME_FEED_ITEMS + "." + KEY_READ + "=" + FeedItem.PLAYED
+ + " THEN " + TABLE_NAME_FEED_MEDIA + "." + KEY_DURATION + " ELSE 0 END"
+ + ") END)";
+ }
+
+ final String query = "SELECT " + KEYS_FEED + ", "
+ + "COUNT(*) AS num_episodes, "
+ + "MIN(CASE WHEN " + lastPlayedTime + " > 0"
+ + " THEN " + lastPlayedTime + " ELSE " + Long.MAX_VALUE + " END) AS oldest_date, "
+ + "SUM(CASE WHEN (" + wasStarted + ") THEN 1 ELSE 0 END) AS episodes_started, "
+ + "IFNULL(SUM(CASE WHEN (" + timeFilter + ")"
+ + " THEN (" + playedTime + ") ELSE 0 END), 0) AS played_time, "
+ + "IFNULL(SUM(" + TABLE_NAME_FEED_MEDIA + "." + KEY_DURATION + "), 0) AS total_time, "
+ + "SUM(CASE WHEN " + TABLE_NAME_FEED_MEDIA + "." + KEY_DOWNLOADED + " > 0"
+ + " THEN 1 ELSE 0 END) AS num_downloaded, "
+ + "SUM(CASE WHEN " + TABLE_NAME_FEED_MEDIA + "." + KEY_DOWNLOADED + " > 0"
+ + " THEN " + TABLE_NAME_FEED_MEDIA + "." + KEY_SIZE + " ELSE 0 END) AS download_size"
+ + " FROM " + TABLE_NAME_FEED_ITEMS
+ + JOIN_FEED_ITEM_AND_MEDIA
+ + " INNER JOIN " + TABLE_NAME_FEEDS
+ + " ON " + TABLE_NAME_FEED_ITEMS + "." + KEY_FEED + "=" + TABLE_NAME_FEEDS + "." + KEY_ID
+ + " GROUP BY " + TABLE_NAME_FEEDS + "." + KEY_ID;
+ return db.rawQuery(query, null);
+ }
+
public int getQueueSize() {
final String query = String.format("SELECT COUNT(%s) FROM %s", KEY_ID, TABLE_NAME_QUEUE);
Cursor c = db.rawQuery(query, null);
diff --git a/storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/ChapterCursorMapper.java b/storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/ChapterCursorMapper.java
index 71e67812d..b48a7f9d1 100644
--- a/storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/ChapterCursorMapper.java
+++ b/storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/ChapterCursorMapper.java
@@ -14,11 +14,11 @@ public abstract class ChapterCursorMapper {
*/
@NonNull
public static Chapter convert(@NonNull Cursor cursor) {
- int indexId = cursor.getColumnIndex(PodDBAdapter.KEY_ID);
- int indexTitle = cursor.getColumnIndex(PodDBAdapter.KEY_TITLE);
- int indexStart = cursor.getColumnIndex(PodDBAdapter.KEY_START);
- int indexLink = cursor.getColumnIndex(PodDBAdapter.KEY_LINK);
- int indexImage = cursor.getColumnIndex(PodDBAdapter.KEY_IMAGE_URL);
+ int indexId = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_ID);
+ int indexTitle = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_TITLE);
+ int indexStart = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_START);
+ int indexLink = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_LINK);
+ int indexImage = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_IMAGE_URL);
long id = cursor.getLong(indexId);
String title = cursor.getString(indexTitle);
diff --git a/storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/DownloadStatusCursorMapper.java b/storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/DownloadStatusCursorMapper.java
index 4a5a792af..1b8f3c726 100644
--- a/storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/DownloadStatusCursorMapper.java
+++ b/storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/DownloadStatusCursorMapper.java
@@ -17,14 +17,14 @@ public abstract class DownloadStatusCursorMapper {
*/
@NonNull
public static DownloadStatus convert(@NonNull Cursor cursor) {
- int indexId = cursor.getColumnIndex(PodDBAdapter.KEY_ID);
- int indexTitle = cursor.getColumnIndex(PodDBAdapter.KEY_DOWNLOADSTATUS_TITLE);
- int indexFeedFile = cursor.getColumnIndex(PodDBAdapter.KEY_FEEDFILE);
- int indexFileFileType = cursor.getColumnIndex(PodDBAdapter.KEY_FEEDFILETYPE);
- int indexSuccessful = cursor.getColumnIndex(PodDBAdapter.KEY_SUCCESSFUL);
- int indexReason = cursor.getColumnIndex(PodDBAdapter.KEY_REASON);
- int indexCompletionDate = cursor.getColumnIndex(PodDBAdapter.KEY_COMPLETION_DATE);
- int indexReasonDetailed = cursor.getColumnIndex(PodDBAdapter.KEY_REASON_DETAILED);
+ int indexId = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_ID);
+ int indexTitle = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_DOWNLOADSTATUS_TITLE);
+ int indexFeedFile = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_FEEDFILE);
+ int indexFileFileType = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_FEEDFILETYPE);
+ int indexSuccessful = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_SUCCESSFUL);
+ int indexReason = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_REASON);
+ int indexCompletionDate = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_COMPLETION_DATE);
+ int indexReasonDetailed = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_REASON_DETAILED);
return new DownloadStatus(cursor.getLong(indexId), cursor.getString(indexTitle), cursor.getLong(indexFeedFile),
cursor.getInt(indexFileFileType), cursor.getInt(indexSuccessful) > 0, false, true,
diff --git a/storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/FeedCursorMapper.java b/storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/FeedCursorMapper.java
index 25df7313f..bb5ea4df6 100644
--- a/storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/FeedCursorMapper.java
+++ b/storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/FeedCursorMapper.java
@@ -19,26 +19,26 @@ public abstract class FeedCursorMapper {
*/
@NonNull
public static Feed convert(@NonNull Cursor cursor) {
- int indexId = cursor.getColumnIndex(PodDBAdapter.KEY_ID);
- int indexLastUpdate = cursor.getColumnIndex(PodDBAdapter.KEY_LASTUPDATE);
- int indexTitle = cursor.getColumnIndex(PodDBAdapter.KEY_TITLE);
- int indexCustomTitle = cursor.getColumnIndex(PodDBAdapter.KEY_CUSTOM_TITLE);
- int indexLink = cursor.getColumnIndex(PodDBAdapter.KEY_LINK);
- int indexDescription = cursor.getColumnIndex(PodDBAdapter.KEY_DESCRIPTION);
- int indexPaymentLink = cursor.getColumnIndex(PodDBAdapter.KEY_PAYMENT_LINK);
- int indexAuthor = cursor.getColumnIndex(PodDBAdapter.KEY_AUTHOR);
- int indexLanguage = cursor.getColumnIndex(PodDBAdapter.KEY_LANGUAGE);
- int indexType = cursor.getColumnIndex(PodDBAdapter.KEY_TYPE);
- int indexFeedIdentifier = cursor.getColumnIndex(PodDBAdapter.KEY_FEED_IDENTIFIER);
- int indexFileUrl = cursor.getColumnIndex(PodDBAdapter.KEY_FILE_URL);
- int indexDownloadUrl = cursor.getColumnIndex(PodDBAdapter.KEY_DOWNLOAD_URL);
- int indexDownloaded = cursor.getColumnIndex(PodDBAdapter.KEY_DOWNLOADED);
- int indexIsPaged = cursor.getColumnIndex(PodDBAdapter.KEY_IS_PAGED);
- int indexNextPageLink = cursor.getColumnIndex(PodDBAdapter.KEY_NEXT_PAGE_LINK);
- int indexHide = cursor.getColumnIndex(PodDBAdapter.KEY_HIDE);
- int indexSortOrder = cursor.getColumnIndex(PodDBAdapter.KEY_SORT_ORDER);
- int indexLastUpdateFailed = cursor.getColumnIndex(PodDBAdapter.KEY_LAST_UPDATE_FAILED);
- int indexImageUrl = cursor.getColumnIndex(PodDBAdapter.KEY_IMAGE_URL);
+ int indexId = cursor.getColumnIndexOrThrow(PodDBAdapter.SELECT_KEY_FEED_ID);
+ int indexLastUpdate = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_LASTUPDATE);
+ int indexTitle = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_TITLE);
+ int indexCustomTitle = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_CUSTOM_TITLE);
+ int indexLink = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_LINK);
+ int indexDescription = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_DESCRIPTION);
+ int indexPaymentLink = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_PAYMENT_LINK);
+ int indexAuthor = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_AUTHOR);
+ int indexLanguage = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_LANGUAGE);
+ int indexType = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_TYPE);
+ int indexFeedIdentifier = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_FEED_IDENTIFIER);
+ int indexFileUrl = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_FILE_URL);
+ int indexDownloadUrl = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_DOWNLOAD_URL);
+ int indexDownloaded = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_DOWNLOADED);
+ int indexIsPaged = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_IS_PAGED);
+ int indexNextPageLink = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_NEXT_PAGE_LINK);
+ int indexHide = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_HIDE);
+ int indexSortOrder = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_SORT_ORDER);
+ int indexLastUpdateFailed = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_LAST_UPDATE_FAILED);
+ int indexImageUrl = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_IMAGE_URL);
Feed feed = new Feed(
cursor.getLong(indexId),
diff --git a/storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/FeedPreferencesCursorMapper.java b/storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/FeedPreferencesCursorMapper.java
index 9fc70a2d7..289bcbab8 100644
--- a/storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/FeedPreferencesCursorMapper.java
+++ b/storage/database/src/main/java/de/danoeh/antennapod/storage/database/mapper/FeedPreferencesCursorMapper.java
@@ -20,21 +20,21 @@ public abstract class FeedPreferencesCursorMapper {
*/
@NonNull
public static FeedPreferences convert(@NonNull Cursor cursor) {
- int indexId = cursor.getColumnIndex(PodDBAdapter.KEY_ID);
- int indexAutoDownload = cursor.getColumnIndex(PodDBAdapter.KEY_AUTO_DOWNLOAD_ENABLED);
- int indexAutoRefresh = cursor.getColumnIndex(PodDBAdapter.KEY_KEEP_UPDATED);
- int indexAutoDeleteAction = cursor.getColumnIndex(PodDBAdapter.KEY_AUTO_DELETE_ACTION);
- int indexVolumeAdaption = cursor.getColumnIndex(PodDBAdapter.KEY_FEED_VOLUME_ADAPTION);
- int indexUsername = cursor.getColumnIndex(PodDBAdapter.KEY_USERNAME);
- int indexPassword = cursor.getColumnIndex(PodDBAdapter.KEY_PASSWORD);
- int indexIncludeFilter = cursor.getColumnIndex(PodDBAdapter.KEY_INCLUDE_FILTER);
- int indexExcludeFilter = cursor.getColumnIndex(PodDBAdapter.KEY_EXCLUDE_FILTER);
- int indexMinimalDurationFilter = cursor.getColumnIndex(PodDBAdapter.KEY_MINIMAL_DURATION_FILTER);
- int indexFeedPlaybackSpeed = cursor.getColumnIndex(PodDBAdapter.KEY_FEED_PLAYBACK_SPEED);
- int indexAutoSkipIntro = cursor.getColumnIndex(PodDBAdapter.KEY_FEED_SKIP_INTRO);
- int indexAutoSkipEnding = cursor.getColumnIndex(PodDBAdapter.KEY_FEED_SKIP_ENDING);
- int indexEpisodeNotification = cursor.getColumnIndex(PodDBAdapter.KEY_EPISODE_NOTIFICATION);
- int indexTags = cursor.getColumnIndex(PodDBAdapter.KEY_FEED_TAGS);
+ int indexId = cursor.getColumnIndexOrThrow(PodDBAdapter.SELECT_KEY_FEED_ID);
+ int indexAutoDownload = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_AUTO_DOWNLOAD_ENABLED);
+ int indexAutoRefresh = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_KEEP_UPDATED);
+ int indexAutoDeleteAction = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_AUTO_DELETE_ACTION);
+ int indexVolumeAdaption = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_FEED_VOLUME_ADAPTION);
+ int indexUsername = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_USERNAME);
+ int indexPassword = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_PASSWORD);
+ int indexIncludeFilter = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_INCLUDE_FILTER);
+ int indexExcludeFilter = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_EXCLUDE_FILTER);
+ int indexMinimalDurationFilter = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_MINIMAL_DURATION_FILTER);
+ int indexFeedPlaybackSpeed = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_FEED_PLAYBACK_SPEED);
+ int indexAutoSkipIntro = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_FEED_SKIP_INTRO);
+ int indexAutoSkipEnding = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_FEED_SKIP_ENDING);
+ int indexEpisodeNotification = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_EPISODE_NOTIFICATION);
+ int indexTags = cursor.getColumnIndexOrThrow(PodDBAdapter.KEY_FEED_TAGS);
long feedId = cursor.getLong(indexId);
boolean autoDownload = cursor.getInt(indexAutoDownload) > 0;
diff --git a/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/years/YearStatisticsListAdapter.java b/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/years/YearStatisticsListAdapter.java
index e3251a96b..2116a17a4 100644
--- a/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/years/YearStatisticsListAdapter.java
+++ b/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/years/YearStatisticsListAdapter.java
@@ -85,9 +85,7 @@ public class YearStatisticsListAdapter extends RecyclerView.Adapter<RecyclerView
item.year = lastDataPoint / 12;
item.month = lastDataPoint % 12 + 1;
statisticsData.add(item); // Compensate for months without playback
- System.out.println("aaaaa extra:" + item.month + "/" + item.year);
}
- System.out.println("aaaaa add:" + statistic.month + "/" + statistic.year);
statisticsData.add(statistic);
lastDataPoint = (statistic.month - 1) + statistic.year * 12;
}