Repository: AntennaPod/AntennaPod (language: java)

Issue:
Multi select and changing automatic download setting
### Checklist

- [x] I have used the search function for [**OPEN**](https://github.com/AntennaPod/AntennaPod/issues) issues to see if someone else has already submitted the same feature request.
- [x] I have **also** used the search function for [**CLOSED**](https://github.com/AntennaPod/AntennaPod/issues?q=is%3Aissue+is%3Aclosed) issues to see if the feature was already implemented and is just waiting to be released, or if the feature was rejected.
- [x] I will describe the problem with as much detail as possible.
- [x] This request contains only one single feature, **not** a list of multiple (related) features.

### App version

3.7.0-beta2

### Feature or improvement you want

Automatic download has been changed and now it's no longer an on/off toggle. Additionally it can be set to use default setting.
When managing settings for multiple subscriptions at once it's not possible to set it to default.

### Why should this be added?

So it's possible to change to default behavior for multiple subscriptions at once.
It would be good to do it before final release. For those me who had turned it on for multiple podcast then globally disabled automatic download it will trigger download.

What I did is set all subscription to disable since I couldn't choose default behavior. As a side note filtering should probably also be updated.

### Screenshots / Drawings / Technical details

_No response_


Discussion / hints:
> For those me who had turned it on for multiple podcast then globally disabled automatic download it will trigger download.

Hmm, weird. We actually migrated the per-podcast value "on" to "global default", so that AntennaPod does not start downloading automatically after the upgrade. Are you sure that it actually started to download before you touched any settings?
I think so.

I follow a podcast and I am catching up on it. The podcast is still publishing every week and release a full episode and an excerpt. I always mark as read excerpt and dismiss full episode. They are not released the same day.
But this morning I noticed in my queue the newest episode and an excerpt
I can't be 100 percent sure but I don't think I would have mistakenly download both. One was 2 day ago, the other 4 days ago. Too bad download log don't log if download was triggered manually or automatically.

Beside when I checked settings for this podcast automatic download was on. Yet global is set to off.

Could it be possible settings was messed up when I tried a go to settings? Before fixing screen wanting to load a variable that was no longer a boolean one?
I am sure it one of the podcast I tried to go to specific settings when it crashed.
I don't think the crash caused a setting to change. Do you, by any chance, have a database export from before the upgrade to 2.7.x? Did you enable "auto-download episodes in queue"?
I have one on the 6th. I am sending it to you on Matrix. Tell me if it's not OK.
And no download episodes in queue is off

Fix patch:
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/FeedMultiSelectActionHandler.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/FeedMultiSelectActionHandler.java
index d441423b26..3cbde2d3e7 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/FeedMultiSelectActionHandler.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/FeedMultiSelectActionHandler.java
@@ -63,14 +63,18 @@ private void notifyNewEpisodesPrefHandler() {
     }
 
     private void autoDownloadPrefHandler() {
-        PreferenceSwitchDialog preferenceSwitchDialog = new PreferenceSwitchDialog(activity,
-                activity.getString(R.string.auto_download_settings_label),
+        PreferenceListDialog preferenceListDialog = new PreferenceListDialog(activity,
                 activity.getString(R.string.auto_download_label));
-        preferenceSwitchDialog.setOnPreferenceChangedListener(enabled ->
-                saveFeedPreferences(feedPreferences ->
-                        feedPreferences.setAutoDownload(FeedPreferences.AutoDownloadSetting.fromBoolean(enabled))
-                ));
-        preferenceSwitchDialog.openDialog();
+        String[] items = activity.getResources().getStringArray(R.array.spnEnableAutoDownloadItems);
+        preferenceListDialog.openDialog(items);
+        preferenceListDialog.setOnPreferenceChangedListener(which -> {
+            FeedPreferences.AutoDownloadSetting autoDownloadSetting = switch (which) {
+                case 1 -> FeedPreferences.AutoDownloadSetting.ENABLED;
+                case 2 -> FeedPreferences.AutoDownloadSetting.DISABLED;
+                default -> FeedPreferences.AutoDownloadSetting.GLOBAL;
+            };
+            saveFeedPreferences(feedPreferences -> feedPreferences.setAutoDownload(autoDownloadSetting));
+        });
     }
 
     private void playbackSpeedPrefHandler() {


Test patch: