OLD | NEW |
---|---|
(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 | |
newt (away)
2013/11/04 17:35:55
remove empty line
keishi
2013/11/05 07:23:42
Done.
| |
11 import android.view.LayoutInflater; | |
12 import android.view.View; | |
13 import android.view.ViewGroup; | |
14 import android.widget.ArrayAdapter; | |
15 import android.widget.TextView; | |
16 | |
17 import org.chromium.content.R; | |
18 | |
19 import java.util.List; | |
20 | |
21 /** | |
22 * Autofill suggestion adapter for AutofillWindow. | |
newt (away)
2013/11/04 17:35:55
Fix javadoc
keishi
2013/11/05 07:23:42
Done.
| |
23 */ | |
24 public class DateTimeSuggestionListAdapter extends ArrayAdapter<DateTimeSuggesti on> { | |
25 private Context mContext; | |
newt (away)
2013/11/04 17:35:55
might as well be final
keishi
2013/11/05 07:23:42
Done.
| |
26 | |
27 DateTimeSuggestionListAdapter(Context context, List<DateTimeSuggestion> obje cts) { | |
28 super(context, R.layout.date_time_suggestion, objects); | |
29 mContext = context; | |
30 } | |
31 | |
32 @Override | |
33 public View getView(int position, View convertView, ViewGroup parent) { | |
34 View layout = convertView; | |
35 if (convertView == null) { | |
36 LayoutInflater inflater = LayoutInflater.from(mContext); | |
37 layout = inflater.inflate(R.layout.date_time_suggestion, null); | |
newt (away)
2013/11/04 17:35:55
do this:
layout = inflater.inflate(R.layout.d
keishi
2013/11/05 07:23:42
Done.
| |
38 } | |
39 TextView labelView = (TextView) layout.findViewById(R.id.date_time_sugge stion_value); | |
40 TextView sublabelView = (TextView) layout.findViewById(R.id.date_time_su ggestion_label); | |
41 | |
42 if (position == getCount() - 1) { | |
43 labelView.setText(mContext.getText(R.string.date_picker_dialog_other _button_label)); | |
44 sublabelView.setText(""); | |
45 } else { | |
46 labelView.setText(getItem(position).localizedValue); | |
47 sublabelView.setText(getItem(position).label); | |
48 } | |
49 | |
50 return layout; | |
51 } | |
52 | |
53 @Override | |
54 public int getCount() { | |
55 return super.getCount() + 1; | |
56 } | |
57 } | |
OLD | NEW |