Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7ccfa061 authored by Sungmin Choi's avatar Sungmin Choi Committed by Elliott Hughes
Browse files

use date from 1970-01-01 to 2037-12-31 in DatePickerDialog

In case of using DatePickerDialog, user could select any date
before 1970-01-01. However, the system clock cannot be set to
a date before 1970-01-01.
As a result, user couldn't select date before 1970-01-01.
So, use date from 1970-01-01 to 2037-12-31 of DatePickerDialog.

Steps to reproduce:
1. Settings -> Date & time
2. uncheck Automatic date & time
3. Set Date
4. choose any date before 1970 and Done

Change-Id: I075b3fcaa86df1c314c85dd3dd85474a28b8c637
parent 506b68e1
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -244,6 +244,15 @@ public class DateTimeSettings extends SettingsPreferenceFragment
                calendar.get(Calendar.YEAR),
                calendar.get(Calendar.MONTH),
                calendar.get(Calendar.DAY_OF_MONTH));
            // The system clock can't represent dates outside this range.
            DatePickerDialog datePicker = (DatePickerDialog)d;
            Calendar t = Calendar.getInstance();
            t.clear();
            t.set(1970, Calendar.JANUARY, 1);
            datePicker.getDatePicker().setMinDate(t.getTimeInMillis());
            t.clear();
            t.set(2037, Calendar.DECEMBER, 31);
            datePicker.getDatePicker().setMaxDate(t.getTimeInMillis());
            break;
        }
        case DIALOG_TIMEPICKER: {