Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Unified Diff: content/public/android/java/src/org/chromium/content/browser/input/DateDialogNormalizer.java

Issue 23623019: Support datalist for date/time input types on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/public/android/java/src/org/chromium/content/browser/input/DateDialogNormalizer.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/input/DateDialogNormalizer.java b/content/public/android/java/src/org/chromium/content/browser/input/DateDialogNormalizer.java
index 463480801b2e10762ba382d80c438817d9e36032..709d0e73943d9f289dfffb965f7079673302f931 100644
--- a/content/public/android/java/src/org/chromium/content/browser/input/DateDialogNormalizer.java
+++ b/content/public/android/java/src/org/chromium/content/browser/input/DateDialogNormalizer.java
@@ -15,15 +15,15 @@ import java.util.TimeZone;
*/
class DateDialogNormalizer {
- private static void setLimits(DatePicker picker, long min, long max) {
+ private static void setLimits(DatePicker picker, long minMillis, long maxMillis) {
// DatePicker intervals are non inclusive, the DatePicker will throw an
// exception when setting the min/max attribute to the current date
// so make sure this never happens
- if (max <= min) {
+ if (maxMillis <= minMillis) {
return;
}
- Calendar minCal = trimToDate(min);
- Calendar maxCal = trimToDate(max);
+ Calendar minCal = trimToDate(minMillis);
+ Calendar maxCal = trimToDate(maxMillis);
int currentYear = picker.getYear();
int currentMonth = picker.getMonth();
int currentDayOfMonth = picker.getDayOfMonth();
@@ -57,21 +57,21 @@ class DateDialogNormalizer {
* needed to comply with the {@code min} and {@code max} attributes.
*/
static void normalize(DatePicker picker, OnDateChangedListener listener,
- int year, int month, int day, int hour, int minute, long min, long max) {
+ int year, int month, int day, int hour, int minute, long minMillis, long maxMillis) {
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
calendar.clear();
calendar.set(year, month, day, hour, minute, 0);
- if (calendar.getTimeInMillis() < min) {
+ if (calendar.getTimeInMillis() < minMillis) {
calendar.clear();
- calendar.setTimeInMillis(min);
- } else if (calendar.getTimeInMillis() > max) {
+ calendar.setTimeInMillis(minMillis);
+ } else if (calendar.getTimeInMillis() > maxMillis) {
calendar.clear();
- calendar.setTimeInMillis(max);
+ calendar.setTimeInMillis(maxMillis);
}
picker.init(
calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH),
calendar.get(Calendar.DAY_OF_MONTH), listener);
- setLimits(picker, min, max);
+ setLimits(picker, minMillis, maxMillis);
}
}

Powered by Google App Engine
This is Rietveld 408576698