Merge pull request #3085 from ByteHamster/new-items-count

Respect 'keep updated' for new items counter
This commit is contained in:
H. Lehmann 2019-04-04 01:16:26 +02:00 committed by GitHub
commit f2d103736d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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()) {