aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-11-23 15:00:04 +0100
committerChristian Schneppe <christian@pix-art.de>2018-11-23 15:00:04 +0100
commit231a0b59a59c688016d8bd6847768a5d55d3282a (patch)
tree1b2afdebab84ec59392ee1279cde900b95e6a5b4 /src/main/java/de/pixart
parente5f2c9d1e918be11ac91c055ecc07dad9233c6d3 (diff)
removed unecessary code in time preference
Diffstat (limited to 'src/main/java/de/pixart')
-rw-r--r--src/main/java/de/pixart/messenger/ui/TimePreference.java10
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;
}