diff options
author | Vishnu Sanal T <50027064+VishnuSanal@users.noreply.github.com> | 2022-10-29 20:56:14 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-29 17:26:14 +0200 |
commit | c171ab6823150d8cba1fe836269881ff5ec9cf2a (patch) | |
tree | e261c57bffe0809cfaf0ccdf6e21a30360e63141 /core | |
parent | fe2195f051e5b9a17281f4a42c54ad803fe6c9ef (diff) | |
download | AntennaPod-c171ab6823150d8cba1fe836269881ff5ec9cf2a.zip |
Remove 'seconds' and 'hours' options from sleep timer (#6148)
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/preferences/SleepTimerPreferences.java | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/preferences/SleepTimerPreferences.java b/core/src/main/java/de/danoeh/antennapod/core/preferences/SleepTimerPreferences.java index 31cb2d928..b56e7e6f3 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/preferences/SleepTimerPreferences.java +++ b/core/src/main/java/de/danoeh/antennapod/core/preferences/SleepTimerPreferences.java @@ -11,17 +11,14 @@ public class SleepTimerPreferences { private static final String TAG = "SleepTimerPreferences"; - private static final String PREF_NAME = "SleepTimerDialog"; + public static final String PREF_NAME = "SleepTimerDialog"; private static final String PREF_VALUE = "LastValue"; - private static final String PREF_TIME_UNIT = "LastTimeUnit"; + private static final String PREF_VIBRATE = "Vibrate"; private static final String PREF_SHAKE_TO_RESET = "ShakeToReset"; private static final String PREF_AUTO_ENABLE = "AutoEnable"; - private static final TimeUnit[] UNITS = { TimeUnit.SECONDS, TimeUnit.MINUTES, TimeUnit.HOURS }; - private static final String DEFAULT_VALUE = "15"; - private static final int DEFAULT_TIME_UNIT = 1; private static SharedPreferences prefs; @@ -35,21 +32,17 @@ public class SleepTimerPreferences { SleepTimerPreferences.prefs = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); } - public static void setLastTimer(String value, int timeUnit) { - prefs.edit().putString(PREF_VALUE, value).putInt(PREF_TIME_UNIT, timeUnit).apply(); + public static void setLastTimer(String value) { + prefs.edit().putString(PREF_VALUE, value).apply(); } public static String lastTimerValue() { return prefs.getString(PREF_VALUE, DEFAULT_VALUE); } - public static int lastTimerTimeUnit() { - return prefs.getInt(PREF_TIME_UNIT, DEFAULT_TIME_UNIT); - } - public static long timerMillis() { long value = Long.parseLong(lastTimerValue()); - return UNITS[lastTimerTimeUnit()].toMillis(value); + return TimeUnit.MINUTES.toMillis(value); } public static void setVibrate(boolean vibrate) { |