diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/EpisodesApplyActionFragment.java b/app/src/main/java/de/danoeh/antennapod/dialog/EpisodesApplyActionFragment.java index 6776d80d1..5e5629047 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/EpisodesApplyActionFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/EpisodesApplyActionFragment.java @@ -47,8 +47,8 @@ public class EpisodesApplyActionFragment extends Fragment { private static final int ACTION_DOWNLOAD = 8; public static final int ACTION_REMOVE = 16; public static final int ACTION_REMOVE_FROM_QUEUE = 32; - private static final int ACTION_ALL = ACTION_QUEUE | ACTION_MARK_PLAYED | ACTION_MARK_UNPLAYED - | ACTION_DOWNLOAD | ACTION_REMOVE; + private static final int ACTION_ALL = ACTION_QUEUE | ACTION_REMOVE_FROM_QUEUE + | ACTION_MARK_PLAYED | ACTION_MARK_UNPLAYED | ACTION_DOWNLOAD | ACTION_REMOVE; private ListView mListView; private ArrayAdapter mAdapter; @@ -173,7 +173,7 @@ public class EpisodesApplyActionFragment extends Fragment { queueChecked(); break; case R.id.removeFromQueue: - Toast.makeText(getContext(), "To implement: remove from queue", Toast.LENGTH_SHORT).show(); + removeFromQueueChecked(); break; case R.id.markAsPlayed: markedCheckedPlayed(); @@ -473,6 +473,11 @@ public class EpisodesApplyActionFragment extends Fragment { close(); } + private void removeFromQueueChecked() { + DBWriter.removeQueueItem(getActivity(), true, checkedIds.toArray()); + close(); + } + private void markedCheckedPlayed() { DBWriter.markItemPlayed(FeedItem.PLAYED, checkedIds.toArray()); close(); 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 ab55bd3c0..451bb8685 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 @@ -6,8 +6,8 @@ import android.content.Intent; import android.content.SharedPreferences; import android.preference.PreferenceManager; import android.util.Log; +import android.widget.Toast; -import io.reactivex.annotations.NonNull; import org.shredzone.flattr4j.model.Flattr; import java.io.File; @@ -49,6 +49,7 @@ import de.danoeh.antennapod.core.util.flattr.FlattrStatus; import de.danoeh.antennapod.core.util.flattr.FlattrThing; import de.danoeh.antennapod.core.util.flattr.SimpleFlattrThing; import de.greenrobot.event.EventBus; +import io.reactivex.annotations.NonNull; /** * Provides methods for writing data to AntennaPod's database. @@ -459,6 +460,12 @@ public class DBWriter { } } + public static Future removeQueueItem(final Context context, final boolean performAutoDownload, + final long... itemIds) { + Toast.makeText(context, "To implement: remove from queue. ids=" + itemIds, Toast.LENGTH_SHORT).show(); + return dbExec.submit(() -> { }); + } + public static Future addFavoriteItem(final FeedItem item) { return dbExec.submit(() -> { final PodDBAdapter adapter = PodDBAdapter.getInstance().open();