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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/input/DateTimeChooserAndroid.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, 2 months 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/DateTimeChooserAndroid.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/input/DateTimeChooserAndroid.java b/content/public/android/java/src/org/chromium/content/browser/input/DateTimeChooserAndroid.java
index 9ca9f955e9b97ebe43b430ab6cdc947a4102e705..4436b2410067e69ee0a78370d3af32ed3219cb31 100644
--- a/content/public/android/java/src/org/chromium/content/browser/input/DateTimeChooserAndroid.java
+++ b/content/public/android/java/src/org/chromium/content/browser/input/DateTimeChooserAndroid.java
@@ -39,15 +39,21 @@ class DateTimeChooserAndroid {
public void cancelDateTimeDialog() {
nativeCancelDialog(mNativeDateTimeChooserAndroid);
}
+
+ @Override
+ public void acceptDataListSuggestion(String value) {
+ nativeAcceptDataListSuggestion(mNativeDateTimeChooserAndroid, value);
+ }
});
}
private void showDialog(int dialogType, int year, int month, int monthDay,
int hour, int minute, int second, int milli,
- int week, double min, double max, double step) {
+ int week, double min, double max, double step,
+ DateTimeSuggestion[] suggestions) {
mInputDialogContainer.showDialog(
dialogType, year, month, monthDay,
- hour, minute, second, milli, week, min, max, step);
+ hour, minute, second, milli, week, min, max, step, suggestions);
}
@CalledByNative
@@ -56,18 +62,37 @@ class DateTimeChooserAndroid {
int nativeDateTimeChooserAndroid, int dialogType,
int year, int month, int day,
int hour, int minute, int second, int milli, int week,
- double min, double max, double step) {
+ double min, double max, double step,
+ DateTimeSuggestion[] suggestions) {
DateTimeChooserAndroid chooser =
new DateTimeChooserAndroid(
contentViewCore.getContext(),
nativeDateTimeChooserAndroid);
chooser.showDialog(
dialogType, year, month, day, hour, minute, second, milli,
- week, min, max, step);
+ week, min, max, step, suggestions);
return chooser;
}
@CalledByNative
+ private static DateTimeSuggestion[] createDateTimeSuggestionArray(int size) {
Miguel Garcia 2013/10/08 17:44:40 why do you need to preallocate the array in java?
keishi 2013/10/21 17:00:58 Done.
+ return new DateTimeSuggestion[size];
+ }
+
+ /**
+ * @param array ColorSuggestion array that should get a new suggestion added.
Miguel Garcia 2013/10/08 17:44:40 color suggestion? :) No need to add suggestions o
keishi 2013/10/21 17:00:58 Done.
+ * @param index Index in the array where to place a new suggestion.
+ * @param value Value of the suggestion.
+ * @param localizedValue Localized value of the suggestion.
+ * @param label Label of the suggestion.
+ */
+ @CalledByNative
+ private static void addToDateTimeSuggestionArray(DateTimeSuggestion[] array, int index,
+ String value, String localizedValue, String label) {
+ array[index] = new DateTimeSuggestion(value, localizedValue, label);
+ }
+
+ @CalledByNative
private static void initializeDateInputTypes(
int textInputTypeDate, int textInputTypeDateTime,
int textInputTypeDateTimeLocal, int textInputTypeMonth,
@@ -83,4 +108,7 @@ class DateTimeChooserAndroid {
int second, int milli, int week);
private native void nativeCancelDialog(int nativeDateTimeChooserAndroid);
+
+ private native void nativeAcceptDataListSuggestion(
Miguel Garcia 2013/10/08 17:44:40 don't add an extra JNI method, I think you can jus
keishi 2013/10/21 17:00:58 Done.
+ int nativeDateTimeChooserAndroid, String value);
}

Powered by Google App Engine
This is Rietveld 408576698