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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/picker/InputDialogContainer.java

Issue 2569943002: Updated time picker to use new clock UI format (Closed)
Patch Set: Revert type=datetime changes Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/java/src/org/chromium/content/browser/picker/InputDialogContainer.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/picker/InputDialogContainer.java b/content/public/android/java/src/org/chromium/content/browser/picker/InputDialogContainer.java
index dcaa1cf8ca8ac6b30458a0b2599614f5530e1a3f..480f8af55544678c9b47e7a6b489895ea9ccf387 100644
--- a/content/public/android/java/src/org/chromium/content/browser/picker/InputDialogContainer.java
+++ b/content/public/android/java/src/org/chromium/content/browser/picker/InputDialogContainer.java
@@ -6,6 +6,8 @@ package org.chromium.content.browser.picker;
import android.app.AlertDialog;
import android.app.DatePickerDialog.OnDateSetListener;
+import android.app.TimePickerDialog;
+import android.app.TimePickerDialog.OnTimeSetListener;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnDismissListener;
@@ -210,12 +212,16 @@ public class InputDialogContainer {
dialog.setTitle(mContext.getText(R.string.date_picker_dialog_title));
mDialog = dialog;
} else if (dialogType == TextInputType.TIME) {
- mDialog = new MultiFieldTimePickerDialog(
- mContext, 0 /* theme */ ,
- hourOfDay, minute, second, millis,
- (int) min, (int) max, stepTime,
- DateFormat.is24HourFormat(mContext),
- new FullTimeListener(dialogType));
+ // If user doesn't need to set seconds and milliseconds, show the default clock style
+ // time picker dialog. Otherwise, show a full spinner style time picker.
+ if (stepTime < 0 || stepTime >= 60000 /* milliseconds in a minute */) {
+ mDialog = new TimePickerDialog(mContext, new TimeListener(dialogType), hourOfDay,
+ minute, DateFormat.is24HourFormat(mContext));
+ } else {
+ mDialog = new MultiFieldTimePickerDialog(mContext, 0 /* theme */, hourOfDay, minute,
+ second, millis, (int) min, (int) max, stepTime,
+ DateFormat.is24HourFormat(mContext), new FullTimeListener(dialogType));
+ }
} else if (dialogType == TextInputType.DATE_TIME
|| dialogType == TextInputType.DATE_TIME_LOCAL) {
mDialog = new DateTimePickerDialog(mContext,
@@ -285,6 +291,18 @@ public class InputDialogContainer {
}
}
+ private class TimeListener implements OnTimeSetListener {
+ private final int mDialogType;
+ TimeListener(int dialogType) {
+ mDialogType = dialogType;
+ }
+
+ @Override
+ public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
+ setFieldDateTimeValue(mDialogType, 0, 0, 0, hourOfDay, minute, 0, 0, 0);
+ }
+ }
+
private class FullTimeListener implements OnMultiFieldTimeSetListener {
private final int mDialogType;
FullTimeListener(int dialogType) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698