Bug 1339884 - Adjust DateTimePicker's upper and lower bound. r=Grisha
authorJing-wei Wu <topwu.tw@gmail.com>
Wed, 22 Mar 2017 11:41:07 +0800
changeset 348976 4c728250f70cd1ec0efe97d2eefb016d3ae62092
parent 348975 c57a7c9275dc40da0803a824c058e3e44c6d94fa
child 348977 e0a12ec4de38bdc0c1e43c9175dff96d83a22f58
push id39361
push userihsiao@mozilla.com
push dateThu, 23 Mar 2017 02:24:57 +0000
treeherderautoland@4c728250f70c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGrisha
bugs1339884
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1339884 - Adjust DateTimePicker's upper and lower bound. r=Grisha 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