Fix DB problem

This commit is contained in:
Martin Fietz 2015-07-02 18:50:10 +02:00
parent dd898d1abe
commit 8538f7b9f2
2 changed files with 2 additions and 9 deletions

View File

@ -361,8 +361,7 @@ public class DBWriter {
adapter.setQueue(queue);
EventBus.getDefault().post(new QueueEvent(QueueEvent.Action.ADDED, item, index));
if(item.isNew()) {
adapter.setFeedItemRead(FeedItem.UNPLAYED, item.getId());
EventDistributor.getInstance().sendUnreadItemsUpdateBroadcast();
DBWriter.markItemRead(context, false, item.getId());
}
}
}
@ -427,10 +426,8 @@ public class DBWriter {
if (queueModified) {
adapter.setQueue(queue);
EventBus.getDefault().post(new QueueEvent(QueueEvent.Action.ADDED_ITEMS, queue));
Log.d(TAG, "# mark as unplayed: " + markAsUnplayedIds.size());
if(markAsUnplayedIds.size() > 0) {
adapter.setFeedItemRead(FeedItem.UNPLAYED, markAsUnplayedIds.toArray());
EventDistributor.getInstance().sendUnreadItemsUpdateBroadcast();
DBWriter.markItemRead(context, false, markAsUnplayedIds.toArray());
}
}
}

View File

@ -890,10 +890,6 @@ public class PodDBAdapter {
}
db.setTransactionSuccessful();
db.endTransaction();
db.execSQL("UPDATE " + TABLE_NAME_FEED_ITEMS
+ " SET " + KEY_READ + "=" + FeedItem.UNPLAYED
+ " WHERE " + KEY_ID + " IN(" + TextUtils.join(",", Arrays.asList(ids)) + ")"
+ " AND " + KEY_READ + "=" + FeedItem.NEW);
}
public void clearQueue() {