| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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.chrome.browser.autofill; | 5 package org.chromium.chrome.browser.autofill; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.view.LayoutInflater; | 8 import android.view.LayoutInflater; |
| 9 import android.view.View; | 9 import android.view.View; |
| 10 import android.view.ViewGroup; | 10 import android.view.ViewGroup; |
| 11 import android.widget.ArrayAdapter; | 11 import android.widget.ArrayAdapter; |
| 12 import android.widget.TextView; | 12 import android.widget.TextView; |
| 13 | 13 |
| 14 import org.chromium.content.app.AppResource; | 14 import org.chromium.chrome.R; |
| 15 | 15 |
| 16 import java.util.ArrayList; | 16 import java.util.ArrayList; |
| 17 | 17 |
| 18 /** | 18 /** |
| 19 * Autofill suggestion adapter for AutofillWindow. | 19 * Autofill suggestion adapter for AutofillWindow. |
| 20 */ | 20 */ |
| 21 public class AutofillListAdapter extends ArrayAdapter<AutofillSuggestion> { | 21 public class AutofillListAdapter extends ArrayAdapter<AutofillSuggestion> { |
| 22 private Context mContext; | 22 private Context mContext; |
| 23 | 23 |
| 24 AutofillListAdapter(Context context, ArrayList<AutofillSuggestion> objects)
{ | 24 AutofillListAdapter(Context context, ArrayList<AutofillSuggestion> objects)
{ |
| 25 super(context, AppResource.LAYOUT_AUTOFILL_TEXT, objects); | 25 super(context, R.layout.autofill_text, objects); |
| 26 mContext = context; | 26 mContext = context; |
| 27 } | 27 } |
| 28 | 28 |
| 29 @Override | 29 @Override |
| 30 public View getView(int position, View convertView, ViewGroup parent) { | 30 public View getView(int position, View convertView, ViewGroup parent) { |
| 31 View layout = convertView; | 31 View layout = convertView; |
| 32 if (convertView == null) { | 32 if (convertView == null) { |
| 33 LayoutInflater inflater = | 33 LayoutInflater inflater = |
| 34 (LayoutInflater) mContext.getSystemService(Context.LAYOUT_IN
FLATER_SERVICE); | 34 (LayoutInflater) mContext.getSystemService(Context.LAYOUT_IN
FLATER_SERVICE); |
| 35 layout = inflater.inflate(AppResource.LAYOUT_AUTOFILL_TEXT, null); | 35 layout = inflater.inflate(R.layout.autofill_text, null); |
| 36 } | 36 } |
| 37 TextView nameView = (TextView) layout.findViewById(AppResource.ID_AUTOFI
LL_NAME); | 37 TextView nameView = (TextView) layout.findViewById(R.id.autofill_name); |
| 38 nameView.setText(getItem(position).mName); | 38 nameView.setText(getItem(position).mName); |
| 39 TextView labelView = (TextView) layout.findViewById(AppResource.ID_AUTOF
ILL_LABEL); | 39 TextView labelView = (TextView) layout.findViewById(R.id.autofill_label)
; |
| 40 labelView.setText(getItem(position).mLabel); | 40 labelView.setText(getItem(position).mLabel); |
| 41 | 41 |
| 42 return layout; | 42 return layout; |
| 43 } | 43 } |
| 44 } | 44 } |
| OLD | NEW |