diff options
author | ebraminio <ebrahim@gnu.org> | 2023-05-29 15:15:25 +0330 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-29 13:45:25 +0200 |
commit | d51e937e9651bcd5955055bee6abffcdefaa0c66 (patch) | |
tree | 290755bf29abd5fb820096db3cf6f341d3da37a2 /app/src/main | |
parent | 10c70dd5f1bd498de32e323cd2832e247df80db7 (diff) | |
download | AntennaPod-d51e937e9651bcd5955055bee6abffcdefaa0c66.zip |
Use the brand new material switches for preferences (#6475)
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/dialog/SleepTimerDialog.java | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/SleepTimerDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/SleepTimerDialog.java index ecbc1d873..8314382cb 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/SleepTimerDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/SleepTimerDialog.java @@ -131,13 +131,7 @@ public class SleepTimerDialog extends DialogFragment { changeTimesButton.setOnClickListener(changeTimesBtn -> { int from = SleepTimerPreferences.autoEnableFrom(); int to = SleepTimerPreferences.autoEnableTo(); - TimeRangeDialog dialog = new TimeRangeDialog(getContext(), from, to); - dialog.setOnDismissListener(v -> { - SleepTimerPreferences.setAutoEnableFrom(dialog.getFrom()); - SleepTimerPreferences.setAutoEnableTo(dialog.getTo()); - updateAutoEnableText(); - }); - dialog.show(); + showTimeRangeDialog(getContext(), from, to); }); Button disableButton = content.findViewById(R.id.disableSleeptimerButton); @@ -170,6 +164,16 @@ public class SleepTimerDialog extends DialogFragment { return builder.create(); } + private void showTimeRangeDialog(Context context, int from, int to) { + TimeRangeDialog dialog = new TimeRangeDialog(context, from, to); + dialog.setOnDismissListener(v -> { + SleepTimerPreferences.setAutoEnableFrom(dialog.getFrom()); + SleepTimerPreferences.setAutoEnableTo(dialog.getTo()); + updateAutoEnableText(); + }); + dialog.show(); + } + private void updateAutoEnableText() { String text; int from = SleepTimerPreferences.autoEnableFrom(); |