Chromium Code Reviews| Index: content/public/android/java/src/org/chromium/content/browser/input/DateTimeSuggestionListAdapter.java |
| diff --git a/content/public/android/java/src/org/chromium/content/browser/input/DateTimeSuggestionListAdapter.java b/content/public/android/java/src/org/chromium/content/browser/input/DateTimeSuggestionListAdapter.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ee6da0292c8a145d15aed0f48688e34db3e3dc6f |
| --- /dev/null |
| +++ b/content/public/android/java/src/org/chromium/content/browser/input/DateTimeSuggestionListAdapter.java |
| @@ -0,0 +1,57 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| + |
| +package org.chromium.content.browser.input; |
| + |
| +import android.content.Context; |
| +import android.text.TextUtils; |
| + |
|
newt (away)
2013/11/04 17:35:55
remove empty line
keishi
2013/11/05 07:23:42
Done.
|
| +import android.view.LayoutInflater; |
| +import android.view.View; |
| +import android.view.ViewGroup; |
| +import android.widget.ArrayAdapter; |
| +import android.widget.TextView; |
| + |
| +import org.chromium.content.R; |
| + |
| +import java.util.List; |
| + |
| +/** |
| + * Autofill suggestion adapter for AutofillWindow. |
|
newt (away)
2013/11/04 17:35:55
Fix javadoc
keishi
2013/11/05 07:23:42
Done.
|
| + */ |
| +public class DateTimeSuggestionListAdapter extends ArrayAdapter<DateTimeSuggestion> { |
| + private Context mContext; |
|
newt (away)
2013/11/04 17:35:55
might as well be final
keishi
2013/11/05 07:23:42
Done.
|
| + |
| + DateTimeSuggestionListAdapter(Context context, List<DateTimeSuggestion> objects) { |
| + super(context, R.layout.date_time_suggestion, objects); |
| + mContext = context; |
| + } |
| + |
| + @Override |
| + public View getView(int position, View convertView, ViewGroup parent) { |
| + View layout = convertView; |
| + if (convertView == null) { |
| + LayoutInflater inflater = LayoutInflater.from(mContext); |
| + 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.
|
| + } |
| + TextView labelView = (TextView) layout.findViewById(R.id.date_time_suggestion_value); |
| + TextView sublabelView = (TextView) layout.findViewById(R.id.date_time_suggestion_label); |
| + |
| + if (position == getCount() - 1) { |
| + labelView.setText(mContext.getText(R.string.date_picker_dialog_other_button_label)); |
| + sublabelView.setText(""); |
| + } else { |
| + labelView.setText(getItem(position).localizedValue); |
| + sublabelView.setText(getItem(position).label); |
| + } |
| + |
| + return layout; |
| + } |
| + |
| + @Override |
| + public int getCount() { |
| + return super.getCount() + 1; |
| + } |
| +} |