From 8538f7b9f29bfceaa3f2d29f6f4bd71f428188f9 Mon Sep 17 00:00:00 2001 From: Martin Fietz Date: Thu, 2 Jul 2015 18:50:10 +0200 Subject: [PATCH] Fix DB problem --- .../java/de/danoeh/antennapod/core/storage/DBWriter.java | 7 ++----- .../de/danoeh/antennapod/core/storage/PodDBAdapter.java | 4 ---- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java index 216d1bde2..d1f67cd29 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java @@ -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()); } } } diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java b/core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java index 91a8e2ed0..8f09ff3c2 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java @@ -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() {