Respect 'keep updated' for new items counter

This commit is contained in:
ByteHamster 2019-04-03 18:11:55 +02:00
parent 7a98e3c231
commit 46510c808a
1 changed files with 9 additions and 3 deletions

View File

@ -1253,9 +1253,15 @@ public class PodDBAdapter {
}
public final int getNumberOfNewItems() {
final String query = "SELECT COUNT(" + KEY_ID + ")"
+ " FROM " + TABLE_NAME_FEED_ITEMS
+ " WHERE " + KEY_READ + "=" + FeedItem.NEW;
Object[] args = new String[]{
TABLE_NAME_FEED_ITEMS + "." + KEY_ID,
TABLE_NAME_FEED_ITEMS,
TABLE_NAME_FEEDS,
TABLE_NAME_FEED_ITEMS + "." + KEY_FEED + "=" + TABLE_NAME_FEEDS + "." + KEY_ID,
TABLE_NAME_FEED_ITEMS + "." + KEY_READ + "=" + FeedItem.NEW
+ " AND " + TABLE_NAME_FEEDS + "." + KEY_KEEP_UPDATED + " > 0"
};
final String query = String.format("SELECT COUNT(%s) FROM %s INNER JOIN %s ON %s WHERE %s", args);
Cursor c = db.rawQuery(query, null);
int result = 0;
if (c.moveToFirst()) {