Clarify that new episodes action cannot be changed when autodownload is enabled (#8227)

This commit is contained in:
Hans-Peter Lehmann
2026-01-16 23:25:58 +01:00
committed by GitHub
parent 6695d5fadd
commit 780ceaa462
3 changed files with 13 additions and 1 deletions

View File

@ -22,6 +22,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.databinding.PlaybackSpeedFeedSettingDialogBinding; import de.danoeh.antennapod.databinding.PlaybackSpeedFeedSettingDialogBinding;
import de.danoeh.antennapod.event.MessageEvent;
import de.danoeh.antennapod.event.settings.SkipIntroEndingChangedEvent; import de.danoeh.antennapod.event.settings.SkipIntroEndingChangedEvent;
import de.danoeh.antennapod.event.settings.SpeedPresetChangedEvent; import de.danoeh.antennapod.event.settings.SpeedPresetChangedEvent;
import de.danoeh.antennapod.event.settings.VolumeAdaptionChangedEvent; import de.danoeh.antennapod.event.settings.VolumeAdaptionChangedEvent;
@ -213,6 +214,14 @@ public class FeedSettingsPreferenceFragment extends PreferenceFragmentCompat {
EventBus.getDefault().post(new VolumeAdaptionChangedEvent(newSetting, feed.getId())); EventBus.getDefault().post(new VolumeAdaptionChangedEvent(newSetting, feed.getId()));
return false; return false;
}); });
findPreference(PREF_NEW_EPISODES_ACTION).setOnPreferenceClickListener(preference -> {
boolean isAutoDownload = feed.getPreferences().isAutoDownload(UserPreferences.isEnableAutodownloadGlobal());
if (isAutoDownload && !feed.isLocalFeed()) {
EventBus.getDefault().post(new MessageEvent(getString(R.string.feed_new_episodes_action_snackbar)));
return true;
}
return false;
});
findPreference(PREF_NEW_EPISODES_ACTION).setOnPreferenceChangeListener((preference, newValue) -> { findPreference(PREF_NEW_EPISODES_ACTION).setOnPreferenceChangeListener((preference, newValue) -> {
int code = Integer.parseInt((String) newValue); int code = Integer.parseInt((String) newValue);
feedPreferences.setNewEpisodesAction(FeedPreferences.NewEpisodesAction.fromCode(code)); feedPreferences.setNewEpisodesAction(FeedPreferences.NewEpisodesAction.fromCode(code));
@ -284,7 +293,6 @@ public class FeedSettingsPreferenceFragment extends PreferenceFragmentCompat {
ListPreference newEpisodesAction = findPreference(PREF_NEW_EPISODES_ACTION); ListPreference newEpisodesAction = findPreference(PREF_NEW_EPISODES_ACTION);
boolean isAutoDownload = feed.getPreferences().isAutoDownload(UserPreferences.isEnableAutodownloadGlobal()); boolean isAutoDownload = feed.getPreferences().isAutoDownload(UserPreferences.isEnableAutodownloadGlobal());
if (isAutoDownload && !feed.isLocalFeed()) { if (isAutoDownload && !feed.isLocalFeed()) {
newEpisodesAction.setEnabled(false);
newEpisodesAction.setSummary(R.string.feed_new_episodes_action_summary_autodownload); newEpisodesAction.setSummary(R.string.feed_new_episodes_action_summary_autodownload);
return; return;
} }

View File

@ -159,6 +159,7 @@
<string name="feed_new_episodes_action_add_to_queue">Add to queue</string> <string name="feed_new_episodes_action_add_to_queue">Add to queue</string>
<string name="feed_new_episodes_action_nothing">Nothing</string> <string name="feed_new_episodes_action_nothing">Nothing</string>
<string name="feed_new_episodes_action_summary_autodownload">Automatic download enabled. Episodes are added to the inbox and then moved to the queue once downloaded.</string> <string name="feed_new_episodes_action_summary_autodownload">Automatic download enabled. Episodes are added to the inbox and then moved to the queue once downloaded.</string>
<string name="feed_new_episodes_action_snackbar">Cannot be changed when automatic download is enabled.</string>
<string name="episode_cleanup_never">Never</string> <string name="episode_cleanup_never">Never</string>
<string name="episode_cleanup_except_favorite_removal">When not favorited</string> <string name="episode_cleanup_except_favorite_removal">When not favorited</string>
<string name="episode_cleanup_queue_removal">When not in queue</string> <string name="episode_cleanup_queue_removal">When not in queue</string>

View File

@ -17,6 +17,9 @@ public class MaterialListPreference extends ListPreference {
@Override @Override
protected void onClick() { protected void onClick() {
if (getOnPreferenceClickListener() != null && getOnPreferenceClickListener().onPreferenceClick(this)) {
return;
}
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getContext()); MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getContext());
builder.setTitle(getTitle()); builder.setTitle(getTitle());
builder.setIcon(getDialogIcon()); builder.setIcon(getDialogIcon());