Disable duration text box when checkbox is off

This commit is contained in:
ByteHamster 2022-12-05 22:44:22 +01:00
parent ef97411fbb
commit 95eae1519a
1 changed files with 4 additions and 0 deletions

View File

@ -28,11 +28,15 @@ public abstract class EpisodeFilterDialog extends MaterialAlertDialogBuilder {
setTitle(R.string.episode_filters_label); setTitle(R.string.episode_filters_label);
setView(viewBinding.getRoot()); setView(viewBinding.getRoot());
viewBinding.durationCheckBox.setOnCheckedChangeListener(
(buttonView, isChecked) -> viewBinding.episodeFilterDurationText.setEnabled(isChecked));
if (filter.hasMinimalDurationFilter()) { if (filter.hasMinimalDurationFilter()) {
viewBinding.durationCheckBox.setChecked(true); viewBinding.durationCheckBox.setChecked(true);
// Store minimal duration in seconds, show in minutes // Store minimal duration in seconds, show in minutes
viewBinding.episodeFilterDurationText viewBinding.episodeFilterDurationText
.setText(String.valueOf(filter.getMinimalDurationFilter() / 60)); .setText(String.valueOf(filter.getMinimalDurationFilter() / 60));
} else {
viewBinding.episodeFilterDurationText.setEnabled(false);
} }
if (filter.excludeOnly()) { if (filter.excludeOnly()) {