bulk edit - refactor - reorder method parameter for DBWriter.removeQueueItem(Context, FeedItem, boolean) to be consistent with the rest of the API.

This commit is contained in:
orionlee 2019-04-03 14:21:35 -07:00
parent bcaba92851
commit b683d33bcb
5 changed files with 7 additions and 8 deletions

View File

@ -584,7 +584,7 @@ public class DBWriterTest extends InstrumentationTestCase {
adapter.setQueue(feed.getItems());
adapter.close();
DBWriter.removeQueueItem(context, item, false).get(TIMEOUT, TimeUnit.SECONDS);
DBWriter.removeQueueItem(context, false, item).get(TIMEOUT, TimeUnit.SECONDS);
adapter = PodDBAdapter.getInstance();
adapter.open();
Cursor queue = adapter.getQueueIDCursor();

View File

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

View File

@ -199,7 +199,7 @@ public class FeedItemMenuHandler {
DBWriter.addQueueItem(context, selectedItem);
break;
case R.id.remove_from_queue_item:
DBWriter.removeQueueItem(context, selectedItem, true);
DBWriter.removeQueueItem(context, true, selectedItem);
break;
case R.id.add_to_favorites_item:
DBWriter.addFavoriteItem(selectedItem);

View File

@ -918,7 +918,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
final List<FeedItem> queue = taskManager.getQueue();
if (QueueAccess.ItemListAccess(queue).contains(item.getId())) {
// don't know if it actually matters to not autodownload when smart mark as played is triggered
DBWriter.removeQueueItem(PlaybackService.this, item, ended);
DBWriter.removeQueueItem(PlaybackService.this, ended, item);
}
} catch (InterruptedException e) {
e.printStackTrace();

View File

@ -423,13 +423,12 @@ public class DBWriter {
/**
* Removes a FeedItem object from the queue.
*
* @param context A context that is used for opening a database connection.
* @param item FeedItem that should be removed.
* @param context A context that is used for opening a database connection.
* @param performAutoDownload true if an auto-download process should be started after the operation.
* @param item FeedItem that should be removed.
*/
public static Future<?> removeQueueItem(final Context context,
final FeedItem item, final boolean performAutoDownload) {
final boolean performAutoDownload, final FeedItem item) {
return dbExec.submit(() -> removeQueueItemSynchronous(context, performAutoDownload, item.getId()));
}