Don't get notified about mark as played

This commit is contained in:
Martin Fietz 2016-03-25 18:07:32 +01:00
parent 016f52fa20
commit 4ef34ef28b
2 changed files with 18 additions and 3 deletions

View File

@ -409,7 +409,7 @@ public class QueueFragment extends Fragment {
Log.d(TAG, "remove(" + position + ")");
final FeedItem item = queue.get(position);
final boolean isRead = item.isPlayed();
DBWriter.markItemPlayed(FeedItem.PLAYED, item.getId());
DBWriter.markItemPlayed(FeedItem.PLAYED, false, item.getId());
DBWriter.removeQueueItem(getActivity(), item, true);
Snackbar snackbar = Snackbar.make(root, getString(R.string.marked_as_read_label), Snackbar.LENGTH_LONG);
snackbar.setAction(getString(R.string.undo), v -> {

View File

@ -583,18 +583,33 @@ public class DBWriter {
/*
* Sets the 'read'-attribute of all specified FeedItems
*
* @param context A context that is used for opening a database connection.
* @param played New value of the 'read'-attribute, one of FeedItem.PLAYED, FeedItem.NEW,
* FeedItem.UNPLAYED
* @param itemIds IDs of the FeedItems.
*/
public static Future<?> markItemPlayed(final int played, final long... itemIds) {
return markItemPlayed(played, true, itemIds);
}
/*
* Sets the 'read'-attribute of all specified FeedItems
*
* @param played New value of the 'read'-attribute, one of FeedItem.PLAYED, FeedItem.NEW,
* FeedItem.UNPLAYED
* @param broadcastUpdate true if this operation should trigger a UnreadItemsUpdate broadcast.
* This option is usually set to true
* @param itemIds IDs of the FeedItems.
*/
public static Future<?> markItemPlayed(final int played, final boolean broadcastUpdate,
final long... itemIds) {
return dbExec.submit(() -> {
final PodDBAdapter adapter = PodDBAdapter.getInstance();
adapter.open();
adapter.setFeedItemRead(played, itemIds);
adapter.close();
EventDistributor.getInstance().sendUnreadItemsUpdateBroadcast();
if(broadcastUpdate) {
EventDistributor.getInstance().sendUnreadItemsUpdateBroadcast();
}
});
}