From b683d33bcb94f565367d28f504499e100b5839af Mon Sep 17 00:00:00 2001 From: orionlee Date: Wed, 3 Apr 2019 14:21:35 -0700 Subject: [PATCH] bulk edit - refactor - reorder method parameter for DBWriter.removeQueueItem(Context, FeedItem, boolean) to be consistent with the rest of the API. --- .../java/de/test/antennapod/storage/DBWriterTest.java | 2 +- .../java/de/danoeh/antennapod/fragment/QueueFragment.java | 2 +- .../danoeh/antennapod/menuhandler/FeedItemMenuHandler.java | 2 +- .../antennapod/core/service/playback/PlaybackService.java | 2 +- .../java/de/danoeh/antennapod/core/storage/DBWriter.java | 7 +++---- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/src/androidTest/java/de/test/antennapod/storage/DBWriterTest.java b/app/src/androidTest/java/de/test/antennapod/storage/DBWriterTest.java index 9676d8956..27d76116d 100644 --- a/app/src/androidTest/java/de/test/antennapod/storage/DBWriterTest.java +++ b/app/src/androidTest/java/de/test/antennapod/storage/DBWriterTest.java @@ -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(); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java index faeabf75c..d65c6ae18 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java @@ -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); diff --git a/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java index 321b9c7bb..3f8d88af7 100644 --- a/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java +++ b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java @@ -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); diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java index 66cf7d244..827709350 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java @@ -918,7 +918,7 @@ public class PlaybackService extends MediaBrowserServiceCompat { final List 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(); 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 909b46414..ad20bfa0a 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 @@ -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())); }