From 60f3d77eb2d41d49ad6fd999c39f5792f804a17e Mon Sep 17 00:00:00 2001 From: quails4Eva Date: Sun, 3 Mar 2024 19:17:22 +0000 Subject: Skip silence setting per feed (#6910) --- .../antennapod/model/feed/FeedPreferences.java | 34 ++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'model/src') diff --git a/model/src/main/java/de/danoeh/antennapod/model/feed/FeedPreferences.java b/model/src/main/java/de/danoeh/antennapod/model/feed/FeedPreferences.java index 39b6e2bdd..02f09693e 100644 --- a/model/src/main/java/de/danoeh/antennapod/model/feed/FeedPreferences.java +++ b/model/src/main/java/de/danoeh/antennapod/model/feed/FeedPreferences.java @@ -59,6 +59,25 @@ public class FeedPreferences implements Serializable { } } + public enum SkipSilence { + OFF(0), GLOBAL(1), AGGRESSIVE(2); + + public final int code; + + SkipSilence(int code) { + this.code = code; + } + + public static SkipSilence fromCode(int code) { + for (SkipSilence s : values()) { + if (s.code == code) { + return s; + } + } + return GLOBAL; + } + } + @NonNull private FeedFilter filter; private long feedID; @@ -72,6 +91,7 @@ public class FeedPreferences implements Serializable { private float feedPlaybackSpeed; private int feedSkipIntro; private int feedSkipEnding; + private SkipSilence feedSkipSilence; private boolean showEpisodeNotification; private final Set tags = new HashSet<>(); @@ -79,13 +99,14 @@ public class FeedPreferences implements Serializable { VolumeAdaptionSetting volumeAdaptionSetting, NewEpisodesAction newEpisodesAction, String username, String password) { this(feedID, autoDownload, true, autoDeleteAction, volumeAdaptionSetting, username, password, - new FeedFilter(), SPEED_USE_GLOBAL, 0, 0, false, newEpisodesAction, new HashSet<>()); + new FeedFilter(), SPEED_USE_GLOBAL, 0, 0, SkipSilence.GLOBAL, + false, newEpisodesAction, new HashSet<>()); } public FeedPreferences(long feedID, boolean autoDownload, boolean keepUpdated, AutoDeleteAction autoDeleteAction, VolumeAdaptionSetting volumeAdaptionSetting, String username, String password, @NonNull FeedFilter filter, - float feedPlaybackSpeed, int feedSkipIntro, int feedSkipEnding, + float feedPlaybackSpeed, int feedSkipIntro, int feedSkipEnding, SkipSilence feedSkipSilence, boolean showEpisodeNotification, NewEpisodesAction newEpisodesAction, Set tags) { this.feedID = feedID; @@ -99,6 +120,7 @@ public class FeedPreferences implements Serializable { this.feedPlaybackSpeed = feedPlaybackSpeed; this.feedSkipIntro = feedSkipIntro; this.feedSkipEnding = feedSkipEnding; + this.feedSkipSilence = feedSkipSilence; this.showEpisodeNotification = showEpisodeNotification; this.newEpisodesAction = newEpisodesAction; this.tags.addAll(tags); @@ -241,6 +263,14 @@ public class FeedPreferences implements Serializable { return feedSkipEnding; } + public void setFeedSkipSilence(SkipSilence skipSilence) { + feedSkipSilence = skipSilence; + } + + public SkipSilence getFeedSkipSilence() { + return feedSkipSilence; + } + public Set getTags() { return tags; } -- cgit v1.2.3