Merge pull request #1825 from mfietz/issue/1781-swipe-issue

Fix #1781
This commit is contained in:
Tom Hennen 2016-03-25 15:20:21 -04:00
commit 178014ff93
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 + ")"); Log.d(TAG, "remove(" + position + ")");
final FeedItem item = queue.get(position); final FeedItem item = queue.get(position);
final boolean isRead = item.isPlayed(); final boolean isRead = item.isPlayed();
DBWriter.markItemPlayed(FeedItem.PLAYED, item.getId()); DBWriter.markItemPlayed(FeedItem.PLAYED, false, item.getId());
DBWriter.removeQueueItem(getActivity(), item, true); DBWriter.removeQueueItem(getActivity(), item, true);
Snackbar snackbar = Snackbar.make(root, getString(R.string.marked_as_read_label), Snackbar.LENGTH_LONG); Snackbar snackbar = Snackbar.make(root, getString(R.string.marked_as_read_label), Snackbar.LENGTH_LONG);
snackbar.setAction(getString(R.string.undo), v -> { snackbar.setAction(getString(R.string.undo), v -> {

View File

@ -583,18 +583,33 @@ public class DBWriter {
/* /*
* Sets the 'read'-attribute of all specified FeedItems * 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, * @param played New value of the 'read'-attribute, one of FeedItem.PLAYED, FeedItem.NEW,
* FeedItem.UNPLAYED * FeedItem.UNPLAYED
* @param itemIds IDs of the FeedItems. * @param itemIds IDs of the FeedItems.
*/ */
public static Future<?> markItemPlayed(final int played, final long... itemIds) { 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(() -> { return dbExec.submit(() -> {
final PodDBAdapter adapter = PodDBAdapter.getInstance(); final PodDBAdapter adapter = PodDBAdapter.getInstance();
adapter.open(); adapter.open();
adapter.setFeedItemRead(played, itemIds); adapter.setFeedItemRead(played, itemIds);
adapter.close(); adapter.close();
EventDistributor.getInstance().sendUnreadItemsUpdateBroadcast(); if(broadcastUpdate) {
EventDistributor.getInstance().sendUnreadItemsUpdateBroadcast();
}
}); });
} }