removed unecessary code in time preference
This commit is contained in:
parent
e5f2c9d1e9
commit
231a0b59a5
1 changed files with 3 additions and 7 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Reference in a new issue