use of de.danoeh.antennapod.fragment.preferences.dialog.PreferenceListDialog in project AntennaPod by AntennaPod.
the class FeedMultiSelectActionHandler method autoDeleteEpisodesPrefHandler.
private void autoDeleteEpisodesPrefHandler() {
PreferenceListDialog preferenceListDialog = new PreferenceListDialog(activity, "Auto delete episodes");
String[] items = activity.getResources().getStringArray(R.array.spnAutoDeleteItems);
String[] values = activity.getResources().getStringArray(R.array.spnAutoDeleteValues);
preferenceListDialog.openDialog(items);
preferenceListDialog.setOnPreferenceChangedListener(which -> {
FeedPreferences.AutoDeleteAction autoDeleteAction = null;
switch(values[which]) {
case "global":
autoDeleteAction = FeedPreferences.AutoDeleteAction.GLOBAL;
break;
case "always":
autoDeleteAction = FeedPreferences.AutoDeleteAction.YES;
break;
case "never":
autoDeleteAction = FeedPreferences.AutoDeleteAction.NO;
break;
default:
}
FeedPreferences.AutoDeleteAction finalAutoDeleteAction = autoDeleteAction;
saveFeedPreferences(feedPreferences -> {
feedPreferences.setAutoDeleteAction(finalAutoDeleteAction);
});
});
}
Aggregations