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

Side by Side Diff: content/public/android/java/src/org/chromium/content/browser/input/DateTimeSuggestionListAdapter.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
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5
6 package org.chromium.content.browser.input;
7
8 import android.content.Context;
9 import android.text.TextUtils;
10 import android.view.LayoutInflater;
11 import android.view.View;
12 import android.view.ViewGroup;
13 import android.widget.ArrayAdapter;
14 import android.widget.TextView;
15
16 import org.chromium.content.R;
17
18 import java.util.List;
19
20 /**
21 * Date/time suggestion adapter for the suggestion dialog.
22 */
23 class DateTimeSuggestionListAdapter extends ArrayAdapter<DateTimeSuggestion> {
24 private final Context mContext;
25
26 DateTimeSuggestionListAdapter(Context context, List<DateTimeSuggestion> obje cts) {
27 super(context, R.layout.date_time_suggestion, objects);
28 mContext = context;
29 }
30
31 @Override
32 public View getView(int position, View convertView, ViewGroup parent) {
33 View layout = convertView;
34 if (convertView == null) {
35 LayoutInflater inflater = LayoutInflater.from(mContext);
36 layout = inflater.inflate(R.layout.date_time_suggestion, parent, fal se);
37 }
38 TextView labelView = (TextView) layout.findViewById(R.id.date_time_sugge stion_value);
39 TextView sublabelView = (TextView) layout.findViewById(R.id.date_time_su ggestion_label);
40
41 if (position == getCount() - 1) {
42 labelView.setText(mContext.getText(R.string.date_picker_dialog_other _button_label));
43 sublabelView.setText("");
44 } else {
45 labelView.setText(getItem(position).localizedValue());
46 sublabelView.setText(getItem(position).label());
47 }
48
49 return layout;
50 }
51
52 @Override
53 public int getCount() {
54 return super.getCount() + 1;
55 }
56 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698