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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 org.chromium.base.CalledByNative; 7 import org.chromium.base.CalledByNative;
8 import org.chromium.base.JNINamespace; 8 import org.chromium.base.JNINamespace;
9 import org.chromium.content.browser.ContentViewCore; 9 import org.chromium.content.browser.ContentViewCore;
10 10
(...skipping 21 matching lines...) Expand all
32 int second, int milli, int week) { 32 int second, int milli, int week) {
33 nativeReplaceDateTime(mNativeDateTimeChooserAndroid, 33 nativeReplaceDateTime(mNativeDateTimeChooserAndroid,
34 dialogType, 34 dialogType,
35 year, month, day, hour, minute, second, milli, week); 35 year, month, day, hour, minute, second, milli, week);
36 } 36 }
37 37
38 @Override 38 @Override
39 public void cancelDateTimeDialog() { 39 public void cancelDateTimeDialog() {
40 nativeCancelDialog(mNativeDateTimeChooserAndroid); 40 nativeCancelDialog(mNativeDateTimeChooserAndroid);
41 } 41 }
42
43 @Override
44 public void acceptDataListSuggestion(String value) {
45 nativeAcceptDataListSuggestion(mNativeDateTimeChooserAndroid, va lue);
46 }
42 }); 47 });
43 } 48 }
44 49
45 private void showDialog(int dialogType, int year, int month, int monthDay, 50 private void showDialog(int dialogType, int year, int month, int monthDay,
46 int hour, int minute, int second, int milli, 51 int hour, int minute, int second, int milli,
47 int week, double min, double max, double step) { 52 int week, double min, double max, double step,
53 DateTimeSuggestion[] suggestions) {
48 mInputDialogContainer.showDialog( 54 mInputDialogContainer.showDialog(
49 dialogType, year, month, monthDay, 55 dialogType, year, month, monthDay,
50 hour, minute, second, milli, week, min, max, step); 56 hour, minute, second, milli, week, min, max, step, suggestions);
51 } 57 }
52 58
53 @CalledByNative 59 @CalledByNative
54 private static DateTimeChooserAndroid createDateTimeChooser( 60 private static DateTimeChooserAndroid createDateTimeChooser(
55 ContentViewCore contentViewCore, 61 ContentViewCore contentViewCore,
56 int nativeDateTimeChooserAndroid, int dialogType, 62 int nativeDateTimeChooserAndroid, int dialogType,
57 int year, int month, int day, 63 int year, int month, int day,
58 int hour, int minute, int second, int milli, int week, 64 int hour, int minute, int second, int milli, int week,
59 double min, double max, double step) { 65 double min, double max, double step,
66 DateTimeSuggestion[] suggestions) {
60 DateTimeChooserAndroid chooser = 67 DateTimeChooserAndroid chooser =
61 new DateTimeChooserAndroid( 68 new DateTimeChooserAndroid(
62 contentViewCore.getContext(), 69 contentViewCore.getContext(),
63 nativeDateTimeChooserAndroid); 70 nativeDateTimeChooserAndroid);
64 chooser.showDialog( 71 chooser.showDialog(
65 dialogType, year, month, day, hour, minute, second, milli, 72 dialogType, year, month, day, hour, minute, second, milli,
66 week, min, max, step); 73 week, min, max, step, suggestions);
67 return chooser; 74 return chooser;
68 } 75 }
69 76
70 @CalledByNative 77 @CalledByNative
78 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.
79 return new DateTimeSuggestion[size];
80 }
81
82 /**
83 * @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.
84 * @param index Index in the array where to place a new suggestion.
85 * @param value Value of the suggestion.
86 * @param localizedValue Localized value of the suggestion.
87 * @param label Label of the suggestion.
88 */
89 @CalledByNative
90 private static void addToDateTimeSuggestionArray(DateTimeSuggestion[] array, int index,
91 String value, String localizedValue, String label) {
92 array[index] = new DateTimeSuggestion(value, localizedValue, label);
93 }
94
95 @CalledByNative
71 private static void initializeDateInputTypes( 96 private static void initializeDateInputTypes(
72 int textInputTypeDate, int textInputTypeDateTime, 97 int textInputTypeDate, int textInputTypeDateTime,
73 int textInputTypeDateTimeLocal, int textInputTypeMonth, 98 int textInputTypeDateTimeLocal, int textInputTypeMonth,
74 int textInputTypeTime, int textInputTypeWeek) { 99 int textInputTypeTime, int textInputTypeWeek) {
75 InputDialogContainer.initializeInputTypes(textInputTypeDate, 100 InputDialogContainer.initializeInputTypes(textInputTypeDate,
76 textInputTypeDateTime, textInputTypeDateTimeLocal, 101 textInputTypeDateTime, textInputTypeDateTimeLocal,
77 textInputTypeMonth, textInputTypeTime, textInputTypeWeek); 102 textInputTypeMonth, textInputTypeTime, textInputTypeWeek);
78 } 103 }
79 104
80 private native void nativeReplaceDateTime( 105 private native void nativeReplaceDateTime(
81 int nativeDateTimeChooserAndroid, int dialogType, 106 int nativeDateTimeChooserAndroid, int dialogType,
82 int year, int month, int day, int hour, int minute, 107 int year, int month, int day, int hour, int minute,
83 int second, int milli, int week); 108 int second, int milli, int week);
84 109
85 private native void nativeCancelDialog(int nativeDateTimeChooserAndroid); 110 private native void nativeCancelDialog(int nativeDateTimeChooserAndroid);
111
112 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.
113 int nativeDateTimeChooserAndroid, String value);
86 } 114 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698