Bug 1339884 - Adjust DateTimePicker's upper and lower bound. r=Grisha, a=lizzard
authorJing-wei Wu <topwu.tw@gmail.com>
Wed, 22 Mar 2017 11:41:07 +0800
changeset 379316 f3a58f3d8c3023fd403941c136525a8235cb38cc
parent 379315 0c857c62e32e11742c5c4c002426221019f3c844
child 379317 5d3641819ecc692f87198b9c6cecb4de1aedaa89
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGrisha, lizzard
bugs1339884
milestone53.0
Bug 1339884 - Adjust DateTimePicker's upper and lower bound. r=Grisha, a=lizzard MozReview-Commit-ID: GuefY4Sp4wF
mobile/android/base/java/org/mozilla/gecko/widget/DateTimePicker.java
--- a/mobile/android/base/java/org/mozilla/gecko/widget/DateTimePicker.java
+++ b/mobile/android/base/java/org/mozilla/gecko/widget/DateTimePicker.java
@@ -282,16 +282,26 @@ public class DateTimePicker extends Fram
 
         // If we're displaying a date, the screen is wide enough
         // (and if we're using an SDK where the calendar view exists)
         // then display a calendar.
         if (mState == PickersState.DATE || mState == PickersState.DATETIME) {
             mCalendar = new CalendarView(context);
             mCalendar.setVisibility(GONE);
 
+            // Modify the time of mMaxDate and mMinDate to the end of the date and the beginning of the date. (Bug 1339884)
+            mMaxDate.set(Calendar.HOUR, 23);
+            mMaxDate.set(Calendar.MINUTE, 59);
+            mMaxDate.set(Calendar.SECOND, 59);
+            mMaxDate.set(Calendar.MILLISECOND, 999);
+            mMinDate.set(Calendar.HOUR, 0);
+            mMinDate.set(Calendar.MINUTE, 0);
+            mMinDate.set(Calendar.SECOND, 0);
+            mMinDate.set(Calendar.MILLISECOND, 0);
+
             mCalendar.setFocusable(true);
             mCalendar.setFocusableInTouchMode(true);
             mCalendar.setMaxDate(mMaxDate.getTimeInMillis());
             mCalendar.setMinDate(mMinDate.getTimeInMillis());
             mCalendar.setDate(mTempDate.getTimeInMillis(), false, false);
 
             mCalendar.setOnDateChangeListener(new CalendarView.OnDateChangeListener() {
                 @Override