Allow to select all above in batch editor

This commit is contained in:
ByteHamster 2018-10-16 14:31:49 +02:00
parent 2d4739bd84
commit 8ebb9854e6
3 changed files with 30 additions and 0 deletions

View File

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

View File

@ -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>

View File

@ -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>