diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-11-23 15:00:04 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-11-23 15:00:04 +0100 |
commit | 231a0b59a59c688016d8bd6847768a5d55d3282a (patch) | |
tree | 1b2afdebab84ec59392ee1279cde900b95e6a5b4 | |
parent | e5f2c9d1e918be11ac91c055ecc07dad9233c6d3 (diff) |
removed unecessary code in time preference
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/TimePreference.java | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/TimePreference.java b/src/main/java/de/pixart/messenger/ui/TimePreference.java index d3149a531..97750d6e3 100644 --- a/src/main/java/de/pixart/messenger/ui/TimePreference.java +++ b/src/main/java/de/pixart/messenger/ui/TimePreference.java @@ -46,8 +46,8 @@ public class TimePreference extends DialogPreference implements Preference.OnPre protected void onBindDialogView(final View v) { super.onBindDialogView(v); long time = getPersistedLong(DEFAULT_VALUE); - picker.setCurrentHour((int) (time / 60)); - picker.setCurrentMinute((int) (time % 60)); + picker.setCurrentHour((int) ((time % (24 * 60)) / 60)); + picker.setCurrentMinute((int) ((time % (24 * 60)) % 60)); } @Override @@ -78,12 +78,8 @@ public class TimePreference extends DialogPreference implements Preference.OnPre @Override protected void onSetInitialValue(final boolean restorePersistedValue, final Object defaultValue) { long time; - if (defaultValue == null) { - time = restorePersistedValue ? getPersistedLong(DEFAULT_VALUE) : DEFAULT_VALUE; - } else if (defaultValue instanceof Long) { + if (defaultValue instanceof Long) { time = restorePersistedValue ? getPersistedLong((Long) defaultValue) : (Long) defaultValue; - } else if (defaultValue instanceof Calendar) { - time = restorePersistedValue ? getPersistedLong(((Calendar) defaultValue).getTimeInMillis()) : ((Calendar) defaultValue).getTimeInMillis(); } else { time = restorePersistedValue ? getPersistedLong(DEFAULT_VALUE) : DEFAULT_VALUE; } |