From 8ebb9854e6b371c8b8d6a013d13cb583040ac64a Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Tue, 16 Oct 2018 14:31:49 +0200 Subject: Allow to select all above in batch editor --- .../dialog/EpisodesApplyActionFragment.java | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'app/src/main/java/de/danoeh/antennapod/dialog') 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 d1ee926ac..7f054f5dd 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/EpisodesApplyActionFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/EpisodesApplyActionFragment.java @@ -1,5 +1,6 @@ package de.danoeh.antennapod.dialog; +import android.app.AlertDialog; import android.content.res.TypedArray; import android.graphics.drawable.Drawable; import android.os.Bundle; @@ -95,6 +96,28 @@ public class EpisodesApplyActionFragment extends Fragment { } refreshCheckboxes(); }); + mListView.setOnItemLongClickListener((adapterView, view12, position, id) -> { + new AlertDialog.Builder(getActivity()) + .setItems(R.array.batch_long_press_options, (dialogInterface, item) -> { + int direction; + if (item == 0) { + direction = -1; + } else { + direction = 1; + } + + int currentPosition = position + direction; + while (currentPosition >= 0 && currentPosition < episodes.size()) { + long id1 = episodes.get(currentPosition).getId(); + if (!checkedIds.contains(id1)) { + checkedIds.add(id1); + } + currentPosition += direction; + } + refreshCheckboxes(); + }).show(); + return true; + }); for(FeedItem episode : episodes) { titles.add(episode.getTitle()); -- cgit v1.2.3