Skip to content

Commit

Permalink
Hide volume boost options when not supported
Browse files Browse the repository at this point in the history
  • Loading branch information
matejdro committed Dec 13, 2023
1 parent e76428b commit 59620b5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package de.danoeh.antennapod.preferences;

import android.content.Context;
import android.util.AttributeSet;

import java.util.Arrays;

import de.danoeh.antennapod.model.feed.VolumeAdaptionSetting;

public class VolumeAdaptationPreference extends MaterialListPreference {
public VolumeAdaptationPreference(Context context) {
super(context);
}

public VolumeAdaptationPreference(Context context, AttributeSet attrs) {
super(context, attrs);
}

@Override
public CharSequence[] getEntries() {
if (VolumeAdaptionSetting.BOOST_SUPPORTED) {
return super.getEntries();
} else {
return Arrays.copyOfRange(super.getEntries(), 0, 3);
}
}
}
2 changes: 1 addition & 1 deletion app/src/main/res/xml/feed_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
android:summary="@string/global_default"
android:title="@string/auto_delete_label" />

<de.danoeh.antennapod.preferences.MaterialListPreference
<de.danoeh.antennapod.preferences.VolumeAdaptationPreference
android:defaultValue="off"
android:entries="@array/spnVolumeAdaptationItems"
android:entryValues="@array/spnVolumeAdaptationValues"
Expand Down

0 comments on commit 59620b5

Please sign in to comment.