From 8ebf1539705aa2251f0e7f795e72bb214e51750b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Drobni=C4=8D?= Date: Fri, 8 Sep 2023 14:28:20 +0200 Subject: Add volume boost (#6573) --- .../antennapod/fragment/FeedSettingsFragment.java | 40 ++++++++++++++++------ app/src/main/res/xml/feed_settings.xml | 8 ++--- 2 files changed, 33 insertions(+), 15 deletions(-) (limited to 'app/src/main') diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/FeedSettingsFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/FeedSettingsFragment.java index ae9e003d5..0e4c883cf 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/FeedSettingsFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/FeedSettingsFragment.java @@ -156,7 +156,7 @@ public class FeedSettingsFragment extends Fragment { setupAutoDownloadPreference(); setupKeepUpdatedPreference(); setupAutoDeletePreference(); - setupVolumeReductionPreferences(); + setupVolumeAdaptationPreferences(); setupNewEpisodesAction(); setupAuthentificationPreference(); setupEpisodeFilterPreference(); @@ -166,7 +166,7 @@ public class FeedSettingsFragment extends Fragment { setupTags(); updateAutoDeleteSummary(); - updateVolumeReductionValue(); + updateVolumeAdaptationValue(); updateAutoDownloadEnabled(); updateNewEpisodesAction(); @@ -317,9 +317,9 @@ public class FeedSettingsFragment extends Fragment { } } - private void setupVolumeReductionPreferences() { - ListPreference volumeReductionPreference = findPreference("volumeReduction"); - volumeReductionPreference.setOnPreferenceChangeListener((preference, newValue) -> { + private void setupVolumeAdaptationPreferences() { + ListPreference volumeAdaptationPreference = findPreference("volumeReduction"); + volumeAdaptationPreference.setOnPreferenceChangeListener((preference, newValue) -> { switch ((String) newValue) { case "off": feedPreferences.setVolumeAdaptionSetting(VolumeAdaptionSetting.OFF); @@ -330,28 +330,46 @@ public class FeedSettingsFragment extends Fragment { case "heavy": feedPreferences.setVolumeAdaptionSetting(VolumeAdaptionSetting.HEAVY_REDUCTION); break; + case "light_boost": + feedPreferences.setVolumeAdaptionSetting(VolumeAdaptionSetting.LIGHT_BOOST); + break; + case "medium_boost": + feedPreferences.setVolumeAdaptionSetting(VolumeAdaptionSetting.MEDIUM_BOOST); + break; + case "heavy_boost": + feedPreferences.setVolumeAdaptionSetting(VolumeAdaptionSetting.HEAVY_BOOST); + break; default: } DBWriter.setFeedPreferences(feedPreferences); - updateVolumeReductionValue(); + updateVolumeAdaptationValue(); EventBus.getDefault().post( new VolumeAdaptionChangedEvent(feedPreferences.getVolumeAdaptionSetting(), feed.getId())); return false; }); } - private void updateVolumeReductionValue() { - ListPreference volumeReductionPreference = findPreference("volumeReduction"); + private void updateVolumeAdaptationValue() { + ListPreference volumeAdaptationPreference = findPreference("volumeReduction"); switch (feedPreferences.getVolumeAdaptionSetting()) { case OFF: - volumeReductionPreference.setValue("off"); + volumeAdaptationPreference.setValue("off"); break; case LIGHT_REDUCTION: - volumeReductionPreference.setValue("light"); + volumeAdaptationPreference.setValue("light"); break; case HEAVY_REDUCTION: - volumeReductionPreference.setValue("heavy"); + volumeAdaptationPreference.setValue("heavy"); + break; + case LIGHT_BOOST: + volumeAdaptationPreference.setValue("light_boost"); + break; + case MEDIUM_BOOST: + volumeAdaptationPreference.setValue("medium_boost"); + break; + case HEAVY_BOOST: + volumeAdaptationPreference.setValue("heavy_boost"); break; } } diff --git a/app/src/main/res/xml/feed_settings.xml b/app/src/main/res/xml/feed_settings.xml index 619ab6296..fb9e2e425 100644 --- a/app/src/main/res/xml/feed_settings.xml +++ b/app/src/main/res/xml/feed_settings.xml @@ -50,12 +50,12 @@ + android:summary="@string/feed_volume_adaptation_summary" + android:title="@string/feed_volume_adapdation" />