OLD | NEW |
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 android.content.Context; | 7 import android.content.Context; |
8 | 8 |
9 import org.chromium.base.CalledByNative; | 9 import org.chromium.base.CalledByNative; |
10 import org.chromium.base.JNINamespace; | 10 import org.chromium.base.JNINamespace; |
(...skipping 20 matching lines...) Expand all Loading... |
31 } | 31 } |
32 | 32 |
33 @Override | 33 @Override |
34 public void cancelDateTimeDialog() { | 34 public void cancelDateTimeDialog() { |
35 nativeCancelDialog(mNativeDateTimeChooserAndroid); | 35 nativeCancelDialog(mNativeDateTimeChooserAndroid); |
36 } | 36 } |
37 }); | 37 }); |
38 } | 38 } |
39 | 39 |
40 private void showDialog(int dialogType, double dialogValue, | 40 private void showDialog(int dialogType, double dialogValue, |
41 double min, double max, double step) { | 41 double min, double max, double step, |
42 mInputDialogContainer.showDialog(dialogType, dialogValue, min, max, step
); | 42 DateTimeSuggestion[] suggestions) { |
| 43 mInputDialogContainer.showDialog(dialogType, dialogValue, min, max, step
, suggestions); |
43 } | 44 } |
44 | 45 |
45 @CalledByNative | 46 @CalledByNative |
46 private static DateTimeChooserAndroid createDateTimeChooser( | 47 private static DateTimeChooserAndroid createDateTimeChooser( |
47 ContentViewCore contentViewCore, | 48 ContentViewCore contentViewCore, |
48 long nativeDateTimeChooserAndroid, | 49 long nativeDateTimeChooserAndroid, |
49 int dialogType, double dialogValue, | 50 int dialogType, double dialogValue, |
50 double min, double max, double step) { | 51 double min, double max, double step, |
| 52 DateTimeSuggestion[] suggestions) { |
51 DateTimeChooserAndroid chooser = | 53 DateTimeChooserAndroid chooser = |
52 new DateTimeChooserAndroid( | 54 new DateTimeChooserAndroid( |
53 contentViewCore.getContext(), | 55 contentViewCore.getContext(), |
54 nativeDateTimeChooserAndroid); | 56 nativeDateTimeChooserAndroid); |
55 chooser.showDialog(dialogType, dialogValue, min, max, step); | 57 chooser.showDialog(dialogType, dialogValue, min, max, step, suggestions)
; |
56 return chooser; | 58 return chooser; |
57 } | 59 } |
58 | 60 |
59 @CalledByNative | 61 @CalledByNative |
| 62 private static DateTimeSuggestion[] createSuggestionsArray(int size) { |
| 63 return new DateTimeSuggestion[size]; |
| 64 } |
| 65 |
| 66 /** |
| 67 * @param array DateTimeSuggestion array that should get a new suggestion se
t. |
| 68 * @param index Index in the array where to place a new suggestion. |
| 69 * @param value Value of the suggestion. |
| 70 * @param localizedValue Localized value of the suggestion. |
| 71 * @param label Label of the suggestion. |
| 72 */ |
| 73 @CalledByNative |
| 74 private static void setDateTimeSuggestionAt(DateTimeSuggestion[] array, int
index, |
| 75 double value, String localizedValue, String label) { |
| 76 array[index] = new DateTimeSuggestion(value, localizedValue, label); |
| 77 } |
| 78 |
| 79 @CalledByNative |
60 private static void initializeDateInputTypes( | 80 private static void initializeDateInputTypes( |
61 int textInputTypeDate, int textInputTypeDateTime, | 81 int textInputTypeDate, int textInputTypeDateTime, |
62 int textInputTypeDateTimeLocal, int textInputTypeMonth, | 82 int textInputTypeDateTimeLocal, int textInputTypeMonth, |
63 int textInputTypeTime, int textInputTypeWeek) { | 83 int textInputTypeTime, int textInputTypeWeek) { |
64 InputDialogContainer.initializeInputTypes(textInputTypeDate, | 84 InputDialogContainer.initializeInputTypes( |
| 85 textInputTypeDate, |
65 textInputTypeDateTime, textInputTypeDateTimeLocal, | 86 textInputTypeDateTime, textInputTypeDateTimeLocal, |
66 textInputTypeMonth, textInputTypeTime, textInputTypeWeek); | 87 textInputTypeMonth, textInputTypeTime, textInputTypeWeek); |
67 } | 88 } |
68 | 89 |
69 private native void nativeReplaceDateTime(long nativeDateTimeChooserAndroid, | 90 private native void nativeReplaceDateTime(long nativeDateTimeChooserAndroid, |
70 double dialogValue); | 91 double dialogValue); |
71 | 92 |
72 private native void nativeCancelDialog(long nativeDateTimeChooserAndroid); | 93 private native void nativeCancelDialog(long nativeDateTimeChooserAndroid); |
73 } | 94 } |
OLD | NEW |