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

Side by Side Diff: content/public/android/java/src/org/chromium/content/browser/input/DateTimePickerDialog.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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.content.browser.input; 5 package org.chromium.content.browser.input;
6 6
7 import android.app.AlertDialog; 7 import android.app.AlertDialog;
8 import android.content.Context; 8 import android.content.Context;
9 import android.content.DialogInterface; 9 import android.content.DialogInterface;
10 import android.content.DialogInterface.OnClickListener; 10 import android.content.DialogInterface.OnClickListener;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 * @param year The initial year of the dialog. 53 * @param year The initial year of the dialog.
54 * @param monthOfYear The initial month of the dialog. 54 * @param monthOfYear The initial month of the dialog.
55 * @param dayOfMonth The initial day of the dialog. 55 * @param dayOfMonth The initial day of the dialog.
56 */ 56 */
57 public DateTimePickerDialog(Context context, 57 public DateTimePickerDialog(Context context,
58 OnDateTimeSetListener callBack, 58 OnDateTimeSetListener callBack,
59 int year, 59 int year,
60 int monthOfYear, 60 int monthOfYear,
61 int dayOfMonth, 61 int dayOfMonth,
62 int hourOfDay, int minute, boolean is24HourView, 62 int hourOfDay, int minute, boolean is24HourView,
63 long min, long max) { 63 double min, double max) {
64 super(context, 0); 64 super(context, 0);
65 65
66 mMinTimeMillis = min; 66 mMinTimeMillis = (long) min;
bulach 2013/12/04 10:37:54 should we instead change these members' types to b
keishi 2013/12/04 12:21:24 I think we should keep it as long. Time and Calen
67 mMaxTimeMillis = max; 67 mMaxTimeMillis = (long) max;
68 68
69 mCallBack = callBack; 69 mCallBack = callBack;
70 70
71 setButton(BUTTON_POSITIVE, context.getText( 71 setButton(BUTTON_POSITIVE, context.getText(
72 R.string.date_picker_dialog_set), this); 72 R.string.date_picker_dialog_set), this);
73 setButton(BUTTON_NEGATIVE, context.getText(android.R.string.cancel), 73 setButton(BUTTON_NEGATIVE, context.getText(android.R.string.cancel),
74 (OnClickListener) null); 74 (OnClickListener) null);
75 setIcon(0); 75 setIcon(0);
76 setTitle(context.getText(R.string.date_time_picker_dialog_title)); 76 setTitle(context.getText(R.string.date_time_picker_dialog_title));
77 77
78 LayoutInflater inflater = 78 LayoutInflater inflater =
79 (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATE R_SERVICE); 79 (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATE R_SERVICE);
80 View view = inflater.inflate(R.layout.date_time_picker_dialog, null); 80 View view = inflater.inflate(R.layout.date_time_picker_dialog, null);
81 setView(view); 81 setView(view);
82 mDatePicker = (DatePicker) view.findViewById(R.id.date_picker); 82 mDatePicker = (DatePicker) view.findViewById(R.id.date_picker);
83 DateDialogNormalizer.normalize(mDatePicker, this, 83 DateDialogNormalizer.normalize(mDatePicker, this,
84 year, monthOfYear, dayOfMonth, hourOfDay, minute, min, max); 84 year, monthOfYear, dayOfMonth, hourOfDay, minute, mMinTimeMillis , mMaxTimeMillis);
85 85
86 mTimePicker = (TimePicker) view.findViewById(R.id.time_picker); 86 mTimePicker = (TimePicker) view.findViewById(R.id.time_picker);
87 mTimePicker.setIs24HourView(is24HourView); 87 mTimePicker.setIs24HourView(is24HourView);
88 mTimePicker.setCurrentHour(hourOfDay); 88 mTimePicker.setCurrentHour(hourOfDay);
89 mTimePicker.setCurrentMinute(minute); 89 mTimePicker.setCurrentMinute(minute);
90 mTimePicker.setOnTimeChangedListener(this); 90 mTimePicker.setOnTimeChangedListener(this);
91 onTimeChanged(mTimePicker, mTimePicker.getCurrentHour(), 91 onTimeChanged(mTimePicker, mTimePicker.getCurrentHour(),
92 mTimePicker.getCurrentMinute()); 92 mTimePicker.getCurrentMinute());
93 } 93 }
94 94
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 * @param monthOfYear The date month. 151 * @param monthOfYear The date month.
152 * @param dayOfMonth The date day of month. 152 * @param dayOfMonth The date day of month.
153 */ 153 */
154 public void updateDateTime(int year, int monthOfYear, int dayOfMonth, 154 public void updateDateTime(int year, int monthOfYear, int dayOfMonth,
155 int hourOfDay, int minutOfHour) { 155 int hourOfDay, int minutOfHour) {
156 mDatePicker.updateDate(year, monthOfYear, dayOfMonth); 156 mDatePicker.updateDate(year, monthOfYear, dayOfMonth);
157 mTimePicker.setCurrentHour(hourOfDay); 157 mTimePicker.setCurrentHour(hourOfDay);
158 mTimePicker.setCurrentMinute(minutOfHour); 158 mTimePicker.setCurrentMinute(minutOfHour);
159 } 159 }
160 } 160 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698