diff options
author | Martin Fietz <Martin.Fietz@gmail.com> | 2018-10-21 11:05:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-21 11:05:43 +0200 |
commit | a8fdf88b74e60236d234dfde7cb81f6e467bfe77 (patch) | |
tree | cfedbbdb52168094459b6535896800e7be8ee6b8 | |
parent | f1710cae47e43ec6f638622f508f6bd17a970afb (diff) | |
parent | 8ebb9854e6b371c8b8d6a013d13cb583040ac64a (diff) | |
download | AntennaPod-a8fdf88b74e60236d234dfde7cb81f6e467bfe77.zip |
Merge pull request #2863 from ByteHamster/mark-all-below
Allow to select all above/below in batch editor
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/dialog/EpisodesApplyActionFragment.java | 23 | ||||
-rw-r--r-- | core/src/main/res/values/arrays.xml | 5 | ||||
-rw-r--r-- | core/src/main/res/values/strings.xml | 2 |
3 files changed, 30 insertions, 0 deletions
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()); diff --git a/core/src/main/res/values/arrays.xml b/core/src/main/res/values/arrays.xml index c02b700e4..7e2fed054 100644 --- a/core/src/main/res/values/arrays.xml +++ b/core/src/main/res/values/arrays.xml @@ -272,4 +272,9 @@ <item>stop</item> <item>continue</item> </string-array> + + <string-array name="batch_long_press_options"> + <item>@string/select_all_above</item> + <item>@string/select_all_below</item> + </string-array> </resources> diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index 18d3a01d6..ad91ecc76 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -144,6 +144,8 @@ <string name="load_complete_feed">Refresh complete podcast</string> <string name="hide_episodes_title">Hide Episodes</string> <string name="batch_edit">Batch edit</string> + <string name="select_all_above">Select all above</string> + <string name="select_all_below">Select all below</string> <string name="hide_unplayed_episodes_label">Unplayed</string> <string name="hide_paused_episodes_label">Paused</string> <string name="hide_played_episodes_label">Played</string> |