bulk remove from queue - frontend logic, with a stub backend.

This commit is contained in:
orionlee 2019-04-02 14:11:22 -07:00
parent acbb1cf5e2
commit 7d78b88a1c
2 changed files with 16 additions and 4 deletions

View File

@ -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<String> 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();

View File

@ -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();