commit
178014ff93
|
@ -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 -> {
|
||||||
|
|
|
@ -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();
|
||||||
|
if(broadcastUpdate) {
|
||||||
EventDistributor.getInstance().sendUnreadItemsUpdateBroadcast();
|
EventDistributor.getInstance().sendUnreadItemsUpdateBroadcast();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue